Previously it was hard to determine whether the tests passed or not. With this change, run-all exiting with 0 means that no tests failed.
This allows us to set up CI for our bash package in the NixOS distribution: https://github.com/NixOS/nixpkgs/pull/435033 We hope that it will also be useful for other distributions to make sure their packaging is correct. Co-Authored-By: Silvan Mosberger <[email protected]> Co-Authored-By: Aleksander Bantyev <[email protected]> --- tests/run-all | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/run-all b/tests/run-all index f9dfa604..c8f503a2 100644 --- a/tests/run-all +++ b/tests/run-all @@ -58,13 +58,28 @@ rm -f ${BASH_TSTOUT} echo Any output from any test, unless otherwise noted, indicates a possible anomaly +passed=0 +total=0 for x in run-* do case $x in $0|run-minimal|run-gprof) ;; *.orig|*~) ;; - *) echo $x ; sh $x ; rm -f ${BASH_TSTOUT} ;; + *) + echo $x + total=$(( total + 1 )) + if sh $x; then + passed=$(( passed + 1 )) + else + echo "$x EXITED NON-ZERO ($?) - possible anomaly unless otherwise noted" + fi + rm -f "${BASH_TSTOUT}" + ;; esac done +echo "$passed/$total tests had exit code zero" +if [ "$passed" -ne "$total" ]; then + exit 1 +fi exit 0 -- 2.49.0
