ci: a red weights run prints its failing tests' output, decoded
In weights mode a failing shard printed its last 200 JSON lines, and on 6ee4b151 the failing edge test's own output had already scrolled out of them. It now prints the output of each test that failed, and of the package (a panic or a timeout), decoded from the JSON.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+16
−3
.amadan/test-gate.sh+16 −3
CI failed — run details
diff --git a/.amadan/test-gate.sh b/.amadan/test-gate.sh| index d99e1bb93..da8fe89e9 100755 |
| --- a/.amadan/test-gate.sh |
| +++ b/.amadan/test-gate.sh |
| @@ -43,8 +43,8 @@ |
| # whatever machine ran it. Set it in .amadan/ci.d/10-gate for one push to |
| # measure on CI itself, copy the printed file in, and unset it again. It |
| # still gates (exit status and the fence are unchanged), but a passing |
| -# shard's log is not printed and a failing one shows only the last 200 |
| -# lines of its JSON. A red run prints no weights: a shard that died |
| +# shard's log is not printed and a failing one shows, decoded, the output |
| +# of the tests that failed and of the package (a panic or a timeout). A red run prints no weights: a shard that died |
| # part-way would drop the rows of the tests it never finished. |
| # |
| # The last thing the gate prints is how much CPU its jobs used against |
| @@ -278,7 +278,20 @@ for name in $names; do |
| case $shard_json:$name in |
| -json:*@*) |
| if [ "$rc" -ne 0 ]; then |
| - tail -200 "$out/$name.log" 2>/dev/null || true |
| + # Two passes over the JSON: which tests failed, then their |
| + # output lines and the package's own, unescaped enough to read. |
| + awk ' |
| + function field(name, m) { |
| + if (!match($0, "\"" name "\":\"([^\"\\\\]|\\\\.)*\"")) return "" |
| + return substr($0, RSTART + length(name) + 4, RLENGTH - length(name) - 5) |
| + } |
| + NR == FNR { if ($0 ~ /"Action":"fail"/) failed[field("Test")] = 1; next } |
| + $0 ~ /"Action":"output"/ && (field("Test") in failed) { |
| + out = field("Output") |
| + gsub(/\\n/, "\n", out); gsub(/\\t/, "\t", out); gsub(/\\"/, "\"", out) |
| + printf "%s", out |
| + } |
| + ' "$out/$name.log" "$out/$name.log" 2>/dev/null || true |
| fi |
| ;; |
| *) cat "$out/$name.log" 2>/dev/null || true ;; |