[PATCH v4 13/13] perf tests: Include error output for skipped tests in JUnit XML

From: Ian Rogers

Date: Mon Jun 22 2026 - 21:29:07 EST


The JUnit XML output correctly captures the stderr/stdout output of failed
tests inside the <failure> element. However, for skipped tests, the output
was completely discarded and the XML only received a self-closing <skipped
message="reason"/> tag.

This expands the <skipped> element to include the test's err_output when
available, which is extremely helpful for debugging why a test was skipped
(e.g. diagnosing missing prerequisites or unexpected environment states
that triggered the skip) directly from CI systems parsing the XML report.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/tests/builtin-test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 8b8f63f706d9..d115a19e5f0f 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -536,8 +536,14 @@ static int print_test_result(struct test_suite *t, int curr_suite, int curr_test
const char *reason = skip_reason(t, curr_test_case);
char *escaped_reason = xml_escape(reason ? reason : "Skip");

- strbuf_addf(&junit_xml_buf, " <skipped message=\"%s\"/>\n",
- escaped_reason);
+ if (err_output && *err_output) {
+ strbuf_addf(&junit_xml_buf,
+ " <skipped message=\"%s\">\n%s\n </skipped>\n",
+ escaped_reason, escaped_err);
+ } else {
+ strbuf_addf(&junit_xml_buf, " <skipped message=\"%s\"/>\n",
+ escaped_reason);
+ }
free(escaped_reason);
}
strbuf_addstr(&junit_xml_buf, " </testcase>\n");
--
2.55.0.rc0.786.g65d90a0328-goog