git/print-failed-test-output
Todd Zullinger 2e7d4595e5 Include verbose logs in build output for 'make test' failures
When building in koji or copr and a test fails, the verbose output from
the tests can be very useful in determining the cause.  Print the output
from failing tests, borrowing heavily from the upstream code¹ used when
running tests in Travis CI².

This could be done inline in %check rather than in a separate script.
The downside is that rpm would include each command invocation of the
loop in the output, which adds a lot of useless text to the already
copious build output.

¹ https://git.kernel.org/pub/scm/git/git.git/plain/ci/print-test-failures.sh
² https://travis-ci.org/git/git
2017-12-21 18:36:31 -05:00

12 lines
304 B
Bash

#!/bin/sh
# Print output from failing tests
dashes=$(printf "%80s" '' | tr ' ' '-')
for exit_file in t/test-results/*.exit; do
[ "$(cat "$exit_file")" -eq 0 ] && continue
out_file="${exit_file%exit}out"
printf '\n%s\n%s\n%s\n' "$dashes" "$out_file" "$dashes"
cat "$out_file"
done
exit 1