1From 750cfd9af2174e1fa8164e433be1379e3e367c78 Mon Sep 17 00:00:00 2001
2From: Silvan Mosberger <silvan.mosberger@moduscreate.com>
3Date: Tue, 7 Oct 2025 15:01:00 +0200
4Subject: [PATCH 1/2] Fail run-all on non-zero exit codes and summarise the
5 results
6
7Previously it was hard to determine whether the tests passed or not.
8With this change, run-all exiting with 0 means that no tests failed.
9
10This allows us to set up CI for our bash package in the NixOS distribution:
11https://github.com/NixOS/nixpkgs/pull/435033
12
13We hope that it will also be useful for other distributions to make sure
14their packaging is correct.
15
16Co-Authored-By: Silvan Mosberger <silvan.mosberger@tweag.io>
17Co-Authored-By: Aleksander Bantyev <alexander.bantyev@tweag.io>
18---
19 tests/run-all | 17 ++++++++++++++++-
20 1 file changed, 16 insertions(+), 1 deletion(-)
21
22diff --git tests/run-all tests/run-all
23index f9dfa604..c8f503a2 100644
24--- tests/run-all
25+++ tests/run-all
26@@ -58,13 +58,28 @@ rm -f ${BASH_TSTOUT}
27
28 echo Any output from any test, unless otherwise noted, indicates a possible anomaly
29
30+passed=0
31+total=0
32 for x in run-*
33 do
34 case $x in
35 $0|run-minimal|run-gprof) ;;
36 *.orig|*~) ;;
37- *) echo $x ; sh $x ; rm -f ${BASH_TSTOUT} ;;
38+ *)
39+ echo $x
40+ total=$(( total + 1 ))
41+ if sh $x; then
42+ passed=$(( passed + 1 ))
43+ else
44+ echo "$x EXITED NON-ZERO ($?) - possible anomaly unless otherwise noted"
45+ fi
46+ rm -f "${BASH_TSTOUT}"
47+ ;;
48 esac
49 done
50
51+echo "$passed/$total tests had exit code zero"
52+if [ "$passed" -ne "$total" ]; then
53+ exit 1
54+fi
55 exit 0
56--
572.49.0
58