@@ -8,16 +8,33 @@ set -e
. ${0%/*}/lib-ci-type.sh
. ${0%/*}/lib-tput.sh
+exit_code=
+while test $# != 0
+do
+ case "$1" in
+ --exit-code)
+ exit_code=t
+ ;;
+ *)
+ echo "BUG: invalid $0 argument: $1" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
if ! ls t/test-results/*.exit >/dev/null 2>/dev/null
then
echo "Build job failed before the tests could have been run"
exit
fi
+failed=
for TEST_EXIT in t/test-results/*.exit
do
if [ "$(cat "$TEST_EXIT")" != "0" ]
then
+ failed=t
TEST_NAME="${TEST_EXIT%.exit}"
TEST_NAME="${TEST_NAME##*/}"
TEST_OUT="${TEST_NAME}.out"
@@ -42,3 +59,11 @@ do
esac
fi
done
+
+if test -n "$failed"
+then
+ if test -n "$exit_code"
+ then
+ exit 1
+ fi
+fi
The ci/print-test-failures.sh scripts will exit 0 when there's failed tests, let's teach it --exit-code to have it exit non-zero in those cases. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- ci/print-test-failures.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)