Skip to content

Commit b7e3d84

Browse files
jgrahammoz-wptsync-bot
authored andcommitted
Default to updating test status if there's a crash dump
Add a pair of new command line arguments `--[no-]update-status-on-crash` which control whether to override the status when a crash dump file is found. Previously we only did this for specific test types due to some race conditions, but since it's surprising to have a detected crash but not get the corresponding test status, we want to try defaulting to it being enabled, but allow it to be disabled for specific CI configurations where it causes problems. Differential Revision: https://phabricator.services.mozilla.com/D258058 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1978363 gecko-commit: ce9a9f0eaa2acd247b818ccaab9c620feb074f39 gecko-reviewers: ErichDonGubler, Sasha
1 parent afc90e1 commit b7e3d84

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

tools/wptrunner/wptrunner/testrunner.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def __init__(self, suite_name, index, test_queue,
343343
pause_after_test=False, pause_on_unexpected=False,
344344
restart_on_unexpected=True, debug_info=None,
345345
capture_stdio=True, restart_on_new_group=True, recording=None,
346-
max_restarts=5, max_restart_backoff=0):
346+
max_restarts=5, max_restart_backoff=0, update_status_on_crash=True):
347347
"""Thread that owns a single TestRunner process and any processes required
348348
by the TestRunner (e.g. the Firefox binary).
349349
@@ -381,6 +381,7 @@ def __init__(self, suite_name, index, test_queue,
381381
self.restart_on_new_group = restart_on_new_group
382382
self.max_restarts = max_restarts
383383
self.max_restart_backoff = max_restart_backoff
384+
self.update_status_on_crash = update_status_on_crash
384385

385386
assert recording is not None
386387
self.recording = recording
@@ -797,11 +798,11 @@ def test_ended(self, test, results):
797798
status = file_result.status
798799

799800
if self.browser.check_crash(test.id) and status != "CRASH":
800-
if test.test_type in ["crashtest", "wdspec"] or status == "EXTERNAL-TIMEOUT":
801+
if self.update_status_on_crash:
801802
self.logger.info("Found a crash dump file; changing status to CRASH")
802803
status = "CRASH"
803804
else:
804-
self.logger.warning(f"Found a crash dump; should change status from {status} to CRASH but this causes instability")
805+
self.logger.warning(f"Found a crash dump; but keeping status {status}")
805806

806807
# We have a couple of status codes that are used internally, but not exposed to the
807808
# user. These are used to indicate that some possibly-broken state was reached
@@ -1047,7 +1048,8 @@ def __init__(self, suite_name, test_queue_builder, test_implementations,
10471048
restart_on_new_group=True,
10481049
recording=None,
10491050
max_restarts=5,
1050-
max_restart_backoff=0):
1051+
max_restart_backoff=0,
1052+
update_status_on_crash=False):
10511053
self.suite_name = suite_name
10521054
self.test_queue_builder = test_queue_builder
10531055
self.test_implementations = test_implementations
@@ -1063,6 +1065,7 @@ def __init__(self, suite_name, test_queue_builder, test_implementations,
10631065
assert recording is not None
10641066
self.max_restarts = max_restarts
10651067
self.max_restart_backoff = max_restart_backoff
1068+
self.update_status_on_crash = update_status_on_crash
10661069

10671070
self.pool = set()
10681071
self.stop_flag = None
@@ -1096,7 +1099,8 @@ def run(self, tests):
10961099
self.restart_on_new_group,
10971100
recording=self.recording,
10981101
max_restarts=self.max_restarts,
1099-
max_restart_backoff=self.max_restart_backoff)
1102+
max_restart_backoff=self.max_restart_backoff,
1103+
update_status_on_crash=self.update_status_on_crash)
11001104
manager.start()
11011105
self.pool.add(manager)
11021106
self.wait()

tools/wptrunner/wptrunner/wptcommandline.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ def create_parser(product_choices=None):
276276
config_group.add_argument("--no-suppress-handler-traceback", action="store_false",
277277
dest="supress_handler_traceback",
278278
help="Write the stacktrace for exceptions in server handlers")
279+
config_group.add_argument("--update-status-on-crash", action="store_true", default=None,
280+
help="Update test status to CRASH if a crash dump is found")
281+
config_group.add_argument("--no-update-status-on-crash", dest="update_status_on_crash",
282+
action="store_false",
283+
help="Don't update test status to CRASH if a crash dump is found")
279284
config_group.add_argument("--ws-extra", action="append",
280285
help="Extra paths containing websockets handlers")
281286

@@ -636,6 +641,9 @@ def check_args(kwargs):
636641
print("Binary path %s does not exist" % kwargs["binary"], file=sys.stderr)
637642
sys.exit(1)
638643

644+
if kwargs["update_status_on_crash"] is None:
645+
kwargs["update_status_on_crash"] = True
646+
639647
if kwargs["ssl_type"] is None:
640648
if None not in (kwargs["ca_cert_path"], kwargs["host_cert_path"], kwargs["host_key_path"]):
641649
kwargs["ssl_type"] = "pregenerated"

tools/wptrunner/wptrunner/wptrunner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def run_test_iteration(test_status, test_loader, test_queue_builder,
333333
recording=recording,
334334
max_restarts=kwargs["max_restarts"],
335335
max_restart_backoff=kwargs["max_restart_backoff"],
336+
update_status_on_crash=kwargs["update_status_on_crash"]
336337
) as manager_group:
337338
try:
338339
handle_interrupt_signals()

0 commit comments

Comments
 (0)