New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mtest: fix unencodable XML chars #11977
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tristan957
force-pushed
the
xml-fix
branch
8 times, most recently
from
July 13, 2023 01:04
415b47f
to
8c01bc7
Compare
Replace unencodable XML chars with their printable representation, so that, xmllint can parse test outputs without error. Closes mesonbuild#9894 Co-authored-by: Tristan Partin <tristan@partin.io>
dcbaker
approved these changes
Jul 13, 2023
This PR also changes the JSON and text logs ( |
@benoit-pierre let me take a look because that is most certainly not intended |
Glad to hear, tentative patch: mesonbuild/mtest.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git i/mesonbuild/mtest.py w/mesonbuild/mtest.py
index eb56c42be..8d83d17bd 100644
--- i/mesonbuild/mtest.py
+++ w/mesonbuild/mtest.py
@@ -867,10 +867,10 @@ class JunitBuilder(TestLogger):
et.SubElement(testcase, 'system-out').text = subtest.explanation
if test.stdo:
out = et.SubElement(suite, 'system-out')
- out.text = test.stdo.rstrip()
+ out.text = replace_unencodable_xml_chars(test.stdo.rstrip())
if test.stde:
err = et.SubElement(suite, 'system-err')
- err.text = test.stde.rstrip()
+ err.text = replace_unencodable_xml_chars(test.stde.rstrip())
else:
if test.project not in self.suites:
suite = self.suites[test.project] = et.Element(
@@ -893,10 +893,10 @@ class JunitBuilder(TestLogger):
suite.attrib['failures'] = str(int(suite.attrib['failures']) + 1)
if test.stdo:
out = et.SubElement(testcase, 'system-out')
- out.text = test.stdo.rstrip()
+ out.text = replace_unencodable_xml_chars(test.stdo.rstrip())
if test.stde:
err = et.SubElement(testcase, 'system-err')
- err.text = test.stde.rstrip()
+ err.text = replace_unencodable_xml_chars(test.stde.rstrip())
async def finish(self, harness: 'TestHarness') -> None:
"""Calculate total test counts and write out the xml result."""
@@ -1180,9 +1180,9 @@ def decode(stream: T.Union[None, bytes]) -> str:
if stream is None:
return ''
try:
- return replace_unencodable_xml_chars(stream.decode('utf-8'))
+ return stream.decode('utf-8')
except UnicodeDecodeError:
- return replace_unencodable_xml_chars(stream.decode('iso-8859-1', errors='ignore'))
+ return stream.decode('iso-8859-1', errors='ignore')
async def read_decode(reader: asyncio.StreamReader,
queue: T.Optional['asyncio.Queue[T.Optional[str]]'], |
tristan957
added a commit
to tristan957/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
tristan957
added a commit
to tristan957/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
tristan957
added a commit
to tristan957/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
tristan957
added a commit
to tristan957/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
benoit-pierre
added a commit
to benoit-pierre/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
benoit-pierre
added a commit
to benoit-pierre/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
tristan957
added a commit
to tristan957/meson
that referenced
this pull request
Aug 14, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
xclaesse
pushed a commit
that referenced
this pull request
Aug 17, 2023
This was an unintended consequence of the original patch in #11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
benoit-pierre
added a commit
to benoit-pierre/meson
that referenced
this pull request
Aug 21, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
bruchar1
pushed a commit
to bruchar1/meson
that referenced
this pull request
Aug 25, 2023
This was an unintended consequence of the original patch in mesonbuild#11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
nirbheek
pushed a commit
that referenced
this pull request
Sep 27, 2023
This was an unintended consequence of the original patch in #11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace unencodable XML chars with their printable representation, so that, xmllint can parse test outputs without error.
Closes #9894
Closes #10680