Bug 1502922 - Add --gecko-profile flag support to mach try fuzzy for raptor and talos jobs; r=ahal

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

--HG--
rename : taskcluster/taskgraph/templates/talos-profile.yml => taskcluster/taskgraph/templates/gecko-profile.yml
extra : moz-landing-system : lando
This commit is contained in:
Rob Wood 2018-10-30 15:15:32 +00:00
Родитель 64e3703341
Коммит 1dfcab1a30
10 изменённых файлов: 78 добавлений и 31 удалений

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

@ -3,7 +3,7 @@ $if: input && task["extra"]
then: then:
$if: task.extra["suite"] $if: task.extra["suite"]
then: then:
$if: task.extra.suite["name"] == "talos" $if: task.extra.suite["name"] in ["talos", "raptor"]
then: then:
task: task:
# We can't use mergeDeep as that will append the command below # We can't use mergeDeep as that will append the command below
@ -17,20 +17,20 @@ then:
$if: typeof(task.payload.command[0]) == 'array' $if: typeof(task.payload.command[0]) == 'array'
then: then:
# Command is an array of arrays. Assumes the command we want # Command is an array of arrays. Assumes the command we want
# to append --geckoProfile to is the first one. Also assumes # to append --gecko-profile to is the first one. Also assumes
# that we can't have a space delimited string here (which is # that we can't have a space delimited string here (which is
# the case for now at least). # the case for now at least).
- $flatten: - $flatten:
- $eval: task.payload.command[0] - $eval: task.payload.command[0]
- ["--geckoProfile"] - ["--gecko-profile"]
else: else:
$if: len(task.payload.command) == 1 $if: len(task.payload.command) == 1
then: then:
# Command is an array with a single space delimited string. # Command is an array with a single space delimited string.
# This only happens on Windows. # This only happens on Windows.
- "${task.payload.command[0]} --geckoProfile" - "${task.payload.command[0]} --gecko-profile"
else: else:
# Command is an array of strings. # Command is an array of strings.
$flatten: $flatten:
- $eval: task.payload.command - $eval: task.payload.command
- ["--geckoProfile"] - ["--gecko-profile"]

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

@ -225,14 +225,14 @@ def test_template_rebuild(get_morphed):
[['foo']], [['foo']],
[['foo', '--bar']], [['foo', '--bar']],
)) ))
def test_template_talos_profile(get_morphed, command): def test_template_gecko_profile(get_morphed, command):
tasks = TASKS[:] tasks = TASKS[:]
for t in tasks: for t in tasks:
t['task']['payload']['command'] = command t['task']['payload']['command'] = command
morphed = get_morphed({ morphed = get_morphed({
'templates': { 'templates': {
'talos-profile': True, 'gecko-profile': True,
} }
}, tasks) }, tasks)
@ -243,9 +243,9 @@ def test_template_talos_profile(get_morphed, command):
command = ' '.join(command) command = ' '.join(command)
if t.label == 'a': if t.label == 'a':
assert not command.endswith('--geckoProfile') assert not command.endswith('--gecko-profile')
elif t.label == 'b': elif t.label == 'b':
assert command.endswith('--geckoProfile') assert command.endswith('--gecko-profile')
if __name__ == '__main__': if __name__ == '__main__':

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

