Bug 1401017 - Make mach try work with -j in the presence of modified local files. r=ahal

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

--HG--
extra : rebase_source : 81e7774d7b1af31ee188b76afdac5062db1ab811
This commit is contained in:
Chris Manchester 2017-09-18 14:21:18 -07:00
parent 7527e600f0
commit 83c39d5afe

View File

@ -69,6 +69,12 @@ class SyntaxParser(BaseTryParser):
'help': 'Print detailed information about the resulting test selection ' 'help': 'Print detailed information about the resulting test selection '
'and commands performed.', '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 # Arguments we will accept on the command line and pass through to try
@ -453,10 +459,10 @@ class AutoTry(object):
return " ".join(parts) return " ".join(parts)
def find_paths_and_tags(self, verbose): def find_paths_and_tags(self, verbose, detect_paths):
paths, tags = set(), set() paths, tags = set(), set()
changed_files = self.vcs.files_changed changed_files = self.vcs.files_changed
if changed_files: if changed_files and detect_paths:
if verbose: if verbose:
print("Pushing tests based on modifications to the " print("Pushing tests based on modifications to the "
"following files:\n\t%s" % "\n\t".join(changed_files)) "following files:\n\t%s" % "\n\t".join(changed_files))
@ -579,7 +585,8 @@ class AutoTry(object):
kwargs[key] = defaults[key] kwargs[key] = defaults[key]
if not any(kwargs[item] for item in ("paths", "tests", "tags")): 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) builds, platforms, tests, talos, jobs, paths, tags, extra = self.validate_args(**kwargs)