aboutsummaryrefslogtreecommitdiff
path: root/tests/bench/suite.py
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 21:33:50 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 21:33:50 +0330
commite67671d834f33e1a70f913f0c61f9d0c36292aa8 (patch)
tree5937e57622c9cb0a406bbc727c140b9778105cc5 /tests/bench/suite.py
parentbench: matmul fill a = i % 7 - 2, b = i % 5 - 1 so its checksum is 63760 (che... (diff)
bench: a trap (zy exit 2) is labelled runtime trap with the stdout tail, since zy reports traps on stdout, in suite.py and bench.sh
Diffstat (limited to 'tests/bench/suite.py')
-rw-r--r--tests/bench/suite.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/bench/suite.py b/tests/bench/suite.py
index 83677f5..4870038 100644
--- a/tests/bench/suite.py
+++ b/tests/bench/suite.py
@@ -97,11 +97,13 @@ def bench_sh():
def zy_failure(what, code, out, err, expect=None):
"""None when a zy run is good, else the message: a nonzero exit (1 is a compile error,
- a trap will be 2) or output other than the expected checksum"""
+ 2 is a runtime trap) or output other than the expected checksum"""
tail = lambda b: "\n".join(b.decode(errors="replace").rstrip().splitlines()[-8:]) or "(empty)"
if code != 0:
kind = {1: "compile error", 2: "runtime trap"}.get(code, "failed")
- return "bench: %s: zy exited %d (%s); stderr tail:\n%s" % (what, code, kind, tail(err))
+ # zy reports a trap on stdout, so the tail is of stdout when stderr is empty
+ which, text = ("stderr", err) if err.strip() else ("stdout", out)
+ return "bench: %s: zy exited %d (%s); %s tail:\n%s" % (what, code, kind, which, tail(text))
if expect is not None and out.decode(errors="replace").strip() != expect:
return "bench: %s: printed %r, expected %r; stderr tail:\n%s" % (what, out.decode(errors="replace").strip()[-200:], expect, tail(err))
return None