If 'make test' fails before running any tests, the debug output from print-failed-test-output is confusing: + ./print-failed-test-output cat: t/test-results/*.exit: No such file or directory ./print-failed-test-output: line 6: [: : integer expression expected -------------------------------------------------------------------------------- t/test-results/*.out -------------------------------------------------------------------------------- cat: t/test-results/*.out: No such file or directory Use the bash failglob option to imrpve the output: + ./print-failed-test-output ./print-failed-test-output: line 12: no match: t/test-results/*.exit
14 lines
325 B
Bash
14 lines
325 B
Bash
#!/bin/bash
|
|
|
|
shopt -s failglob
|
|
|
|
# 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
|