Bug 1502922 - Add --gecko-profile flag support to mach try fuzzy for raptor and talos jobs; r=ahal
authorRob Wood <rwood@mozilla.com>
Tue, 30 Oct 2018 15:15:32 +0000
changeset 499959 431374adcbcd2a96bee6ccd0a68feca472bd2207
parent 499958 c939a33dc358369d5d08a3b15bf94f71f862e3f6
child 499960 37f79d89dea2b154dbccd71953ca07b9ab488892
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1502922
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
taskcluster/taskgraph/templates/gecko-profile.yml
taskcluster/taskgraph/templates/talos-profile.yml
taskcluster/taskgraph/test/test_morph.py
testing/mozharness/mozharness/mozilla/testing/raptor.py
testing/mozharness/mozharness/mozilla/testing/talos.py
testing/raptor/raptor/cmdline.py
testing/talos/talos/cmdline.py
testing/talos/talos/run_tests.py
tools/tryselect/selectors/fuzzy.py
tools/tryselect/templates.py
tools/tryselect/test/test_templates.py
rename from taskcluster/taskgraph/templates/talos-profile.yml
rename to taskcluster/taskgraph/templates/gecko-profile.yml
--- a/taskcluster/taskgraph/templates/talos-profile.yml
+++ b/taskcluster/taskgraph/templates/gecko-profile.yml
@@ -1,36 +1,36 @@
 ---
 $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
                 # instead of overwriting the original command.
                 $merge:
                     - $eval: task
                     - payload:
                           $merge:
                               - $eval: task.payload
                               - command:
                                     $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"]
