Bug 1343361 - Auomatically replace `-u all` with a set of suites that do not include compiled tests when requesting an artifact build via |./mach try|. r=maja_zf
MozReview-Commit-ID: BYgzbYrbw7E
--- a/testing/tools/autotry/autotry.py
+++ b/testing/tools/autotry/autotry.py
@@ -403,16 +403,29 @@ class AutoTry(object):
rejected = []
for suite in suites.keys():
if any([suite.startswith(c) for c in self.compiled_suites]):
rejected.append(suite)
if rejected:
raise ValueError("You can't run {} with "
"--artifact option.".format(', '.join(rejected)))
+ if extras.get('artifact') and 'all' in suites.keys():
+ non_compiled_suites = set(self.common_suites) - set(self.compiled_suites)
+ message = ('You asked for |-u all| with |--artifact| but compiled-code tests ({tests})'
+ ' can\'t run against an artifact build. Running (-u {non_compiled_suites}) '
+ 'instead.')
+ string_format = {
+ 'tests': ','.join(self.compiled_suites),
+ 'non_compiled_suites': ','.join(non_compiled_suites),
+ }
+ print(message.format(**string_format))
+ del suites['all']
+ suites.update({suite_name: None for suite_name in non_compiled_suites})
+
parts.append("-u")
parts.append(",".join("%s%s" % (k, "[%s]" % ",".join(v) if v else "")
for k,v in sorted(suites.items())) if suites else "none")
parts.append("-t")
parts.append(",".join("%s%s" % (k, "[%s]" % ",".join(v) if v else "")
for k,v in sorted(talos.items())) if talos else "none")
@@ -433,29 +446,16 @@ class AutoTry(object):
if action == 'append':
for e in value:
parts.append(arg)
parts.append(e)
if action in ('store_true', 'store_false'):
parts.append(arg)
try_syntax = " ".join(parts)
- if extras.get('artifact') and 'all' in suites.keys():
- message = ('You asked for |-u all| with |--artifact| but compiled-code tests ({tests})'
- ' can\'t run against an artifact build. Try listing the suites you want'
- ' instead. For example, this syntax covers most suites:\n{try_syntax}')
- string_format = {
- 'tests': ','.join(self.compiled_suites),
- 'try_syntax': try_syntax.replace(
- '-u all',
- '-u ' + ','.join(sorted(set(self.common_suites) - set(self.compiled_suites)))
- )
- }
- raise ValueError(message.format(**string_format))
-
return try_syntax
def _run_git(self, *args):
args = ['git'] + list(args)
ret = subprocess.call(args)
if ret:
print('ERROR git command %s returned %s' %
(args, ret))