Bug 1477706: [test-verify] Only look at locally changed files on try and in try-select; r=ahal
authorTom Prince <mozilla@hocat.ca>
Fri, 03 Aug 2018 10:26:17 -0600
changeset 485970 e415755450bb62657834557bfb9b6ab2c4e25c6c
parent 485969 8616f91338375095850ced71af2668a7b9ee9c1c
child 485971 13400de208289690b0b5718a7549474e3b4da9d4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1477706
milestone63.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 1477706: [test-verify] Only look at locally changed files on try and in try-select; r=ahal The taskgraph code for test-verify currently looks at locally changed files to determine how many chunks should be run. This code exists so that `mach try fuzzy` show the same chunks that would be run on a try push. This changes it, so that local commts are only considered on try and when called from try-select. This makes generating the taskgraph locally faster, when not using `mach try`. It also makes test-verfiy not consider too many files, if the try push happens to contain commits that have landed but havent been pushed to try yet (i.e. the first push to try after a merge, or beta try pushes). Differential Revision: https://phabricator.services.mozilla.com/D2698
taskcluster/taskgraph/optimize.py
taskcluster/taskgraph/transforms/tests.py
taskcluster/taskgraph/util/perfile.py
--- a/taskcluster/taskgraph/optimize.py
+++ b/taskcluster/taskgraph/optimize.py
@@ -383,14 +383,15 @@ class SkipUnlessSchedules(OptimizationSt
 
 
 class TestVerify(OptimizationStrategy):
     def should_remove_task(self, task, params, _):
         # we would like to return 'False, None' while it's high_value_task
         # and we wouldn't optimize it. Otherwise, it will return 'True, None'
         env = params.get('try_task_config', {}) or {}
         env = env.get('templates', {}).get('env', {})
-        if perfile_number_of_chunks(env.get('MOZHARNESS_TEST_PATHS', ''),
+        if perfile_number_of_chunks(params.is_try(),
+                                    env.get('MOZHARNESS_TEST_PATHS', ''),
                                     params.get('head_repository', ''),
                                     params.get('head_rev', ''),
                                     task):
             return False
         return True
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -833,17 +833,18 @@ def split_chunks(config, tests):
     """Based on the 'chunks' key, split tests up into chunks by duplicating
     them and assigning 'this-chunk' appropriately and updating the treeherder
     symbol."""
     for test in tests:
         if test['suite'].startswith('test-verify') or \
            test['suite'].startswith('test-coverage'):
             env = config.params.get('try_task_config', {}) or {}
             env = env.get('templates', {}).get('env', {})
-            test['chunks'] = perfile_number_of_chunks(env.get('MOZHARNESS_TEST_PATHS', ''),
+            test['chunks'] = perfile_number_of_chunks(config.params.is_try(),
+                                                      env.get('MOZHARNESS_TEST_PATHS', ''),
                                                       config.params.get('head_repository', ''),
                                                       config.params.get('head_rev', ''),
                                                       test['test-name'])
 
             # limit the number of chunks we run for test-verify mode because
             # test-verify is comprehensive and takes a lot of time, if we have
             # >30 tests changed, this is probably an import of external tests,
             # or a patch renaming/moving files in bulk
--- a/taskcluster/taskgraph/util/perfile.py
+++ b/taskcluster/taskgraph/util/perfile.py
@@ -4,26 +4,26 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import logging
 import math
 
 from mozbuild.util import memoize
 from mozpack.path import match as mozpackmatch
-from mozversioncontrol import get_repository_object, InvalidRepoPath
+from mozversioncontrol import get_repository_object, InvalidRepoPath
 from subprocess import CalledProcessError
 from taskgraph import files_changed
 from .. import GECKO
 
 logger = logging.getLogger(__name__)
 
 
 @memoize
-def perfile_number_of_chunks(try_task_config, head_repository, head_rev, type):
+def perfile_number_of_chunks(is_try, try_task_config, head_repository, head_rev, type):
     tests_per_chunk = 10.0
     if type.startswith('test-coverage'):
         tests_per_chunk = 30.0
 
     if type.startswith('test-verify-wpt') or type.startswith('test-coverage-wpt'):
         file_patterns = ['testing/web-platform/tests/**',
                          'testing/web-platform/mozilla/tests/**']
     elif type.startswith('test-verify-gpu') or type.startswith('test-coverage-gpu'):
@@ -42,26 +42,26 @@ def perfile_number_of_chunks(try_task_co
     else:
         # Returning 0 means no tests to run, this captures non test-verify tasks
         return 1
 
     changed_files = set()
     specified_files = []
     if try_task_config:
         specified_files = try_task_config.split(":")
-
-    try:
-        vcs = get_repository_object(GECKO)
-        changed_files.update(vcs.get_outgoing_files('AM'))
-    except InvalidRepoPath:
-        vcs = None
-    except CalledProcessError:
-        return 0
 
-    if not changed_files:
+    if is_try:
+        try:
+            vcs = get_repository_object(GECKO)
+            changed_files.update(vcs.get_outgoing_files('AM'))
+        except InvalidRepoPath:
+            vcs = None
+        except CalledProcessError:
+            return 0
+    else:
         changed_files.update(files_changed.get_changed_files(head_repository,
                                                              head_rev))
 
     changed_files.update(specified_files)
     test_count = 0
     for pattern in file_patterns:
         for path in changed_files:
             # TODO: consider running tests if a manifest changes