ci: a failed test's message keeps its continuation lines

The summary kept only each file:line line, so a message whose reason is on
its next lines (a holder's log tail after "its log ends:") lost it. Each
own message now keeps its last 20 continuation lines; a harness header's
dump stays out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-12-01 02:58:21 -08:00
1 parent fd86f2301f
commit d7abff2bac
2 files changed
+44 -5

No files matched your search

+17 -1
View File
@@ -89,12 +89,28 @@ def main():
if got != 1 or 'x_test.go:7: the reason' not in out:
print('FAIL a failed test''s output is shown: %s' % out)
fail = 1
# A message whose reason is on its continuation lines (a holder's log
# tail after "its log ends:"), followed by a harness dump: the message's
# last continuation lines are shown, the dump is not.
o = lambda s: json.dumps({'Action': 'output', 'Test': 'TestA', 'Output': s + '\n'})
got, out = run('TestA\n', [ev('run', 'TestA'),
o(' f1_test.go:178: blockvolume-v5r2 exited (exit status 1) before logging "adopted"; its log ends:')]
+ [o(' holder line %d' % i) for i in range(40)]
+ [o(' holder: fatal: the reason it exited')]
+ [o(' w_test.go:128: ---- master log tail ----')]
+ [o(' I1201 harness log line %d' % i) for i in range(60)] + [ev('fail', 'TestA', 1)])
if got != 1 or 'holder: fatal: the reason it exited' not in out or 'holder line 39' not in out:
print('FAIL a failed message\'s continuation lines are shown: %s' % out)
fail = 1
if 'holder line 0\n' in out or 'harness log line 0\n' in out:
print('FAIL continuation lines are bounded and a dump\'s are not kept: %s' % out)
fail = 1
got, out = run('TestA\n', ran('TestA', secs=2.25))
if got != 0 or '2.2s' not in out and '2.3s' not in out:
print('FAIL the elapsed time is reported: %s' % out)
fail = 1
if not fail:
print('required-tests-check: %d cases ok' % (len(CASES) + len(STATUS) + 2))
print('required-tests-check: %d cases ok' % (len(CASES) + len(STATUS) + 3))
return fail
+27 -4
View File
@@ -16,8 +16,9 @@ then fails, panics or hangs on its way out is not a pass. Prints one line per na
seconds, then the total.
For every named test that did not pass, its own reported lines (the test's
file:line messages, not the harness's log dumps) and its last lines follow the
table, so a run's log carries its own reasons.
file:line messages with the last lines of each one's continuation, not the
harness's log dumps) and its last lines follow the table, so a run's log
carries its own reasons.
Exit 0: every named test passed. 1: at least one did not. 2: usage or an
unreadable input.
@@ -34,6 +35,28 @@ OWN_LINE = re.compile(r'^ [^ \t]+\.go:\d+: ') # the test's own t.Log/t.Erro
NOISE = re.compile(r' log:\s*$|---- .* ----\s*$|: exit 0\s*$')
CONT = 20 # the last continuation lines shown of each own message
CONT_LINE = re.compile(r'^ ') # a message's next line, as go test indents it
def own_messages(text):
"""The test's own messages, each its file:line line and the last CONT of
the continuation lines after it (a reason, such as a process's log tail,
is often on those). A harness header's lines are not kept, nor its dump."""
msgs, cur = [], None
for line in text:
if OWN_LINE.match(line):
cur = None
if not NOISE.search(line):
cur = [line, []]
msgs.append(cur)
elif cur is not None and CONT_LINE.match(line):
cur[1].append(line)
else:
cur = None
return [[head] + cont[-CONT:] for head, cont in msgs]
def names_of(path):
names, seen = [], set()
with open(path, encoding='utf-8') as f:
@@ -139,9 +162,9 @@ def main(argv):
print('%-8s %-70s %7.1fs' % ('FAIL', name, secs) + ' ' + why)
for name in failed:
text = ''.join(output.get(name, [])).splitlines()
own = [l for l in text if OWN_LINE.match(l) and not NOISE.search(l)][-OWN:]
own = own_messages(text)[-OWN:]
print('---- %s: its own messages (%d), then its last %d lines' % (name, len(own), min(TAIL, len(text))))
for line in own + [' ...'] + text[-TAIL:]:
for line in [l for m in own for l in m] + [' ...'] + text[-TAIL:]:
print(' ' + line[:300])
if pkg_fail:
print('FAIL the test binary reported %d package-level failure(s)' % pkg_fail)