Bug 1204120 - Allow passing talos arguments to |mach try|, r=chmanchester
authorJames Graham <james@hoppipolla.co.uk>
Fri, 11 Sep 2015 18:41:45 +0100
changeset 285726 2085466599718f7df68176d426f576c62b02a54d
parent 285725 3b7594b3f88b845b4613eb3853d5a2f670c7b95d
child 285727 6d452e559186f9246b31f26ff697719358ada436
push id8654
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:48:40 +0000
treeherdermozilla-aurora@bc4551debe17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1204120
milestone44.0a1
Bug 1204120 - Allow passing talos arguments to |mach try|, r=chmanchester This has the side effect that passing -t none doesn't result in bare -t being passed (because "none" is interpreted as a test path).
testing/mach_commands.py
testing/tools/autotry/autotry.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -476,16 +476,22 @@ class PushToTry(MachCommandBase):
 
         try:
             tests = (self.normalise_list(kwargs["tests"], allow_subitems=True)
                      if kwargs["tests"] else {})
         except ValueError as e:
             print("Error parsing -u argument:\n%s" % e.message)
             sys.exit(1)
 
+        try:
+            talos = self.normalise_list(kwargs["talos"]) if kwargs["talos"] else []
+        except ValueError as e:
+            print("Error parsing -t argument:\n%s" % e.message)
+            sys.exit(1)
+
         paths = []
         for p in kwargs["paths"]:
             p = os.path.normpath(os.path.abspath(p))
             if not p.startswith(self.topsrcdir):
                 print('Specified path "%s" is outside of the srcdir, unable to'
                       ' specify tests outside of the srcdir' % p)
                 sys.exit(1)
             if len(p) <= len(self.topsrcdir):
@@ -495,17 +501,17 @@ class PushToTry(MachCommandBase):
             paths.append(os.path.relpath(p, self.topsrcdir))
 
         try:
             tags = self.normalise_list(kwargs["tags"]) if kwargs["tags"] else []
         except ValueError as e:
             print("Error parsing --tags argument:\n%s" % e.message)
             sys.exit(1)
 
-        return kwargs["builds"], platforms, tests, paths, tags, kwargs["extra_args"]
+        return kwargs["builds"], platforms, tests, talos, paths, tags, kwargs["extra_args"]
 
 
     @Command('try',
              category='testing',
              description='Push selected tests to the try server',
              parser=autotry_parser)
 
     def autotry(self, **kwargs):
