[PATCH v4 0/3] perf test: Per-test timeouts, JUnit XML compliance, and snippet improvements
From: Ian Rogers
Date: Mon Oct 12 2026 - 19:51:54 EST
This series adds per-test timeout support to 'perf test', improves JUnit
XML output to validate against strict JUnit schemas, and refines the
verbose=1 failure snippet output when tests fail with a signal or time
out:
1. Add a per-test timeout (default 60s, configurable via '-t'/'--timeout',
0 to disable, disabled with '-F'/'--dont-fork'). Forked tests run in
their own process groups and the existing polling loops in
finish_test() and finish_tests_parallel() check elapsed runtimes,
sending SIGTERM on timeout and escalating to SIGKILL after 1 second.
Timed out tests are reported as 'TIMEOUT!', listed in the summary,
and recorded as '<error message="TIMEOUT" type="timeout">' in JUnit
XML output.
2. Update 'perf test -j' output to validate cleanly against both the
Apache Ant/Windy Road JUnit schema (JUnit.xsd) and the Jenkins
xUnit/Maven Surefire schema (junit-10.xsd), including required
'<testsuite>' attributes, '<properties>' from uname, '<system-out/>'
and '<system-err/>', self-closing tags, apostrophe escaping, and
UTF-8/XML 1.0 codepoint validation.
3. Improve verbose=1 failure snippet selection in
print_test_failure_snippet() to skip blank and stack trace lines
when selecting context and scanning backwards from the end of the
log, and prioritize the test output line immediately preceding
'---- unexpected signal' so trailing test progress is shown instead
of outermost stack frames.
v4:
- Drop the ITIMER_REAL timer and SIGALRM handler in patch 1, relying on
the existing 10ms/100ms polling loops in finish_test() and
finish_tests_parallel() to detect timeouts.
- Only fall back to kill(pid, sig) when kill(-pid, sig) fails, and
ignore SIGTERM/SIGINT while waiting for subprocesses in
run_test_child().
- Add patch 3 to avoid stack trace noise in verbose=1 failure snippets.
v3:
- Block SIGINT/SIGTERM while a test process may be reaped and until its
pid is cleared, and skip already reaped tests in the signal path.
v2:
- Reset SIGALRM to SIG_DFL in the forked test child.
- Replace the blocking waitpid(-1) loop with a bounded, non-blocking
wait that only runs when interrupted by SIGTERM/SIGINT.
- Ensure the SIGKILL escalation reaches the whole process group before
the zombie is reaped.
- Factor out timespec_diff_secs() and TEST_KILL_GRACE_SECS.
Ian Rogers (3):
perf test: Add per-test timeout support
perf test: Improve JUnit XML schema compliance and completeness
perf test: Avoid stack trace noise in verbose=1 failure snippets
tools/perf/Documentation/perf-test.txt | 12 +-
tools/perf/tests/builtin-test.c | 668 +++++++++++++++++++------
tools/perf/tests/tests.h | 7 +-
3 files changed, 543 insertions(+), 144 deletions(-)
--
2.56.0.385.gd3acb90ef8-goog