Bug 1513927 - Change wpt crash handling API to be a single method, r=ted

Because mozcrash is stateful we can't check for crashes and then later
log them; we need to do everything in one shot. Therefore remove the
check_for_crashes call, rename log_crash to check_crash and make it
return a boolean indicating whether any crashes occured, as well as
handling the logging.

Differential Revision: https://phabricator.services.mozilla.com/D14437

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Graham 2018-12-13 19:16:31 +00:00
Родитель 3d5aa2ee0e
Коммит 73397da5ba
3 изменённых файлов: 14 добавлений и 32 удалений

Просмотреть файл

@ -163,15 +163,11 @@ class Browser(object):
with which it should be instantiated"""
return ExecutorBrowser, {}
def check_for_crashes(self):
"""Check for crashes that didn't cause the browser process to terminate"""
def check_crash(self, process, test):
"""Check if a crash occured and output any useful information to the
log. Returns a boolean indicating whether a crash occured."""
return False
def log_crash(self, process, test):
"""Return a list of dictionaries containing information about crashes that happend
in the browser, or an empty list if no crashes occurred"""
self.logger.crash(process, test)
class NullBrowser(Browser):
def __init__(self, logger, **kwargs):

Просмотреть файл

@ -399,23 +399,15 @@ class FirefoxBrowser(Browser):
assert self.marionette_port is not None
return ExecutorBrowser, {"marionette_port": self.marionette_port}
def check_for_crashes(self):
def check_crash(self, process, test):
dump_dir = os.path.join(self.profile.profile, "minidumps")
return bool(mozcrash.check_for_crashes(dump_dir,
symbols_path=self.symbols_path,
stackwalk_binary=self.stackwalk_binary,
quiet=True))
def log_crash(self, process, test):
dump_dir = os.path.join(self.profile.profile, "minidumps")
mozcrash.log_crashes(self.logger,
dump_dir,
symbols_path=self.symbols_path,
stackwalk_binary=self.stackwalk_binary,
process=process,
test=test)
return bool(mozcrash.log_crashes(self.logger,
dump_dir,
symbols_path=self.symbols_path,
stackwalk_binary=self.stackwalk_binary,
process=process,
test=test))
def setup_ssl(self):
"""Create a certificate database to use in the test profile. This is configured

Просмотреть файл

@ -233,11 +233,8 @@ class BrowserManager(object):
if self.init_timer is not None:
self.init_timer.cancel()
def check_for_crashes(self):
return self.browser.check_for_crashes()
def log_crash(self, test_id):
return self.browser.log_crash(process=self.browser_pid, test=test_id)
def check_crash(self, test_id):
return self.browser.check_crash(process=self.browser_pid, test=test_id)
def is_alive(self):
return self.browser.is_alive()
@ -504,8 +501,7 @@ class TestRunnerManager(threading.Thread):
def init_failed(self):
assert isinstance(self.state, RunnerManagerState.initializing)
if self.browser.check_for_crashes():
self.browser.log_crash(None)
self.browser.check_crash(None)
self.browser.after_init()
self.stop_runner(force=True)
return RunnerManagerState.initializing(self.state.test,
@ -580,7 +576,7 @@ class TestRunnerManager(threading.Thread):
expected = test.expected()
status = status_subns.get(file_result.status, file_result.status)
if self.browser.check_for_crashes():
if self.browser.check_crash(test.id):
status = "CRASH"
self.test_count += 1
@ -588,8 +584,6 @@ class TestRunnerManager(threading.Thread):
if is_unexpected:
self.unexpected_count += 1
self.logger.debug("Unexpected count in this thread %i" % self.unexpected_count)
if status == "CRASH":
self.browser.log_crash(test.id)
if "assertion_count" in file_result.extra:
assertion_count = file_result.extra.pop("assertion_count")