Retain Go diagnostics when the test process fails

This commit is contained in:
Hassan Raza 2026-09-26 22:09:03 +05:00
parent 6732123dfb
commit c137a577d8
No known key found for this signature in database

View file

@ -478,6 +478,7 @@ def collect_worker_results(
go_failures: list[tuple[str, str]] = []
go_test_output: dict[str, list[str]] = {}
go_pkg_output: dict[str, list[str]] = {}
go_other_output: list[str] = []
# (elapsed_seconds, label) for every completed test in both suites
all_timings: list[tuple[float, str]] = []
@ -521,6 +522,8 @@ def collect_worker_results(
except OSError:
chunk = b''
if not chunk:
if go_buffer:
go_other_output.append(go_buffer.decode('utf-8', errors='replace'))
go_active = False
go_proc.finish()
show_progress(force=True)
@ -533,6 +536,7 @@ def collect_worker_results(
try:
evt: dict[str, Any] = json.loads(raw)
except json.JSONDecodeError:
go_other_output.append(raw.decode('utf-8', errors='replace') + '\n')
continue
action = evt.get('Action', '')
test_name = evt.get('Test', '')
@ -655,6 +659,13 @@ def collect_worker_results(
if go_output:
print(go_output, end='' if go_output.endswith('\n') else '\n')
if go_proc is not None and go_proc.returncode != 0 and go_other_output:
print(sep1)
print(c(_RED + _BOLD, 'GO ERROR'))
print(sep2)
output = ''.join(go_other_output)
print(output, end='' if output.endswith('\n') else '\n')
if py_unexpected_successes:
print(sep1)
print('Unexpected successes:')