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:
$if: task.extra["suite"]
then:
$if: task.extra.suite["name"] == "talos"
$if: task.extra.suite["name"] in ["talos", "raptor"]
then:
task:
# We can't use mergeDeep as that will append the command below
@ -17,20 +17,20 @@ then:
$if: typeof(task.payload.command[0]) == 'array'
then:
# 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
# the case for now at least).
- $flatten:
- $eval: task.payload.command[0]
- ["--geckoProfile"]
- ["--gecko-profile"]
else:
$if: len(task.payload.command) == 1
then:
# Command is an array with a single space delimited string.
# This only happens on Windows.
- "${task.payload.command[0]} --geckoProfile"
- "${task.payload.command[0]} --gecko-profile"
else:
# Command is an array of strings.
$flatten:
- $eval: task.payload.command
- ["--geckoProfile"]
- ["--gecko-profile"]

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

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

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

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

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

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

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

@ -21,13 +21,19 @@ def create_parser(mach_interface=False):
add_arg('-b', '--binary', dest='binary',
help="path to the browser executable that we are testing")
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. "
"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 "
"set the RAPTOR_DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float,
"set the DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--gecko-profile-interval', dest='gecko_profile_interval', type=float,
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")
add_arg('--symbolsPath', dest='symbols_path',
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 "
"many samples to take with the profiler")
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. "
"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 "
"set the TALOS_DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--geckoProfileInterval', dest='gecko_profile_interval', type=float,
"set the DISABLE_PROFILE_LAUNCH=1 env var.")
add_arg('--gecko-profile-interval', dest='gecko_profile_interval', type=float,
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")
add_arg('--extension', dest='extensions', action='append',
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
# tool to automatically load the latest gecko profile in perf-html.io
if config['gecko_profile'] and browser_config['develop']:
if os.environ.get('TALOS_DISABLE_PROFILE_LAUNCH', '0') == '1':
LOG.info("Not launching perf-html.io because TALOS_DISABLE_PROFILE_LAUNCH=1")
if os.environ.get('DISABLE_PROFILE_LAUNCH', '0') == '1':
LOG.info("Not launching perf-html.io because DISABLE_PROFILE_LAUNCH=1")
else:
view_gecko_profile(config['browser_path'])

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

@ -94,7 +94,7 @@ class FuzzyParser(BaseTryParser):
}],
]
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):

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

@ -144,9 +144,12 @@ class ChemspillPrio(Template):
}
class TalosProfile(Template):
class GeckoProfile(Template):
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,
help='Create and upload a gecko profile during talos tasks.')
# This is added for consistency with the 'syntax' selector
@ -156,7 +159,7 @@ class TalosProfile(Template):
def context(self, profile, **kwargs):
if not profile:
return
return {'talos-profile': profile}
return {'gecko-profile': profile}
all_templates = {
@ -165,5 +168,5 @@ all_templates = {
'env': Environment,
'rebuild': Rebuild,
'chemspill-prio': ChemspillPrio,
'talos-profile': TalosProfile,
'gecko-profile': GeckoProfile,
}

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

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