Bug 1717445 - Allow non-local connections when running condprof. r=perftest-reviewers,AlexandruIonescu

This patch enables non-local connections when we are running condprof to obtain a conditioned profile. The only reason these connections are being disabled to begin with is because of the web-extension we use. This fixes an issue with using the condprofs in release builds such as beta.

Differential Revision: https://phabricator.services.mozilla.com/D119304
This commit is contained in:
Gregory Mierzwinski 2021-07-08 19:49:11 +00:00
parent 08389c68f4
commit 3cad83515c
2 changed files with 20 additions and 12 deletions

View File

@ -269,6 +269,11 @@ class Perftest(object):
force_new=True,
skip_logs=True,
)
if self.config.get("is_release_build", False):
# Enable non-local connections for building the conditioned profile
self.enable_non_local_connections()
if scenario == "settled-youtube":
runner.prepare(scenario, "youtube")
@ -280,6 +285,9 @@ class Perftest(object):
loop = asyncio.get_event_loop()
loop.run_until_complete(runner.one_run(scenario, "default"))
if self.config.get("is_release_build", False):
self.disable_non_local_connections()
self.conditioned_profile_dir = runner.env.profile
return self.conditioned_profile_copy
@ -587,6 +595,18 @@ class Perftest(object):
else:
self.gecko_profiler = GeckoProfile(upload_dir, self.config, test)
def disable_non_local_connections(self):
# For Firefox we need to set MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 env var before startup
# when testing release builds from mozilla-beta/release. This is because of restrictions
# on release builds that require webextensions to be signed unless this env var is set
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=1")
os.environ["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "1"
def enable_non_local_connections(self):
# pageload tests need to be able to access non-local connections via mitmproxy
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=0")
os.environ["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "0"
class PerftestAndroid(Perftest):
"""Mixin class for Android-specific Perftest subclasses."""

View File

@ -223,18 +223,6 @@ class WebExtensionDesktop(PerftestDesktop, WebExtension):
class WebExtensionFirefox(WebExtensionDesktop):
def disable_non_local_connections(self):
# For Firefox we need to set MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 env var before startup
# when testing release builds from mozilla-beta/release. This is because of restrictions
# on release builds that require webextensions to be signed unless this env var is set
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=1")
os.environ["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "1"
def enable_non_local_connections(self):
# pageload tests need to be able to access non-local connections via mitmproxy
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=0")
os.environ["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "0"
def launch_desktop_browser(self, test):
LOG.info("starting %s" % self.config["app"])
if self.config["is_release_build"]: