Skip to content

Commit 8d9b9ae

Browse files
committed
Bug 2042834 - Mark unexpected process crashes during mochitest as test failures, r=ahal.
Bug 1631828 inadvertently broadened the synthetic test_end emitted on process crash so that expected="CRASH" was set unconditionally, marking every crash as expected. Restrict that to the crashAsPass path so any other crash takes the elif branch (expected="PASS", status=1) and registers as an unexpected failure. Differential Revision: https://phabricator.services.mozilla.com/D302810
1 parent d3b7bda commit 8d9b9ae

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

testing/mochitest/runtests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,13 +3138,12 @@ def timeoutHandler():
31383138
)
31393139

31403140
expected = None
3141-
if crashAsPass or crash_count > 0:
3141+
if crashAsPass:
31423142
# self.message_logger.is_test_running indicates we need a test_end message
31433143
if self.message_logger.is_test_running:
31443144
# this works for browser-chrome, mochitest-plain has status=0
31453145
expected = "CRASH"
3146-
if crashAsPass:
3147-
status = 0
3146+
status = 0
31483147
elif crash_count or zombieProcesses:
31493148
if self.message_logger.is_test_running:
31503149
expected = "PASS"

testing/mochitest/tests/python/test_mochitest_integration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
from functools import partial
77

8+
import mozinfo
89
import mozunit
910
import pytest
1011
from conftest import setup_args
@@ -214,6 +215,18 @@ def test_output_crash(flavor, runFailures, runtests, test_name):
214215
if flavor == "browser-chrome":
215216
results["tbpl_status"] = TBPL_SUCCESS
216217
results["log_level"] = (INFO, WARNING)
218+
elif flavor == "browser-chrome" and not mozinfo.info["debug"]:
219+
# A browser-chrome crash isn't matched by mozharness's error regexes
220+
# (see the MOZ_CRASHREPORTER_SHUTDOWN note above), so it only registers
221+
# as the unexpected CRASH status, which is scored as a warning rather
222+
# than a failure.
223+
#
224+
# This does not apply to debug builds: there the crash also trips the
225+
# leak-detection checks (ShutdownLeaks and the DOCSHELL/DOMWINDOW
226+
# logging), which emit TEST-UNEXPECTED-FAIL error lines and make the run
227+
# a failure, as expected by the default above.
228+
results["tbpl_status"] = TBPL_WARNING
229+
results["log_level"] = WARNING
217230

218231
status, lines = runtests(
219232
test_name("crash"), environment=["MOZ_CRASHREPORTER_SHUTDOWN=1"], **extra_opts

0 commit comments

Comments
 (0)