Bug 1566171 - Part 3: Add browsertime executable arguments to Raptor command line. r=rwood

The goal is to configure browsertime in Raptor in two ways:

1) locally, just like `mach browsertime` does;

2) in automation, at taskgraph creation time, using fetches and
mozharness suite artifacts (for geckodriver).

It's possible for this to be done using mozharness config settings but
using command line options is more explicit and more likely to be easy
to remove later if and when we transition to a browsertime-specific
mozharness script.

Differential Revision: https://phabricator.services.mozilla.com/D38776

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2019-07-26 21:30:03 +00:00
Родитель bc05d7913c
Коммит 8306db5c30
3 изменённых файлов: 68 добавлений и 2 удалений

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

@ -47,6 +47,32 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
"""
install and run raptor tests
"""
# Options to browsertime that take a path. Such paths are made
# absolute before passing through to browsertime itself.
browsertime_path_options = [
[["--browsertime-node"], {
"dest": "browsertime_node",
"default": None,
"help": argparse.SUPPRESS
}],
[["--browsertime-browsertimejs"], {
"dest": "browsertime_browsertimejs",
"default": None,
"help": argparse.SUPPRESS
}],
[["--browsertime-chromedriver"], {
"dest": "browsertime_chromedriver",
"default": None,
"help": argparse.SUPPRESS
}],
[["--browsertime-geckodriver"], {
"dest": "browsertime_geckodriver",
"default": None,
"help": argparse.SUPPRESS
}],
]
config_options = [
[["--test"],
{"action": "store",
@ -181,7 +207,9 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
"help": "Run without multiple processes (e10s).",
}],
] + testing_config_options + copy.deepcopy(code_coverage_config_options)
] + testing_config_options + \
copy.deepcopy(code_coverage_config_options) + \
browsertime_path_options
def __init__(self, **kwargs):
kwargs.setdefault('config_options', self.config_options)
@ -267,6 +295,12 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
self.debug_mode = self.config.get('debug_mode', False)
self.firefox_android_browsers = ["fennec", "geckoview", "refbrow", "fenix"]
for (arg,), details in Raptor.browsertime_path_options:
# Allow to override defaults on the `./mach raptor-test ...` command line.
value = self.config.get(details['dest'])
if value and arg not in self.config.get("raptor_cmd_line_args", []):
setattr(self, details['dest'], value)
# We accept some configuration options from the try commit message in the
# format mozharness: <options>. Example try commit message: mozharness:
# --geckoProfile try: <stuff>
@ -402,6 +436,16 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
options.extend(['--cpu-test'])
if self.config.get('enable_webrender', False):
options.extend(['--enable-webrender'])
for (arg,), details in Raptor.browsertime_path_options:
# Allow to override defaults on the `./mach raptor-test ...` command line.
value = self.config.get(details['dest'])
if value and arg not in self.config.get("raptor_cmd_line_args", []):
# Right now all the browsertime options are paths. Turn relative paths into
# absolute paths.
value = os.path.normpath(os.path.abspath(value))
options.extend([arg, value])
for key, value in kw_options.items():
options.extend(['--%s' % key, value])

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

@ -157,6 +157,18 @@ class RaptorRunner(MozbuildObject):
'is_release_build': self.is_release_build,
}
sys.path.insert(0, os.path.join(self.topsrcdir, 'tools', 'browsertime'))
try:
import mach_commands as browsertime
# We don't set `browsertime_{chromedriver,geckodriver} -- those will be found by
# browsertime in its `node_modules` directory, which is appropriate for local builds.
self.config.update({
'browsertime_node': browsertime.node_path(),
'browsertime_browsertimejs': browsertime.browsertime_path(),
})
finally:
sys.path = sys.path[1:]
def make_args(self):
self.args = {
'config': {},
@ -193,7 +205,7 @@ class MachRaptor(MachCommandBase):
description='Run raptor performance tests.',
parser=create_parser)
def run_raptor_test(self, **kwargs):
build_obj = MozbuildObject.from_environment(cwd=HERE)
build_obj = self
is_android = Conditions.is_android(build_obj) or \
kwargs['app'] in FIREFOX_ANDROID_BROWSERS

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

@ -144,6 +144,16 @@ def create_parser(mach_interface=False):
add_arg('--noinstall', dest="noinstall", default=False, action="store_true",
help="Flag which indicates if Raptor should not offer to install Android APK.")
# Arguments for invoking browsertime.
add_arg('--browsertime-node', dest='browsertime_node',
help="path to Node.js executable")
add_arg('--browsertime-browsertimejs', dest='browsertime_browsertimejs',
help="path to browsertime.js script")
add_arg('--browsertime-chromedriver', dest='browsertime_chromedriver',
help="path to chromedriver executable")
add_arg('--browsertime-geckodriver', dest='browsertime_geckodriver',
help="path to geckodriver executable")
add_logging_group(parser)
return parser