Bug 1315032 - Make |mach try| set --artifact flag when --enable-artifact-builds is set. r=chmanchester
authorNick Alexander <nalexander@mozilla.com>
Sun, 20 Nov 2016 14:31:52 -0800
changeset 374217 48c662cadc6faadde91fe1ea8bbfbdd2107cd4b1
parent 374216 51786eff9fa18f156357ac441a2452ea4e2b4aaa
child 374218 ad8230a681a898bf8d52d8b3c33889d33eef8caa
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1315032
milestone54.0a1
Bug 1315032 - Make |mach try| set --artifact flag when --enable-artifact-builds is set. r=chmanchester Tri-state flags: I hate them. I don't want to default "--artifact" in the autotry parser, since not all consumers of that code have a mozconfig. However, we also can't overwrite the `artifact` value from a "--no-artifact" flag without knowing if we're changing anything. Therefore, we add a new "--no-artifact" flag and manage the tri-state ourselves. MozReview-Commit-ID: 19gl3mM4YO0
testing/mach_commands.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -498,17 +498,28 @@ class JsapiTestsCommand(MachCommandBase)
             jsapi_tests_cmd.append(params['test_name'])
 
         jsapi_tests_result = subprocess.call(jsapi_tests_cmd)
 
         return jsapi_tests_result
 
 def autotry_parser():
     from autotry import arg_parser
-    return arg_parser()
+    parser = arg_parser()
+    # The --no-artifact flag is only interpreted locally by |mach try|; it's not
+    # like the --artifact flag, which is interpreted remotely by the try server.
+    #
+    # We need a tri-state where set is different than the default value, so we
+    # use a different variable than --artifact.
+    parser.add_argument('--no-artifact',
+                        dest='no_artifact',
+                        action='store_true',
+                        help='Force compiled (non-artifact) builds even when '
+                             '--enable-artifact-builds is set.')
+    return parser
 
 @CommandProvider
 class PushToTry(MachCommandBase):
     def normalise_list(self, items, allow_subitems=False):
         from autotry import parse_arg
 
         rv = defaultdict(list)
         for item in items:
@@ -674,23 +685,42 @@ class PushToTry(MachCommandBase):
                       paths)
                 sys.exit(1)
 
             if not kwargs["intersection"]:
                 paths_by_flavor = at.remove_duplicates(paths_by_flavor, tests)
         else:
             paths_by_flavor = {}
 
+        # Add --artifact if --enable-artifact-builds is set ...
+        if self.substs.get("MOZ_ARTIFACT_BUILDS"):
+            extra["artifact"] = True
+        # ... unless --no-artifact is explicitly given.
+        if kwargs["no_artifact"]:
+            if "artifact" in extra:
+                del extra["artifact"]
+
         try:
             msg = at.calc_try_syntax(platforms, tests, talos, builds, paths_by_flavor, tags,
                                      extra, kwargs["intersection"])
         except ValueError as e:
             print(e.message)
             sys.exit(1)
 
+        if kwargs["verbose"]:
+            if self.substs.get("MOZ_ARTIFACT_BUILDS"):
+                if kwargs["no_artifact"]:
+                    print('mozconfig has --enable-artifact-builds but '
+                          '--no-artifact specified, not including --artifact '
+                          'flag in try syntax')
+                else:
+                    print('mozconfig has --enable-artifact-builds; including '
+                          '--artifact flag in try syntax (use --no-artifact '
+                          'to override)')
+
         if kwargs["verbose"] and paths_by_flavor:
             print('The following tests will be selected: ')
             for flavor, paths in paths_by_flavor.iteritems():
                 print("%s: %s" % (flavor, ",".join(paths)))
 
         if kwargs["verbose"] or not kwargs["push"]:
             print('The following try syntax was calculated:\n%s' % msg)