From 97ce865f40b67cb255bfdae24a230c607087c5bd Mon Sep 17 00:00:00 2001 From: Stephan Bauroth Date: Thu, 12 Nov 2026 12:11:27 +0100 Subject: [PATCH] bench.sh: say why a test failed A run's own output goes to --out.txt and that file does not reach a CI log, so a test that dies says nothing beyond its name: in the failing rocksdb jobs the log shows the run starting and the next test starting 0.1 s later, with no error text anywhere. Report the exit status - naming the signal when the run was killed by one - and the tail of the output file, on stderr so buildkit records it. Name a signal only when the shell knows that number, and always keep the status: a program can exit() above 128 as well, and guarder's fatal errors do (exit 255), which an unconditional 128 offset would report as a nonexistent "signal 127". --- bench.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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"