Bug 1877180 - Pass the app name to mozproxy during recording. r=perftest-reviewers,kshampur,afinder DONTBUILD

This patch fixes a couple bugs with recording. The first is that the app wasn't being passed to mozproxy, and this was preventing the creation of the mitmproxy certificate for the app being used to record. The second is that the --proxy-deterministic flag isn't defined within the proxy layer even though it's used by it from the hooks.

Differential Revision: https://phabricator.services.mozilla.com/D199891
This commit is contained in:
Greg Mierzwinski 2024-02-02 13:09:18 +00:00
Родитель 5eedf36dc4
Коммит 05889cd4a2
3 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -14,7 +14,13 @@ from mozlog import get_proxy_logger
from mozprocess import ProcessHandler
from mozperftest.layers import Layer
from mozperftest.utils import ON_TRY, download_file, get_output_dir, install_package
from mozperftest.utils import (
ON_TRY,
download_file,
get_output_dir,
get_pretty_app_name,
install_package,
)
LOG = get_proxy_logger(component="proxy")
HERE = os.path.dirname(__file__)
@ -95,6 +101,11 @@ class ProxyRunner(Layer):
"the login fields won't be checked with a request such as this (i.e. it overrides "
"those settings).",
},
"deterministic": {
"action": "store_true",
"default": False,
"help": "If set, the deterministic JS script will be injected into the pages.",
},
}
def __init__(self, env, mach_cmd):
@ -149,6 +160,9 @@ class ProxyRunner(Layer):
if metadata.flavor == "mobile-browser":
command.extend(["--tool=%s" % "mitmproxy-android"])
command.extend(["--binary=android"])
command.extend(
[f"--app={get_pretty_app_name(self.get_arg('android-app-name'))}"]
)
else:
command.extend(["--tool=%s" % "mitmproxy"])
# XXX See bug 1712337, we need a single point where we can get the binary used from

Просмотреть файл

@ -149,6 +149,7 @@ def test_android_proxy(killer):
mach_cmd, metadata, env = running_env()
metadata.flavor = "mobile-browser"
system = env.layers[SYSTEM]
env.set_arg("android-app-name", "org.mozilla.geckoview_example")
env.set_arg("proxy-mode", "playback")
env.set_arg("proxy-file", example_dump)

Просмотреть файл

@ -30,6 +30,11 @@ MULTI_TASK_ROOT = f"{API_ROOT}/tasks"
ON_TRY = "MOZ_AUTOMATION" in os.environ
DOWNLOAD_TIMEOUT = 30
METRICS_MATCHER = re.compile(r"(perfMetrics\s.*)")
PRETTY_APP_NAMES = {
"org.mozilla.fenix": "fenix",
"org.mozilla.firefox": "fenix",
"org.mozilla.geckoview_example": "geckoview",
}
class NoPerfMetricsError(Exception):
@ -620,3 +625,10 @@ def create_path(path):
create_path(path.parent)
path.mkdir(exist_ok=True)
return path
def get_pretty_app_name(app):
# XXX See bug 1712337, we need a singluar point of entry
# for the binary to allow us to get the version/app info
# so that we can get a pretty name on desktop.
return PRETTY_APP_NAMES[app]