mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
wpt: Ensure that faulty JSON testharness output does not crash the Python test harness (#38420)
When a testharness test also prints debugging output, sometimes the output can be mixed with the JSON output printed via an alert. This causes a JSON decoding error in the output. Instead of crashing the harness and printing many lines of Python stack trace output, print a nice error. This makes the test output easier to read. Testing: This is a change to the test harness itself, so no tests necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
58425f6ae2
commit
181f97879d
2 changed files with 5 additions and 2 deletions
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -521535,7 +521535,7 @@
|
||||||
[]
|
[]
|
||||||
],
|
],
|
||||||
"executorservo.py": [
|
"executorservo.py": [
|
||||||
"7b0a64a60489f91fe2d2ec92c69118c0b5b1b8c0",
|
"d983cf048ed6dfe1c07fdcac4f3465f116a00c58",
|
||||||
[]
|
[]
|
||||||
],
|
],
|
||||||
"executorservodriver.py": [
|
"executorservodriver.py": [
|
||||||
|
|
|
@ -173,7 +173,10 @@ class ServoTestharnessExecutor(ServoExecutor):
|
||||||
prefix = "ALERT: RESULT: "
|
prefix = "ALERT: RESULT: "
|
||||||
decoded_line = line.decode("utf8", "replace")
|
decoded_line = line.decode("utf8", "replace")
|
||||||
if decoded_line.startswith(prefix):
|
if decoded_line.startswith(prefix):
|
||||||
self.result_data = json.loads(decoded_line[len(prefix):])
|
try:
|
||||||
|
self.result_data = json.loads(decoded_line[len(prefix):])
|
||||||
|
except json.JSONDecodeError as error:
|
||||||
|
self.logger.error(f"Could not process test output JSON: {error}")
|
||||||
self.result_flag.set()
|
self.result_flag.set()
|
||||||
else:
|
else:
|
||||||
ServoExecutor.on_output(self, line)
|
ServoExecutor.on_output(self, line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue