From a4e1db4c78a4750c8d798bb011ca72f0e3f2dfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 31 Oct 2026 09:26:37 +0100 Subject: [PATCH] adhoc_multi.py: On CI, show a failing instance's warnings and errors Pair tests that fail only on a CI runner give nothing to go on but the output diff. The instance sync's and the relay's warnings say where an instance stalled. Co-Authored-By: Claude Opus 5.5 --- Tools/adhoc_multi.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Tools/adhoc_multi.py b/Tools/adhoc_multi.py index b8bdbcc283..835a6c5067 100644 --- a/Tools/adhoc_multi.py +++ b/Tools/adhoc_multi.py @@ -22,6 +22,7 @@ import argparse import os import random +import re import socket import subprocess import sys @@ -124,6 +125,9 @@ def run_test(headless, test, extra, relay_ini, sync): cmd.append("--appendconfig=" + relay_ini) if i == 0: cmd.append("--adhoc-server") + if os.environ.get("CI"): + # Warnings and errors, shown if the test fails: CI runners are the hard place to reproduce one. + cmd += ["--log", "--loglevel=3"] cmd += extra cmd.append(os.path.join(TESTS_DIR, "%s_%s.prx" % (test, role))) # To a file rather than a pipe: an instance that fills its pipe while we wait on another would stop, @@ -148,7 +152,12 @@ def run_test(headless, test, extra, relay_ini, sync): passed = passed and ok print("%s %s_%s [%s]" % ("PASS" if ok else "FAIL", test, role, mode)) if not ok: - sys.stdout.write(out.decode("utf-8", "replace")) + text = out.decode("utf-8", "replace") + log = [l for l in text.splitlines() if re.search(r"\b[WE]\[", l)] + sys.stdout.write("\n".join(l for l in text.splitlines() if l not in log) + "\n") + if log: + print(" Log (warnings and errors, last %d of %d):" % (min(80, len(log)), len(log))) + sys.stdout.write("".join(" " + l + "\n" for l in log[-80:])) if sync_file: os.remove(sync_file) return passed