From 580ec6c92de76ba103ad6e9b1d23ec98905f113c Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Tue, 15 Mar 2022 19:40:49 +0000 Subject: [PATCH] Bug 1758984 - add status to mozlog crash so group summary is not marked as OK. r=gbrown Differential Revision: https://phabricator.services.mozilla.com/D141102 --- testing/mochitest/runtests.py | 35 +++++++++++++--------- .../tests/python/test_mochitest_integration.py | 2 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index e8e58d7ff908..4e027ba0d3bb 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -2654,27 +2654,34 @@ toolbar#nav-bar { quiet=quiet, ) + expected = None if crashAsPass: # self.message_logger.is_test_running indicates we need a test_end message if crash_count > 0 and self.message_logger.is_test_running: # this works for browser-chrome, mochitest-plain has status=0 - message = { - "action": "test_end", - "status": "CRASH", - "expected": "CRASH", - "thread": None, - "pid": None, - "source": "mochitest", - "time": int(time.time()) * 1000, - "test": self.lastTestSeen, - "message": "application terminated with exit code 0", - } - # need to send a test_end in order to have mozharness process messages properly - # this requires a custom message vs log.error/log.warning/etc. - self.message_logger.process_message(message) + expected = "CRASH" status = 0 elif crash_count or zombieProcesses: + if self.message_logger.is_test_running: + expected = "PASS" status = 1 + + if expected: + # send this out so we always wrap up the test-end message + message = { + "action": "test_end", + "status": "CRASH", + "expected": expected, + "thread": None, + "pid": None, + "source": "mochitest", + "time": int(time.time()) * 1000, + "test": self.lastTestSeen, + "message": "application terminated with exit code 0", + } + # need to send a test_end in order to have mozharness process messages properly + # this requires a custom message vs log.error/log.warning/etc. + self.message_logger.process_message(message) finally: # cleanup if os.path.exists(processLog): diff --git a/testing/mochitest/tests/python/test_mochitest_integration.py b/testing/mochitest/tests/python/test_mochitest_integration.py index d9c1fc216466..71ee8cdac4f2 100644 --- a/testing/mochitest/tests/python/test_mochitest_integration.py +++ b/testing/mochitest/tests/python/test_mochitest_integration.py @@ -116,7 +116,7 @@ def test_output_crash(flavor, runFailures, runtests, test_name): "status": 0 if runFailures else 1, "tbpl_status": TBPL_FAILURE, "log_level": ERROR, - "lines": 1 if runFailures else 0, + "lines": 1, } if runFailures: extra_opts["runFailures"] = runFailures -- 2.11.4.GIT