Bug 1610766 - Add option to set conditioned-profile type to Raptor/Browsertime. r=sparky,perftest-reviewers

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Myeongjun Go 2020-04-15 15:11:07 +00:00
parent 4ef20cf6fd
commit 8b5729e497
5 changed files with 33 additions and 4 deletions

View File

@ -243,6 +243,12 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
"default": False,
"help": "Disable performance tuning on android.",
}],
[["--conditioned-profile-scenario"], {
"dest": "conditioned_profile_scenario",
"type": "str",
"default": "settled",
"help": "Name of profile scenario.",
}],
[["--debug-mode"], {
"dest": "debug_mode",
"action": "store_true",
@ -366,6 +372,8 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
self.memory_test = self.config.get('memory_test')
self.cpu_test = self.config.get('cpu_test')
self.disable_perf_tuning = self.config.get('disable_perf_tuning')
self.conditioned_profile_scenario = self.config.get('conditioned_profile_scenario',
'settled')
self.extra_prefs = self.config.get('extra_prefs')
self.is_release_build = self.config.get('is_release_build')
self.debug_mode = self.config.get('debug_mode', False)
@ -524,6 +532,9 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
kw_options['device-name'] = self.config['device_name']
if self.config.get('activity') is not None:
kw_options['activity'] = self.config['activity']
if self.config.get('conditioned_profile_scenario') is not None:
kw_options['conditioned-profile-scenario'] = \
self.config['conditioned_profile_scenario']
kw_options.update(kw)
if self.host:

View File

@ -59,6 +59,7 @@ class RaptorRunner(MozbuildObject):
self.power_test = kwargs['power_test']
self.cpu_test = kwargs['cpu_test']
self.disable_perf_tuning = kwargs['disable_perf_tuning']
self.conditioned_profile_scenario = kwargs['conditioned_profile_scenario']
self.device_name = kwargs['device_name']
if Conditions.is_android(self) or kwargs["app"] in ANDROID_BROWSERS:
@ -158,6 +159,7 @@ class RaptorRunner(MozbuildObject):
'memory_test': self.memory_test,
'cpu_test': self.cpu_test,
'disable_perf_tuning': self.disable_perf_tuning,
'conditioned_profile_scenario': self.conditioned_profile_scenario,
'is_release_build': self.is_release_build,
'device_name': self.device_name,
}

View File

@ -166,6 +166,8 @@ def create_parser(mach_interface=False):
help="Location where Android browser APK was extracted to before installation.")
add_arg('--disable-perf-tuning', dest='disable_perf_tuning', default=False,
action="store_true", help="Disable performance tuning on android.")
add_arg('--conditioned-profile-scenario', dest='conditioned_profile_scenario',
default='settled', type=str, help="Name of profile scenario.")
# for browsertime jobs, cold page load is determined by a '--cold' cmd line argument
add_arg('--cold', dest="cold", action="store_true",

View File

@ -94,6 +94,7 @@ either Raptor or browsertime."""
no_conditioned_profile=False,
device_name=None,
disable_perf_tuning=False,
conditioned_profile_scenario='settled',
extra_prefs={},
**kwargs
):
@ -125,6 +126,7 @@ either Raptor or browsertime."""
"device_name": device_name,
"enable_fission": extra_prefs.get("fission.autostart", False),
"disable_perf_tuning": disable_perf_tuning,
"conditioned_profile_scenario": conditioned_profile_scenario,
"extra_prefs": extra_prefs,
}
@ -214,12 +216,20 @@ either Raptor or browsertime."""
platform = get_current_platform()
LOG.info("Platform used: %s" % platform)
profile_scenario = self.config.get("conditioned_profile_scenario", "settled")
try:
cond_prof_target_dir = get_profile(temp_download_dir, platform, "settled")
cond_prof_target_dir = get_profile(
temp_download_dir,
platform,
profile_scenario
)
except ProfileNotFoundError:
# If we can't find the profile on mozilla-central, we look on try
cond_prof_target_dir = get_profile(
temp_download_dir, platform, "settled", repo="try"
temp_download_dir,
platform,
profile_scenario,
repo="try"
)
except Exception:
# any other error is a showstopper
@ -234,8 +244,11 @@ either Raptor or browsertime."""
if not os.path.exists(cond_prof_target_dir):
LOG.critical(
"Can't find target_dir {}, from get_profile()"
"temp_download_dir {}, platform {}, settled".format(
cond_prof_target_dir, temp_download_dir, platform
"temp_download_dir {}, platform {}, scenario {}".format(
cond_prof_target_dir,
temp_download_dir,
platform,
profile_scenario
)
)
raise OSError

View File

@ -133,6 +133,7 @@ def main(args=sys.argv[1:]):
device_name=args.device_name,
no_conditioned_profile=args.no_conditioned_profile,
disable_perf_tuning=args.disable_perf_tuning,
conditioned_profile_scenario=args.conditioned_profile_scenario,
)
except Exception:
traceback.print_exc()