mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
677c70799c
When a build job running the test suite fails, our 'ci/print-test-failures.sh' script scans all 't/test-results/*.exit' files to find failed tests and prints their verbose output. However, if a build job were to fail before it ever gets to run the test suite, then there will be no files to match the above pattern and the shell will take the pattern literally, resulting in errors like this in the trace log: cat: t/test-results/*.exit: No such file or directory ------------------------------------------------------------------------ t/test-results/*.out... ------------------------------------------------------------------------ cat: t/test-results/*.out: No such file or directory Check upfront and proceed only if there are any such files present. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Reviewed-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
27 lines
651 B
Bash
Executable file
27 lines
651 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Print output of failing tests
|
|
#
|
|
|
|
. ${0%/*}/lib-travisci.sh
|
|
|
|
# Tracing executed commands would produce too much noise in the loop below.
|
|
set +x
|
|
|
|
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
|
|
|
|
for TEST_EXIT in t/test-results/*.exit
|
|
do
|
|
if [ "$(cat "$TEST_EXIT")" != "0" ]
|
|
then
|
|
TEST_OUT="${TEST_EXIT%exit}out"
|
|
echo "------------------------------------------------------------------------"
|
|
echo "$(tput setaf 1)${TEST_OUT}...$(tput sgr0)"
|
|
echo "------------------------------------------------------------------------"
|
|
cat "${TEST_OUT}"
|
|
fi
|
|
done
|