@ -4,6 +4,7 @@
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import argparse
import copy import copy
import json import json
import os import os
@ -81,14 +82,30 @@ class Raptor(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
"dest": "gecko_profile", "dest": "gecko_profile",
"action": "store_true", "action": "store_true",
"default": False, "default": False,
"help": "Whether or not to profile the test run and save the profile results" "help": argparse.SUPPRESS
}], }],
[["--geckoProfileInterval"], { [["--geckoProfileInterval"], {
"dest": "gecko_profile_interval", "dest": "gecko_profile_interval",
"type": "int", "type": "int",
"help": "The interval between samples taken by the profiler (milliseconds)" "help": argparse.SUPPRESS
}], }],
[["--geckoProfileEntries"], { [["--geckoProfileEntries"], {
"dest": "gecko_profile_entries",
"type": "int",
"help": argparse.SUPPRESS
}],
[["--gecko-profile"], {
"dest": "gecko_profile",
"action": "store_true",
"default": False,
"help": "Whether or not to profile the test run and save the profile results"
}],
[["--gecko-profile-interval"], {
"dest": "gecko_profile_interval",
"type": "int",
"help": "The interval between samples taken by the profiler (milliseconds)"
}],
[["--gecko-profile-entries"], {
"dest": "gecko_profile_entries", "dest": "gecko_profile_entries",
"type": "int", "type": "int",
"help": "How many samples to take with the profiler" "help": "How many samples to take with the profiler"

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

@ -8,6 +8,7 @@
run talos tests in a virtualenv run talos tests in a virtualenv
""" """
import argparse
import os import os
import sys import sys
import pprint import pprint
@ -135,9 +136,21 @@ class Talos(TestingMixin, MercurialScript, TooltoolMixin,
"dest": "gecko_profile", "dest": "gecko_profile",
"action": "store_true", "action": "store_true",
"default": False, "default": False,
"help": "Whether or not to profile the test run and save the profile results" "help": argparse.SUPPRESS
}], }],
[["--geckoProfileInterval"], { [["--geckoProfileInterval"], {
"dest": "gecko_profile_interval",
"type": "int",
"default": 0,
"help": argparse.SUPPRESS
}],
[["--gecko-profile"], {
"dest": "gecko_profile",
"action": "store_true",
"default": False,
"help": "Whether or not to profile the test run and save the profile results"
}],
[["--gecko-profile-interval"], {
"dest": "gecko_profile_interval", "dest": "gecko_profile_interval",
"type": "int", "type": "int",
"default": 0, "default": 0,
@ -197,7 +210,8 @@ class Talos(TestingMixin, MercurialScript, TooltoolMixin,
self.obj_path = self.config.get("obj_path") self.obj_path = self.config.get("obj_path")
self.tests = None self.tests = None
self.gecko_profile = self.config.get('gecko_profile') or \ self.gecko_profile = self.config.get('gecko_profile') or \
"--geckoProfile" in self.config.get("talos_extra_options", []) "--geckoProfile" in self.config.get("talos_extra_options", []) or \
"--gecko-profile" in self.config.get("talos_extra_options", [])
self.gecko_profile_interval = self.config.get('gecko_profile_interval') self.gecko_profile_interval = self.config.get('gecko_profile_interval')
self.pagesets_name = None self.pagesets_name = None
self.benchmark_zip = None self.benchmark_zip = None
@ -213,15 +227,15 @@ class Talos(TestingMixin, MercurialScript, TooltoolMixin,
# We accept some configuration options from the try commit message in the format # We accept some configuration options from the try commit message in the format
# mozharness: <options> # mozharness: <options>
# Example try commit message: # Example try commit message:
# mozharness: --geckoProfile try: <stuff> # mozharness: --gecko-profile try: <stuff>
def query_gecko_profile_options(self): def query_gecko_profile_options(self):
gecko_results = [] gecko_results = []
# finally, if gecko_profile is set, we add that to the talos options # finally, if gecko_profile is set, we add that to the talos options
if self.gecko_profile: if self.gecko_profile:
gecko_results.append('--geckoProfile') gecko_results.append('--gecko-profile')
if self.gecko_profile_interval: if self.gecko_profile_interval:
gecko_results.extend( gecko_results.extend(
['--geckoProfileInterval', str(self.gecko_profile_interval)] ['--gecko-profile-interval', str(self.gecko_profile_interval)]
) )
return gecko_results return gecko_results

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

@ -21,13 +21,19 @@ def create_parser(mach_interface=False):
add_arg('-b', '--binary', dest='binary', add_arg('-b', '--binary', dest='binary',
help="path to the browser executable that we are testing") help="path to the browser executable that we are testing")
add_arg('--geckoProfile', action="store_true", dest="gecko_profile", add_arg('--geckoProfile', action="store_true", dest="gecko_profile",
help=argparse.SUPPRESS)
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float,
help=argparse.SUPPRESS)
add_arg('--geckoProfileEntries', dest="gecko_profile_entries", type=int,
help=argparse.SUPPRESS)
add_arg('--gecko-profile', action="store_true", dest="gecko_profile",
help="Profile the run and output the results in $MOZ_UPLOAD_DIR. " help="Profile the run and output the results in $MOZ_UPLOAD_DIR. "
"After talos is finished, perf-html.io will be launched in Firefox so you " "After talos is finished, perf-html.io will be launched in Firefox so you "
"can analyze the local profiles. To disable auto-launching of perf-html.io " "can analyze the local profiles. To disable auto-launching of perf-html.io "
"set the RAPTOR_DISABLE_PROFILE_LAUNCH=1 env var.") "set the DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float, add_arg('--gecko-profile-interval', dest='gecko_profile_interval', type=float,
help="How frequently to take samples (milliseconds)") help="How frequently to take samples (milliseconds)")
add_arg('--geckoProfileEntries', dest="gecko_profile_entries", type=int, add_arg('--gecko-profile-entries', dest="gecko_profile_entries", type=int,
help="How many samples to take with the profiler") help="How many samples to take with the profiler")
add_arg('--symbolsPath', dest='symbols_path', add_arg('--symbolsPath', dest='symbols_path',
help="Path to the symbols for the build we are testing") help="Path to the symbols for the build we are testing")

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

@ -91,13 +91,19 @@ def create_parser(mach_interface=False):
help="(Deprecated - Use --geckoProfileEntries instead.) How " help="(Deprecated - Use --geckoProfileEntries instead.) How "
"many samples to take with the profiler") "many samples to take with the profiler")
add_arg('--geckoProfile', action="store_true", dest="gecko_profile", add_arg('--geckoProfile', action="store_true", dest="gecko_profile",
help=argparse.SUPPRESS)
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float,
help=argparse.SUPPRESS)
add_arg('--geckoProfileEntries', dest="gecko_profile_entries", type=int,
help=argparse.SUPPRESS)
add_arg('--gecko-profile', action="store_true", dest="gecko_profile",
help="Profile the run and output the results in $MOZ_UPLOAD_DIR. " help="Profile the run and output the results in $MOZ_UPLOAD_DIR. "
"After talos is finished, perf-html.io will be launched in Firefox so you " "After talos is finished, perf-html.io will be launched in Firefox so you "
"can analyze the local profiles. To disable auto-launching of perf-html.io " "can analyze the local profiles. To disable auto-launching of perf-html.io "
"set the TALOS_DISABLE_PROFILE_LAUNCH=1 env var.") "set the DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float, add_arg('--gecko-profile-interval', dest='gecko_profile_interval', type=float,
help="How frequently to take samples (ms)") help="How frequently to take samples (ms)")
add_arg('--geckoProfileEntries', dest="gecko_profile_entries", type=int, add_arg('--gecko-profile-entries', dest="gecko_profile_entries", type=int,
help="How many samples to take with the profiler") help="How many samples to take with the profiler")
add_arg('--extension', dest='extensions', action='append', add_arg('--extension', dest='extensions', action='append',
default=['${talos}/talos-powers'], default=['${talos}/talos-powers'],

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

@ -339,8 +339,8 @@ def run_tests(config, browser_config):
# when running talos locally with gecko profiling on, use the view-gecko-profile # when running talos locally with gecko profiling on, use the view-gecko-profile
# tool to automatically load the latest gecko profile in perf-html.io # tool to automatically load the latest gecko profile in perf-html.io
if config['gecko_profile'] and browser_config['develop']: if config['gecko_profile'] and browser_config['develop']:
if os.environ.get('TALOS_DISABLE_PROFILE_LAUNCH', '0') == '1': if os.environ.get('DISABLE_PROFILE_LAUNCH', '0') == '1':
LOG.info("Not launching perf-html.io because TALOS_DISABLE_PROFILE_LAUNCH=1") LOG.info("Not launching perf-html.io because DISABLE_PROFILE_LAUNCH=1")
else: else:
view_gecko_profile(config['browser_path']) view_gecko_profile(config['browser_path'])

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

@ -94,7 +94,7 @@ class FuzzyParser(BaseTryParser):
}], }],
] ]
common_groups = ['push', 'task', 'preset'] common_groups = ['push', 'task', 'preset']
templates = ['artifact', 'path', 'env', 'rebuild', 'chemspill-prio', 'talos-profile'] templates = ['artifact', 'path', 'env', 'rebuild', 'chemspill-prio', 'gecko-profile']
def run(cmd, cwd=None): def run(cmd, cwd=None):

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