--- a/taskcluster/taskgraph/test/test_morph.py
+++ b/taskcluster/taskgraph/test/test_morph.py
@@ -220,33 +220,33 @@ def test_template_rebuild(get_morphed):
 
 
 @pytest.mark.parametrize('command', (
     ['foo --bar'],
     ['foo', '--bar'],
     [['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)
 
     for t in morphed.tasks.values():
         command = t.task['payload']['command']
         if isinstance(command[0], list):
             command = command[0]
         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__':
     main()
--- a/testing/mozharness/mozharness/mozilla/testing/raptor.py
+++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py
@@ -1,14 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+import argparse
 import copy
 import json
 import os
 import re
 import sys
 import subprocess
 import time
 
@@ -76,24 +77,40 @@ class Raptor(TestingMixin, MercurialScri
             "dest": "enable_webrender",
             "default": False,
             "help": "Tries to enable the WebRender compositor.",
         }],
         [["--geckoProfile"], {
             "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": 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)"
         }],
-        [["--geckoProfileEntries"], {
+        [["--gecko-profile-entries"], {
             "dest": "gecko_profile_entries",
             "type": "int",
             "help": "How many samples to take with the profiler"
         }],
     ] + testing_config_options + copy.deepcopy(code_coverage_config_options)
 
     def __init__(self, **kwargs):
         kwargs.setdefault('config_options', self.config_options)
--- a/testing/mozharness/mozharness/mozilla/testing/talos.py
+++ b/testing/mozharness/mozharness/mozilla/testing/talos.py
@@ -3,16 +3,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 # ***** END LICENSE BLOCK *****
 """
 run talos tests in a virtualenv
 """
 
+import argparse
 import os
 import sys
 import pprint
 import copy
 import re
 import shutil
 import subprocess
 import json
@@ -130,19 +131,31 @@ class Talos(TestingMixin, MercurialScrip
           "dest": "talos_extra_options",
           "default": None,
           "help": "extra options to talos"
           }],
         [["--geckoProfile"], {
             "dest": "gecko_profile",
             "action": "store_true",
             "default": False,
+            "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"
         }],
-        [["--geckoProfileInterval"], {
+        [["--gecko-profile-interval"], {
             "dest": "gecko_profile_interval",
             "type": "int",
             "default": 0,
             "help": "The interval between samples taken by the profiler (milliseconds)"
         }],
         [["--e10s"], {
             "dest": "e10s",
             "action": "store_true",
@@ -192,41 +205,42 @@ class Talos(TestingMixin, MercurialScrip
         self.installer_url = self.config.get("installer_url")
         self.talos_json_url = self.config.get("talos_json_url")
         self.talos_json = self.config.get("talos_json")
         self.talos_json_config = self.config.get("talos_json_config")
         self.repo_path = self.config.get("repo_path")
         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
         # some platforms download a mitmproxy release binary
         self.mitmproxy_rel_bin = None
         # zip file found on tooltool that contains all of the mitmproxy recordings
         self.mitmproxy_recording_set = None
         # files inside the recording set
         self.mitmproxy_recordings_file_list = self.config.get('mitmproxy', None)
         # path to mitdump tool itself, in py3 venv
         self.mitmdump = None
 
     # 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
 
     def query_abs_dirs(self):
         if self.abs_dirs:
             return self.abs_dirs
         abs_dirs = super(Talos, self).query_abs_dirs()
         abs_dirs['abs_blob_upload_dir'] = os.path.join(abs_dirs['abs_work_dir'],
--- a/testing/raptor/raptor/cmdline.py
+++ b/testing/raptor/raptor/cmdline.py
@@ -16,23 +16,29 @@ def create_parser(mach_interface=False):
     add_arg('-t', '--test', required=True, dest='test',
             help="name of raptor test to run")
     add_arg('--app', default='firefox', dest='app',
             help="name of the application we are testing (default: firefox)",
             choices=['firefox', 'chrome', 'geckoview'])
     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")
     if not mach_interface:
         add_arg('--branchName', dest="branch_name", default='',
                 help="Name of the branch we are testing on")
         add_arg('--run-local', dest="run_local", default=False, action="store_true",
                 help="Flag that indicates if raptor is running locally or in production")
--- a/testing/talos/talos/cmdline.py
+++ b/testing/talos/talos/cmdline.py
@@ -86,23 +86,29 @@ def create_parser(mach_interface=False):
                  "run and output the results in $MOZ_UPLOAD_DIR.")
     add_arg('--spsProfileInterval', dest='gecko_profile_interval', type=float,
             help="(Deprecated - Use --geckoProfileInterval instead.) How "
                  "frequently to take samples (ms)")
     add_arg('--spsProfileEntries', dest="gecko_profile_entries", type=int,
             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'],
             help="Extension to install while running")
     add_arg('--fast', action='store_true',
             help="Run tp tests as tp_fast")
     add_arg('--symbolsPath', dest='symbols_path',
             help="Path to the symbols for the build we are testing")
--- a/testing/talos/talos/run_tests.py
+++ b/testing/talos/talos/run_tests.py
@@ -334,18 +334,18 @@ def run_tests(config, browser_config):
         talos_results.output(results_urls)
         if browser_config['develop'] or config['gecko_profile']:
             print("Thanks for running Talos locally. Results are in %s"
                   % (results_urls['output_urls']))
 
     # 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'])
 
     # we will stop running tests on a failed test, or we will return 0 for
     # green
     return 0
 
 
--- a/tools/tryselect/selectors/fuzzy.py
+++ b/tools/tryselect/selectors/fuzzy.py
@@ -89,17 +89,17 @@ class FuzzyParser(BaseTryParser):
           }],
         [['-u', '--update'],
          {'action': 'store_true',
           'default': False,
           'help': "Update fzf before running.",
           }],
     ]
     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):
     is_win = platform.system() == 'Windows'
     return subprocess.call(cmd, cwd=cwd, shell=True if is_win else False)
 
 
 def run_fzf_install_script(fzf_path):
--- a/tools/tryselect/templates.py
+++ b/tools/tryselect/templates.py
@@ -139,31 +139,34 @@ class ChemspillPrio(Template):
 
     def context(self, chemspill_prio, **kwargs):
         if chemspill_prio:
             return {
                 'chemspill-prio': {}
             }
 
 
-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
         parser.add_argument('--geckoProfile', dest='profile', action='store_true', default=False,
                             help=SUPPRESS)
 
     def context(self, profile, **kwargs):
         if not profile:
             return
-        return {'talos-profile': profile}
+        return {'gecko-profile': profile}
 
 
 all_templates = {
     'artifact': Artifact,
     'path': Path,
     'env': Environment,
     'rebuild': Rebuild,
     'chemspill-prio': ChemspillPrio,
-    'talos-profile': TalosProfile,
+    'gecko-profile': GeckoProfile,
 }
--- a/tools/tryselect/test/test_templates.py
+++ b/tools/tryselect/test/test_templates.py
@@ -35,20 +35,21 @@ TEMPLATE_TESTS = {
         (['invalid/path'], SystemExit),
     ],
     'rebuild': [
         ([], None),
         (['--rebuild', '10'], {'rebuild': 10}),
         (['--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}),
     ],
 }
 
 
 def test_templates(template, args, expected):
     parser = ArgumentParser()
 
     t = all_templates[template]()