Bug 1410969 - Return dict from find_paths_and_tags(); r=ahal
authorGregory Szorc <gps@mozilla.com>
Mon, 23 Oct 2017 10:36:38 -0700
changeset 387967 7506fda0a6e750808ee7ddfadf6eb4b4d92699bf
parent 387966 f4058e6c62b38bc59553503031de84290dcf3b79
child 387968 7564ed8dff3ed8c5096608ff1f06388f8a937a58
push id32739
push useracraciun@mozilla.com
push dateWed, 25 Oct 2017 09:29:21 +0000
treeherdermozilla-central@252a8528c5ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1410969
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1410969 - Return dict from find_paths_and_tags(); r=ahal This will make the return value more easily extensible and will help consumers know what the data structures represent. MozReview-Commit-ID: DaeYsqfMW37
testing/mach_commands.py
tools/tryselect/selectors/syntax.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -251,25 +251,24 @@ class Test(MachCommandBase):
             run_tests.extend(tests)
 
             if not tests:
                 print('UNKNOWN TEST: %s' % entry, file=sys.stderr)
 
         if not what:
             from tryselect.selectors.syntax import AutoTry
             at = AutoTry(self.topsrcdir, resolver, self._mach_context)
-            changed_files, changed_tags = at.find_paths_and_tags(
-                False, detect_paths=True)
-            if changed_files:
+            res = at.find_paths_and_tags(False, detect_paths=True)
+            if res['paths']:
                 print("Tests will be run based on modifications to the "
-                      "following files:\n\t%s" % "\n\t".join(changed_files))
+                      "following files:\n\t%s" % "\n\t".join(res['paths']))
 
             # TODO this code is redundant with what `find_paths_and_tags` does.
             reader = self.mozbuild_reader(config_mode='empty')
-            files_info = reader.files_info(changed_files)
+            files_info = reader.files_info(res['paths'])
 
             paths, tags, flavors = set(), set(), set()
             for info in files_info.values():
                 paths |= info.test_files
                 tags |= info.test_tags
                 flavors |= info.test_flavors
 
             # This requires multiple calls to resolve_tests, because the test
--- a/tools/tryselect/selectors/syntax.py
+++ b/tools/tryselect/selectors/syntax.py
@@ -482,17 +482,21 @@ class AutoTry(object):
 
             if verbose:
                 if paths:
                     print("Pushing tests based on the following patterns:\n\t%s" %
                           "\n\t".join(paths))
                 if tags:
                     print("Pushing tests based on the following tags:\n\t%s" %
                           "\n\t".join(tags))
-        return paths, tags
+
+        return {
+            'paths': paths,
+            'tags': tags,
+        }
 
     def normalise_list(self, items, allow_subitems=False):
         rv = defaultdict(list)
         for item in items:
             parsed = parse_arg(item)
             for key, values in parsed.iteritems():
                 rv[key].extend(values)
 
@@ -580,18 +584,20 @@ class AutoTry(object):
                 print("No saved configuration called %s found in autotry.ini" % kwargs["preset"],
                       file=sys.stderr)
 
             for key, value in kwargs.iteritems():
                 if value in (None, []) and key in defaults:
                     kwargs[key] = defaults[key]
 
         if not any(kwargs[item] for item in ("paths", "tests", "tags")):
-            kwargs["paths"], kwargs["tags"] = self.find_paths_and_tags(kwargs["verbose"],
-                                                                       kwargs["detect_paths"])
+            res = self.find_paths_and_tags(kwargs['verbose'],
+                                           kwargs['detect_paths'])
+            kwargs['paths'] = res['paths']
+            kwargs['tags'] = res['tags']
 
         builds, platforms, tests, talos, jobs, paths, tags, extra = self.validate_args(**kwargs)
 
         if paths or tags:
             paths = [os.path.relpath(os.path.normpath(os.path.abspath(item)), self.topsrcdir)
                      for item in paths]
             paths_by_flavor = self.paths_by_flavor(paths=paths, tags=tags)