Re: [PATCH v3 2/2] kunit: tool: Add (primitive) support for outputting JUnit XML

Thomas Weißschuh <[email protected]> Fri, 5 Jun 2026 09:11:14 +0200
Newsgroups org.kernel.vger.workflows,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <20260605085852-83bb51b3-0f8a-412c-84e2-ff0488998e4d@linutronix.de>
On Thu, Jun 04, 2026 at 08:32:05PM +0800, David Gow wrote:
> This is used by things like Jenkins and other CI systems, which can
> pretty-print the test output and potentially provide test-level comparisons
> between runs.
> 
> The implementation here is pretty basic: it only provides the raw results,
> split into tests and test suites, and doesn't provide any overall metadata.
> However, CI systems like Jenkins can ingest it and it is already useful.
> 
> Signed-off-by: David Gow <[email protected]>

Reviewed-by: Thomas Weißschuh <[email protected]>

> ---
> Here's version 3 of the JUnit support patch. This one uses python's ElementTree
> API to generate the XML, rather than writing strings directly. The only real
> difference in the output is that this escapes any log lines, rather than using
> CDATA sections. (There are both advantages and disadvantages to this, but
> they're all pretty minor. Equally, the option of using the
> xml.sax.saxutils.XMLGenerator API instead is a possibility. ElementTree ended
> up being slightly more aligned with the way the JSON version worked.)

I still somewhat prefer an event-based formatting.
(There is also xml.etree.ElementTree.TreeBuilder)
But if the JSON formatter works the same, its fine for me.

(...)