diff mbox series

[2/2] report: remove xmlns specifier

Message ID 20230706204232.1577765-2-tytso@mit.edu (mailing list archive)
State New, archived
Headers show
Series [1/2] report: safely update the result.xml file | expand

Commit Message

Theodore Ts'o July 6, 2023, 8:42 p.m. UTC
By specifying "xmlns=https://git.kernel.org/.../xfstests-dev.git",
this causes XML complaint parsers, such as used by the python
junitparser library, to put all of the XML elements into a namespace,
which then causes junitparser to toss its cookies.

This can be worked-around in a test runner script via:

    sed -i.orig -e 's/xmlns=\".*\"//' "$RESULT_BASE/result.xml"

but it's better not to include the xmlns line at all in the first
place, since this may cause other users of fstests who are using
the Python junitparser library a lot of headaches.

Cc: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 common/report | 1 -
 1 file changed, 1 deletion(-)

Comments

Darrick J. Wong July 7, 2023, 2:55 p.m. UTC | #1
On Thu, Jul 06, 2023 at 04:42:32PM -0400, Theodore Ts'o wrote:
> By specifying "xmlns=https://git.kernel.org/.../xfstests-dev.git",
> this causes XML complaint parsers, such as used by the python
> junitparser library, to put all of the XML elements into a namespace,
> which then causes junitparser to toss its cookies.
> 
> This can be worked-around in a test runner script via:
> 
>     sed -i.orig -e 's/xmlns=\".*\"//' "$RESULT_BASE/result.xml"
> 
> but it's better not to include the xmlns line at all in the first
> place, since this may cause other users of fstests who are using
> the Python junitparser library a lot of headaches.
> 
> Cc: "Darrick J. Wong" <djwong@kernel.org>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Yeah, I guess.  Note to self: xmlns needs to be in the file format from
the start, or adding it will break parsers. :(

Sooo much engineering and yet it's easy to stop up the drain.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  common/report | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/common/report b/common/report
> index 3ad14f94e..081df988f 100644
> --- a/common/report
> +++ b/common/report
> @@ -127,7 +127,6 @@ _xunit_make_section_report()
>  	local fstests_ns="https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git"
>  	cat >> "$tmp_fn" << ENDL
>  <testsuite
> - xmlns="$fstests_ns"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="$fstests_ns $fstests_ns/tree/doc/xunit.xsd"
>  
> -- 
> 2.31.0
>
diff mbox series

Patch

diff --git a/common/report b/common/report
index 3ad14f94e..081df988f 100644
--- a/common/report
+++ b/common/report
@@ -127,7 +127,6 @@  _xunit_make_section_report()
 	local fstests_ns="https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git"
 	cat >> "$tmp_fn" << ENDL
 <testsuite
- xmlns="$fstests_ns"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="$fstests_ns $fstests_ns/tree/doc/xunit.xsd"