Bug 1354232 - Always try to process the leak log whenever we stop firefox, r=ato
The `stop` method is always called to shutdown firefox, but the
cleanup method is only called at the end of a test run. Therefore we
need all the leak processing stuff ot happen in stop().
MozReview-Commit-ID: 5OE54cEygNy
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -1,15 +1,14 @@
import json
import os
import platform
import signal
import subprocess
import sys
-import tempfile
import mozinfo
import mozleak
from mozprocess import ProcessHandler
from mozprofile import FirefoxProfile, Preferences
from mozrunner import FirefoxRunner
from mozrunner.utils import test_environment, get_stack_fixer_function
from mozcrash import mozcrash
@@ -224,18 +223,18 @@ class FirefoxBrowser(Browser):
"dom.send_after_paint_to_content": True,
"network.preload": True})
if self.e10s:
self.profile.set_preferences({"browser.tabs.remote.autostart": True})
if self.test_type == "reftest":
self.profile.set_preferences({"layout.interruptible-reflow.enabled": False})
- if self.leak_check and kwargs.get("check_leaks", True):
- self.leak_report_file = os.path.join(self.profile.profile, "runtests_leaks.log")
+ if self.leak_check:
+ self.leak_report_file = os.path.join(self.profile.profile, "runtests_leaks_%s.log" % os.getpid())
if os.path.exists(self.leak_report_file):
os.remove(self.leak_report_file)
env["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file
else:
self.leak_report_file = None
# Bug 1262954: winxp + e10s, disable hwaccel
if (self.e10s and platform.system() in ("Windows", "Microsoft") and
@@ -299,16 +298,17 @@ class FirefoxBrowser(Browser):
if not force or not clean:
retcode = stop_f()
if retcode is not None:
self.logger.info("Browser exited with return code %s" % retcode)
break
except OSError:
# This can happen on Windows if the process is already dead
pass
+ self.process_leaks()
self.logger.debug("stopped")
def process_leaks(self):
self.logger.debug("PROCESS LEAKS %s" % self.leak_report_file)
if self.lsan_handler:
self.lsan_handler.process()
if self.leak_report_file is not None:
mozleak.process_leak_log(
@@ -348,19 +348,18 @@ class FirefoxBrowser(Browser):
data,
command=" ".join(self.runner.command))
def is_alive(self):
if self.runner:
return self.runner.is_running()
return False
- def cleanup(self):
- self.stop()
- self.process_leaks()
+ def cleanup(self, force=False):
+ self.stop(force)
def executor_browser(self):
assert self.marionette_port is not None
return ExecutorBrowser, {"marionette_port": self.marionette_port}
def check_for_crashes(self):
dump_dir = os.path.join(self.profile.profile, "minidumps")