Bug 1052371 - Fix m-bc shutdown leak detector r=akachkach

This commit is contained in:
Tim Taubert 2014-08-12 21:23:29 +02:00
parent 47561b972d
commit c05e42221f
3 changed files with 12 additions and 6 deletions

View File

@ -819,7 +819,7 @@ class Automation(object):
xrePath = None, certPath = None,
debuggerInfo = None, symbolsPath = None,
timeout = -1, maxTime = None, onLaunch = None,
webapprtChrome = False, screenshotOnFail=False, testPath=None, bisectChunk=None):
detectShutdownLeaks = False, screenshotOnFail=False, testPath=None, bisectChunk=None):
"""
Run the app, log the duration it took to execute, return the status code.
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing for |timeout| seconds.

View File

@ -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))

View File

@ -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,