@ -144,9 +144,12 @@ class ChemspillPrio(Template):
} }
class TalosProfile(Template): class GeckoProfile(Template):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--gecko-profile', dest='profile', action='store_true', default=False,
help='Create and upload a gecko profile during talos/raptor tasks.')
# For backwards compatibility
parser.add_argument('--talos-profile', dest='profile', action='store_true', default=False, parser.add_argument('--talos-profile', dest='profile', action='store_true', default=False,
help='Create and upload a gecko profile during talos tasks.') help='Create and upload a gecko profile during talos tasks.')
# This is added for consistency with the 'syntax' selector # This is added for consistency with the 'syntax' selector
@ -156,7 +159,7 @@ class TalosProfile(Template):
def context(self, profile, **kwargs): def context(self, profile, **kwargs):
if not profile: if not profile:
return return
return {'talos-profile': profile} return {'gecko-profile': profile}
all_templates = { all_templates = {
@ -165,5 +168,5 @@ all_templates = {
'env': Environment, 'env': Environment,
'rebuild': Rebuild, 'rebuild': Rebuild,
'chemspill-prio': ChemspillPrio, 'chemspill-prio': ChemspillPrio,
'talos-profile': TalosProfile, 'gecko-profile': GeckoProfile,
} }

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

@ -40,10 +40,11 @@ TEMPLATE_TESTS = {
(['--rebuild', '1'], SystemExit), (['--rebuild', '1'], SystemExit),
(['--rebuild', '21'], SystemExit), (['--rebuild', '21'], SystemExit),
], ],
'talos-profile': [ 'gecko-profile': [
([], None), ([], None),
(['--talos-profile'], {'talos-profile': True}), (['--talos-profile'], {'gecko-profile': True}),
(['--geckoProfile'], {'talos-profile': True}), (['--geckoProfile'], {'gecko-profile': True}),
(['--gecko-profile'], {'gecko-profile': True}),
], ],
} }