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 draft
authorChris Manchester <cmanchester@mozilla.com>
Tue, 28 Feb 2017 14:27:57 -0800
changeset 490584 be8c202361fcef0a47983371d370b1ace27cecbe
parent 490433 1bc2ad020aee2830e0a7941f10958dbec108c254
child 547310 84672c01c36f802e39e6c411e00608705ecbf696
push id47154
push userbmo:cmanchester@mozilla.com
push dateTue, 28 Feb 2017 22:29:11 +0000
reviewersmaja_zf
bugs1343361
milestone54.0a1
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
testing/tools/autotry/autotry.py
--- 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))