def get_environ(logger, binary, debug_info, stylo_threads, headless, enable_webrender, chaos_mode_flags=None): env = test_environment(xrePath=os.path.abspath(os.path.dirname(binary)), debugger=debug_info is not None, useLSan=True, log=logger) env["STYLO_THREADS"] = str(stylo_threads) # Disable window occlusion. Bug 1733955 env["MOZ_WINDOW_OCCLUSION"] = "0" if chaos_mode_flags is not None: env["MOZ_CHAOSMODE"] = str(chaos_mode_flags) if headless: env["MOZ_HEADLESS"] = "1" if enable_webrender: env["MOZ_WEBRENDER"] = "1" env["MOZ_ACCELERATED"] = "1" else: env["MOZ_WEBRENDER"] = "0" return env
def start(self): """Start an instance of Firefox, returning a BrowserInstance handle""" profile = self.base_profile.clone(self.base_profile.profile) marionette_port = get_free_port() profile.set_preferences({"marionette.port": marionette_port}) env = test_environment(xrePath=os.path.dirname(self.binary), debugger=self.debug_info is not None, useLSan=True, log=self.logger) env["STYLO_THREADS"] = str(self.stylo_threads) if self.chaos_mode_flags is not None: env["MOZ_CHAOSMODE"] = str(self.chaos_mode_flags) if self.headless: env["MOZ_HEADLESS"] = "1" if self.enable_webrender: env["MOZ_WEBRENDER"] = "1" env["MOZ_ACCELERATED"] = "1" # Set MOZ_X_SYNC and GDK_SYNCHRONIZE for investigation; bug 1625250. env["MOZ_X_SYNC"] = "1" env["GDK_SYNCHRONIZE"] = "1" else: env["MOZ_WEBRENDER"] = "0" args = self.binary_args[:] if self.binary_args else [] args += [cmd_arg("marionette"), "about:blank"] debug_args, cmd = browser_command(self.binary, args, self.debug_info) if self.leak_check: leak_report_file = os.path.join( profile.profile, "runtests_leaks_%s.log" % os.getpid()) if os.path.exists(leak_report_file): os.remove(leak_report_file) env["XPCOM_MEM_BLOAT_LOG"] = leak_report_file else: leak_report_file = None output_handler = OutputHandler(self.logger, self.stackfix_dir, self.symbols_path, self.asan) runner = FirefoxRunner( profile=profile, binary=cmd[0], cmdargs=cmd[1:], env=cast_env(env), process_class=ProcessHandler, process_args={"processOutputLine": [output_handler]}) instance = BrowserInstance(self.logger, runner, marionette_port, output_handler, leak_report_file) self.logger.debug("Starting Firefox") runner.start(debug_args=debug_args, interactive=self.debug_info and self.debug_info.interactive) self.logger.debug("Firefox Started") return instance
def environment(self, **kwargs): kwargs['log'] = self.log return test_environment(**kwargs)
def start(self, group_metadata=None, **kwargs): if group_metadata is None: group_metadata = {} if self.marionette_port is None: self.marionette_port = get_free_port(2828, exclude=self.used_ports) self.used_ports.add(self.marionette_port) if self.asan: print "Setting up LSAN" self.lsan_handler = mozleak.LSANLeaks( self.logger, scope=group_metadata.get("scope", "/"), allowed=self.lsan_allowed, maxNumRecordedFrames=self.lsan_max_stack_depth) env = test_environment(xrePath=os.path.dirname(self.binary), debugger=self.debug_info is not None, log=self.logger, lsanPath=self.prefs_root) env["STYLO_THREADS"] = str(self.stylo_threads) if self.chaos_mode_flags is not None: env["MOZ_CHAOSMODE"] = str(self.chaos_mode_flags) if self.headless: env["MOZ_HEADLESS"] = "1" preferences = self.load_prefs() self.profile = FirefoxProfile(preferences=preferences) self.profile.set_preferences({ "marionette.port": self.marionette_port, "network.dns.localDomains": ",".join(self.config.domains_set), "dom.file.createInChild": True, # TODO: Remove preferences once Firefox 64 is stable (Bug 905404) "network.proxy.type": 0, "places.history.enabled": False, "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: 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 '5.1' in platform.version()): self.profile.set_preferences( {"layers.acceleration.disabled": True}) if self.ca_certificate_path is not None: self.setup_ssl() args = self.binary_args[:] if self.binary_args else [] args += [cmd_arg("marionette"), "about:blank"] debug_args, cmd = browser_command(self.binary, args, self.debug_info) self.runner = FirefoxRunner( profile=self.profile, binary=cmd[0], cmdargs=cmd[1:], env=env, process_class=ProcessHandler, process_args={"processOutputLine": [self.on_output]}) self.logger.debug("Starting Firefox") self.runner.start(debug_args=debug_args, interactive=self.debug_info and self.debug_info.interactive) self.logger.debug("Firefox Started")
def start(self, group_metadata=None, **kwargs): if group_metadata is None: group_metadata = {} if self.marionette_port is None: self.marionette_port = get_free_port(2828, exclude=self.used_ports) self.used_ports.add(self.marionette_port) if self.asan: print "Setting up LSAN" self.lsan_handler = mozleak.LSANLeaks(self.logger, scope=group_metadata.get("scope", "/"), allowed=self.lsan_allowed, maxNumRecordedFrames=self.lsan_max_stack_depth) env = test_environment(xrePath=os.path.dirname(self.binary), debugger=self.debug_info is not None, log=self.logger, lsanPath=self.prefs_root) env["STYLO_THREADS"] = str(self.stylo_threads) if self.chaos_mode_flags is not None: env["MOZ_CHAOSMODE"] = str(self.chaos_mode_flags) if self.headless: env["MOZ_HEADLESS"] = "1" preferences = self.load_prefs() self.profile = FirefoxProfile(preferences=preferences) self.profile.set_preferences({ "marionette.port": self.marionette_port, "network.dns.localDomains": ",".join(self.config.domains_set), "dom.file.createInChild": True, # TODO: Remove preferences once Firefox 64 is stable (Bug 905404) "network.proxy.type": 0, "places.history.enabled": False, "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: 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 '5.1' in platform.version()): self.profile.set_preferences({"layers.acceleration.disabled": True}) if self.ca_certificate_path is not None: self.setup_ssl() args = self.binary_args[:] if self.binary_args else [] args += [cmd_arg("marionette"), "about:blank"] debug_args, cmd = browser_command(self.binary, args, self.debug_info) self.runner = FirefoxRunner(profile=self.profile, binary=cmd[0], cmdargs=cmd[1:], env=env, process_class=ProcessHandler, process_args={"processOutputLine": [self.on_output]}) self.logger.debug("Starting Firefox") self.runner.start(debug_args=debug_args, interactive=self.debug_info and self.debug_info.interactive) self.logger.debug("Firefox Started")