@@ -547,33 +553,34 @@ class PushToTry(MachCommandBase):
         installable from mach mercurial-setup) or a git repo using git-cinnabar
         (available at https://github.com/glandium/git-cinnabar).
 
         """
 
         from mozbuild.testing import TestResolver
         from mozbuild.controller.building import BuildDriver
         from autotry import AutoTry
+
         print("mach try is under development, please file bugs blocking 1149670.")
 
         resolver = self._spawn(TestResolver)
         at = AutoTry(self.topsrcdir, resolver, self._mach_context)
 
         if kwargs["load"] is not None:
             defaults = at.load_config(kwargs["load"])
 
             if defaults is None:
                 print("No saved configuration called %s found in autotry.ini" % kwargs["load"],
                       file=sys.stderr)
 
             for key, value in kwargs.iteritems():
                 if value in (None, []) and key in defaults:
                     kwargs[key] = defaults[key]
 
-        builds, platforms, tests, paths, tags, extra_args = self.validate_args(**kwargs)
+        builds, platforms, tests, talos, paths, tags, extra_args = self.validate_args(**kwargs)
 
         if kwargs["push"] and at.find_uncommited_changes():
             print('ERROR please commit changes before continuing')
             sys.exit(1)
 
         if paths or tags:
             driver = self._spawn(BuildDriver)
             driver.install_tests(remove=False)
@@ -588,17 +595,17 @@ class PushToTry(MachCommandBase):
                 sys.exit(1)
 
             if not kwargs["intersection"]:
                 paths_by_flavor = at.remove_duplicates(paths_by_flavor, tests)
         else:
             paths_by_flavor = {}
 
         try:
-            msg = at.calc_try_syntax(platforms, tests, builds, paths_by_flavor, tags,
+            msg = at.calc_try_syntax(platforms, tests, talos, builds, paths_by_flavor, tags,
                                      extra_args, kwargs["intersection"])
         except ValueError as e:
             print(e.message)
             sys.exit(1)
 
         if kwargs["verbose"] and paths_by_flavor:
             print('The following tests will be selected: ')
             for flavor, paths in paths_by_flavor.iteritems():
--- a/testing/tools/autotry/autotry.py
+++ b/testing/tools/autotry/autotry.py
@@ -13,36 +13,38 @@ import which
 from collections import defaultdict
 
 import ConfigParser
 
 
 def arg_parser():
     parser = argparse.ArgumentParser()
     parser.add_argument('paths', nargs='*', help='Paths to search for tests to run on try.')
+    parser.add_argument('-b', dest='builds', default='do',
+                        help='Build types to run (d for debug, o for optimized).')
     parser.add_argument('-p', dest='platforms', action="append",
-                        help='Platforms to run. (required if not found in the environment)')
+                        help='Platforms to run (required if not found in the environment).')
     parser.add_argument('-u', dest='tests', action="append",
-                        help='Test suites to run in their entirety')
-    parser.add_argument('-b', dest='builds', default='do',
-                        help='Build types to run (d for debug, o for optimized)')
+                        help='Test suites to run in their entirety.')
+    parser.add_argument('-t', dest="talos", action="append",
+                        help='Talos suites to run.')
     parser.add_argument('--tag', dest='tags', action='append',
-                        help='Restrict tests to the given tag (may be specified multiple times)')
+                        help='Restrict tests to the given tag (may be specified multiple times).')
     parser.add_argument('--and', action='store_true', dest="intersection",
-                        help='When -u and paths are supplied run only the intersection of the tests specified by the two arguments')
+                        help='When -u and paths are supplied run only the intersection of the tests specified by the two arguments.')
     parser.add_argument('--no-push', dest='push', action='store_false',
                         help='Do not push to try as a result of running this command (if '
                         'specified this command will only print calculated try '
                         'syntax and selection info).')
     parser.add_argument('--save', dest="save", action='store',
-                        help="Save the command line arguments for future use with --preset")
+                        help="Save the command line arguments for future use with --preset.")
     parser.add_argument('--preset', dest="load", action='store',
-                        help="Load a saved set of arguments. Additional arguments will override saved ones")
+                        help="Load a saved set of arguments. Additional arguments will override saved ones.")
     parser.add_argument('extra_args', nargs=argparse.REMAINDER,
-                        help='Extra arguments to put in the try push')
+                        help='Extra arguments to put in the try push.')
     parser.add_argument('-v', "--verbose", dest='verbose', action='store_true', default=False,
                         help='Print detailed information about the resulting test selection '
                         'and commands performed.')
     return parser
 
 class TryArgumentTokenizer(object):
     symbols = [("seperator", ","),
                ("list_start", "\["),
@@ -239,18 +241,18 @@ class AutoTry(object):
 
     def remove_duplicates(self, paths_by_flavor, tests):
         rv = {}
         for item in paths_by_flavor:
             if self.flavor_suites[item] not in tests:
                 rv[item] = paths_by_flavor[item].copy()
         return rv
 
-    def calc_try_syntax(self, platforms, tests, builds, paths_by_flavor, tags, extra_args,
-                        intersection):
+    def calc_try_syntax(self, platforms, tests, talos, builds, paths_by_flavor, tags,
+                        extra_args, intersection):
         parts = ["try:", "-b", builds, "-p", ",".join(platforms)]
 
         suites = tests if not intersection else {}
         paths = set()
         for flavor, flavor_tests in paths_by_flavor.iteritems():
             suite = self.flavor_suites[flavor]
             if suite not in suites and (not intersection or suite in tests):
                 for job_name in self.flavor_jobs[flavor]:
@@ -258,17 +260,20 @@ class AutoTry(object):
                         paths.add("%s:%s" % (flavor, test))
                     suites[job_name] = tests.get(suite, [])
 
         if not suites:
             raise ValueError("No tests found matching filters")
 
         parts.append("-u")
         parts.append(",".join("%s%s" % (k, "[%s]" % ",".join(v) if v else "")
-                              for k,v in sorted(suites.items())))
+                              for k,v in sorted(suites.items())) if suites else "none")
+
+        parts.append("-t")
+        parts.append(",".join(talos) if talos else "none")
 
         if tags:
             parts.append(' '.join('--tag %s' % t for t in tags))
 
         if extra_args is not None:
             parts.extend(extra_args)
 
         if paths: