Skip to content

Commit

Permalink
Send bactrace to stderr and capture it in test runner
Browse files Browse the repository at this point in the history
Servo's panic hook writes backtraces to stdout. This
patch changes it so they are written to stderr.

The crash test executor for servo in WPT grouping formatter
was also not capturing the output correctly for crashtests
as the log events were being aggregated based on thread name
which doesn't seem to match correctly in case of crashtests.
This patch also fixes the log grouping logic to be based on
test name.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
  • Loading branch information
2 people authored and servo-wpt-sync committed Aug 17, 2023
1 parent 3079338 commit 0dc1f77
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tools/wptrunner/wptrunner/executors/executorservo.py
Expand Up @@ -83,6 +83,7 @@ def teardown(self):
ProcessTestExecutor.teardown(self)

def do_test(self, test):
self.test = test
self.result_data = None
self.result_flag = threading.Event()

Expand Down Expand Up @@ -156,7 +157,7 @@ def on_output(self, line):
else:
self.logger.process_output(self.proc.pid,
line,
" ".join(self.command))
" ".join(self.command), self.test.url)

def on_finish(self):
self.result_flag.set()
Expand Down Expand Up @@ -270,18 +271,19 @@ def screenshot(self, test, viewport_size, dpi, page_ranges):
return True, [base64.b64encode(data).decode()]

def do_test(self, test):
self.test = test
result = self.implementation.run_test(test)

return self.convert_result(test, result)

def on_output(self, line):
def on_output(line):
line = line.decode("utf8", "replace")
if self.interactive:
print(line)
else:
self.logger.process_output(self.proc.pid,
line,
" ".join(self.command))
" ".join(self.command), self.test.url)


class ServoTimedRunner(TimedRunner):
Expand Down Expand Up @@ -342,7 +344,7 @@ def do_crashtest(self, protocol, url, timeout):
env["HOST_FILE"] = self.hosts_path
env["RUST_BACKTRACE"] = "1"

command = build_servo_command(self.test,
self.command = build_servo_command(self.test,
self.test_url,
self.browser,
self.binary,
Expand All @@ -351,16 +353,23 @@ def do_crashtest(self, protocol, url, timeout):
extra_args=["-x"])

if not self.interactive:
self.proc = ProcessHandler(command,
self.proc = ProcessHandler(self.command,
env=env,
processOutputLine=[self.on_output],
storeOutput=False)
self.proc.run()
else:
self.proc = subprocess.Popen(command, env=env)
self.proc = subprocess.Popen(self.command, env=env)

self.proc.wait()

if self.proc.poll() >= 0:
return {"status": "PASS", "message": None}

return {"status": "CRASH", "message": None}

def on_output(self, line):
line = line.decode("utf8", "replace")
self.logger.process_output(self.proc.pid,
line,
" ".join(self.command), self.test.url)

0 comments on commit 0dc1f77

Please sign in to comment.