aboutsummaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2023-08-14 09:03:42 -0500
committerXavier Claessens <xclaesse@gmail.com>2023-08-17 17:31:30 -0400
commit543e9ca0cf0c00d752bd723ec403e91b839bf9b4 (patch)
tree6aa548a9a08e537b0709b38f5f8ac45ad3753d4c /unittests/allplatformstests.py
parentf52bcaa27fc125ab9ae583af466ba99c164169f3 (diff)
downloadmeson-543e9ca0cf0c00d752bd723ec403e91b839bf9b4.zip
meson-543e9ca0cf0c00d752bd723ec403e91b839bf9b4.tar.gz
meson-543e9ca0cf0c00d752bd723ec403e91b839bf9b4.tar.bz2
Remove XML filter from testlog.{json,txt} and std streams
This was an unintended consequence of the original patch in #11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index f7fb1b0..819cc2e 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -463,9 +463,8 @@ class AllPlatformTests(BasePlatformTests):
valid_string = base_string_valid + repr(invalid_string)[1:-1] + base_string_valid
invalid_string = base_string_invalid + invalid_string + base_string_invalid
- broken_xml_stream = invalid_string.encode()
- decoded_broken_stream = mtest.decode(broken_xml_stream)
- self.assertEqual(decoded_broken_stream, valid_string)
+ fixed_string = mtest.replace_unencodable_xml_chars(invalid_string)
+ self.assertEqual(fixed_string, valid_string)
def test_replace_unencodable_xml_chars_unit(self):
'''
@@ -477,9 +476,16 @@ class AllPlatformTests(BasePlatformTests):
raise SkipTest('xmllint not installed')
testdir = os.path.join(self.unit_test_dir, '110 replace unencodable xml chars')
self.init(testdir)
- self.run_tests()
+ tests_command_output = self.run_tests()
junit_xml_logs = Path(self.logdir, 'testlog.junit.xml')
subprocess.run(['xmllint', junit_xml_logs], check=True)
+ # Ensure command output and JSON / text logs are not mangled.
+ raw_output_sample = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b'
+ assert raw_output_sample in tests_command_output
+ text_log = Path(self.logdir, 'testlog.txt').read_text()
+ assert raw_output_sample in text_log
+ json_log = json.loads(Path(self.logdir, 'testlog.json').read_bytes())
+ assert raw_output_sample in json_log['stdout']
def test_run_target_files_path(self):
'''