diff --git a/bench.sh b/bench.sh index 8b9bc5c..870116e 100755 --- a/bench.sh +++ b/bench.sh @@ -683,7 +683,30 @@ function run_test_env_cmd { # "$outfile" - if test "$?" != "0"; then + local status=$? + if test "$status" != "0"; then + # the run's own output goes to $outfile, and that file does not survive + # a CI job; without this a failing test reports nothing but its name + local reason="exited with $status" + if test "$status" -gt 128; then + # above 128 usually means a signal, but a program can exit() with such a + # number too (guarder's fatal errors exit with 255), so only name a + # signal the shell actually knows, and keep the status in both cases + local sig=$((status - 128)) name + name=$(kill -l "$sig" 2>/dev/null) + case "$name" in + ''|*[!A-Za-z]*) ;; + SIG*) reason="killed by $name, status $status";; + ?*) reason="killed by SIG$name, status $status";; + esac + fi + echo "$1 $2: $reason" >&2 + if test -s "$outfile"; then + echo "$1 $2: last output" >&2 + tail -n 15 "$outfile" | sed "s/^/$1 $2 | /" >&2 + else + echo "$1 $2: wrote nothing to $(basename "$outfile")" >&2 + fi error="1" failed_runs+="$1:$2 " run_failed="1"