aboutsummaryrefslogtreecommitdiff
path: root/tests/bench/suite.py
diff options
context:
space:
mode:
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