Bug 1401017 - Make mach try work with -j in the presence of modified local files. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 18 Sep 2017 14:21:18 -0700
changeset 666494 6291798b9a281112790f748688988f7a1432fa5e
parent 666416 42151fcd6cfc216d147730d0f2c6a2acd52d22fd
child 732137 9ca18b4117ad35ef6bff437947c03a0830cda68b
push id80441
push userbmo:cmanchester@mozilla.com
push dateMon, 18 Sep 2017 21:21:28 +0000
bugs1401017
milestone57.0a1
Bug 1401017 - Make mach try work with -j in the presence of modified local files. Running |./mach try -j <job>| may fail if there are changes in the local working copy because the command will attempt to provide test paths based on those changes and subsequently require platforms to be specified on the basis of those paths. This commit makes this auto-detection only run when a particular option is passed so this doesn't interfere with the common case of simply running a selected job on try. MozReview-Commit-ID: F3RBgDAYi27
tools/tryselect/selectors/syntax.py
--- a/tools/tryselect/selectors/syntax.py
+++ b/tools/tryselect/selectors/syntax.py
@@ -64,16 +64,22 @@ class SyntaxParser(BaseTryParser):
           }],
         [['-v', '--verbose'],
          {'dest': 'verbose',
           'action': 'store_true',
           'default': False,
           'help': 'Print detailed information about the resulting test selection '
                   'and commands performed.',
           }],
+        [['--detect-paths'],
+         {'dest': 'detect_paths',
+          'action': 'store_true',
+          'default': False,
+          'help': 'Provide test paths based on files changed in the working copy.',
+          }],
     ]
 
     # Arguments we will accept on the command line and pass through to try
     # syntax with no further intervention. The set is taken from
     # http://trychooser.pub.build.mozilla.org with a few additions.
     #
     # Note that the meaning of store_false and store_true arguments is
     # not preserved here, as we're only using these to echo the literal
@@ -449,20 +455,20 @@ class AutoTry(object):
                     parts.append(arg)
                     parts.append(e)
             if action in ('store_true', 'store_false'):
                 parts.append(arg)
 
         try_syntax = " ".join(parts)
         return try_syntax
 
-    def find_paths_and_tags(self, verbose):
+    def find_paths_and_tags(self, verbose, detect_paths):
         paths, tags = set(), set()
         changed_files = self.vcs.files_changed
-        if changed_files:
+        if changed_files and detect_paths:
             if verbose:
                 print("Pushing tests based on modifications to the "
                       "following files:\n\t%s" % "\n\t".join(changed_files))
 
             from mozbuild.frontend.reader import (
                 BuildReader,
                 EmptyConfig,
             )
@@ -575,17 +581,18 @@ class AutoTry(object):
                 print("No saved configuration called %s found in autotry.ini" % kwargs["preset"],
                       file=sys.stderr)
 
             for key, value in kwargs.iteritems():
                 if value in (None, []) and key in defaults:
                     kwargs[key] = defaults[key]
 
         if not any(kwargs[item] for item in ("paths", "tests", "tags")):
-            kwargs["paths"], kwargs["tags"] = self.find_paths_and_tags(kwargs["verbose"])
+            kwargs["paths"], kwargs["tags"] = self.find_paths_and_tags(kwargs["verbose"],
+                                                                       kwargs["detect_paths"])
 
         builds, platforms, tests, talos, jobs, paths, tags, extra = self.validate_args(**kwargs)
 
         if paths or tags:
             paths = [os.path.relpath(os.path.normpath(os.path.abspath(item)), self.topsrcdir)
                      for item in paths]
             paths_by_flavor = self.paths_by_flavor(paths=paths, tags=tags)