diff --git a/build/automationutils.py b/build/automationutils.py index 98c0f3e9293a..a6b6a55ee8d8 100644 --- a/build/automationutils.py +++ b/build/automationutils.py @@ -606,6 +606,8 @@ class ShutdownLeaks(object): self._logWindow(line) elif line[2:10] == "DOCSHELL": self._logDocShell(line) + elif line.startswith("TEST-START | Shutdown"): + self.seenShutdown = True elif message['action'] == 'test_start': fileName = message['test'].replace("chrome://mochitests/content/browser/", "") self.currentTest = {"fileName": fileName, "windows": set(), "docShells": set()} @@ -614,10 +616,11 @@ class ShutdownLeaks(object): if self.currentTest and (self.currentTest["windows"] or self.currentTest["docShells"]): self.tests.append(self.currentTest) self.currentTest = None - elif message['action'] == 'suite_end': - self.seenShutdown = True def process(self): + if not self.seenShutdown: + self.logger("TEST-UNEXPECTED-FAIL | ShutdownLeaks | process() called before end of test suite") + for test in self._parseLeakingTests(): for url, count in self._zipLeakedWindows(test["leakedWindows"]): self.logger("TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown [url = %s]" % (test["fileName"], count, url)) diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 9374a5284ec0..908370bf1e83 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -1332,7 +1332,7 @@ class Mochitest(MochitestUtilsMixin): symbolsPath=None, timeout=-1, onLaunch=None, - webapprtChrome=False, + detectShutdownLeaks=False, screenshotOnFail=False, testPath=None, bisectChunk=None, @@ -1383,7 +1383,7 @@ class Mochitest(MochitestUtilsMixin): testUrl = testUrl.replace("&", "\\&") args.append(testUrl) - if mozinfo.info["debug"] and not webapprtChrome: + if detectShutdownLeaks: shutdownLeaks = ShutdownLeaks(log.info) else: shutdownLeaks = None @@ -1743,6 +1743,9 @@ class Mochitest(MochitestUtilsMixin): if options.vmwareRecording: self.startVMwareRecording(options); + # detect shutdown leaks for m-bc runs + detectShutdownLeaks = mozinfo.info["debug"] and options.browserChrome and not options.webapprtChrome + log.info("runtests.py | Running tests: start.\n") try: status = self.runApp(testURL, @@ -1755,7 +1758,7 @@ class Mochitest(MochitestUtilsMixin): symbolsPath=options.symbolsPath, timeout=timeout, onLaunch=onLaunch, - webapprtChrome=options.webapprtChrome, + detectShutdownLeaks=detectShutdownLeaks, screenshotOnFail=options.screenshotOnFail, testPath=options.testPath, bisectChunk=options.bisectChunk,