Message ID | 20230420160837.1083228-2-tytso@mit.edu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Work around various report.xml compatibility issues | expand |
On Thu, Apr 20, 2023 at 12:08:36PM -0400, Theodore Ts'o wrote: > Commit b76a6cdb40b5 ("report: derive an xml schema for the xunit > report") in fstests upstream adds an xmlns attribute to the xunit > <testcase/> tag. Unfortunately, this breaks the junitparser.py Python > package, since it uses lxml Python package, and by adding an xmlns > specifier, junitxml.py would need to know the schema and map that to > namespace tag. > > So edit it out of the xml file using sed, which relies on the fact > that fstests will add the xmlns file on a single line. The "right" > way would be to use an XSLT processor, but that would bloat the test > appliance significantly. So we'll just cheat for now while we discuss > with fstests upstream whether adding the xmlns attribute is really > worth the pain and incompatibility that it causes. > > Signed-off-by: Theodore Ts'o <tytso@mit.edu> > --- > test-appliance/files/root/runtests.sh | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/test-appliance/files/root/runtests.sh b/test-appliance/files/root/runtests.sh > index 9b32d287..c4ddb739 100755 > --- a/test-appliance/files/root/runtests.sh > +++ b/test-appliance/files/root/runtests.sh > @@ -23,6 +23,7 @@ function copy_xunit_results() > > if test -f "$RESULT" > then > + sed -i.orig -e 's/xmlns=\".*\"//' "$RESULT" FWIW I wouldn't mind commenting out the xmlns bits in common/report. Some XML parsers have this annoying quirk that as soon as anyone attaches a namespace to the document, every query against that document has to reference the given namespace explicitly. Though really, the *frustrating* thing is that in order to enable automatic validation via the schema document, one has to embed the xsi:schemaLocation attribute, which forces you to put in a namespace. Then un-namespaced queries fail, and yay XML. :? Thoughts? --D > if test -f "$RESULTS" > then > merge_xunit "$RESULTS" "$RESULT" > -- > 2.31.0 >
diff --git a/test-appliance/files/root/runtests.sh b/test-appliance/files/root/runtests.sh index 9b32d287..c4ddb739 100755 --- a/test-appliance/files/root/runtests.sh +++ b/test-appliance/files/root/runtests.sh @@ -23,6 +23,7 @@ function copy_xunit_results() if test -f "$RESULT" then + sed -i.orig -e 's/xmlns=\".*\"//' "$RESULT" if test -f "$RESULTS" then merge_xunit "$RESULTS" "$RESULT"
Commit b76a6cdb40b5 ("report: derive an xml schema for the xunit report") in fstests upstream adds an xmlns attribute to the xunit <testcase/> tag. Unfortunately, this breaks the junitparser.py Python package, since it uses lxml Python package, and by adding an xmlns specifier, junitxml.py would need to know the schema and map that to namespace tag. So edit it out of the xml file using sed, which relies on the fact that fstests will add the xmlns file on a single line. The "right" way would be to use an XSLT processor, but that would bloat the test appliance significantly. So we'll just cheat for now while we discuss with fstests upstream whether adding the xmlns attribute is really worth the pain and incompatibility that it causes. Signed-off-by: Theodore Ts'o <tytso@mit.edu> --- test-appliance/files/root/runtests.sh | 1 + 1 file changed, 1 insertion(+)