Bug 1410969 - Properly import AutoTry; r?ahal draft
authorGregory Szorc <gps@mozilla.com>
Mon, 23 Oct 2017 10:33:37 -0700
changeset 684913 896f1466103b5ab9594f88a995216833ed5d1d4d
parent 684703 d49501f258b105c5e2dcd0a59896ec1ceabf726b
child 684914 3dc84d3282ced81ca2d56e99445ed82a404f1936
child 684921 1edea624eadd5fdd8f3866bb7c5880b0344d344a
push id85762
push usergszorc@mozilla.com
push dateMon, 23 Oct 2017 18:53:27 +0000
reviewersahal
bugs1410969, 1382775
milestone58.0a1
Bug 1410969 - Properly import AutoTry; r?ahal The AutoTry code got moved around in 27b5181a3c77 and c94bf66df122 (bug 1382775). This broke `mach test` without arguments. This commit imports the new location and uses the new API. As the inline TODO states, there is still room for improvement. This will be done in a separate commit. MozReview-Commit-ID: AKHfdNnfOhl
testing/mach_commands.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -249,26 +249,25 @@ class Test(MachCommandBase):
             relpath = self._wrap_path_argument(entry).relpath()
             tests = list(resolver.resolve_tests(paths=[relpath]))
             run_tests.extend(tests)
 
             if not tests:
                 print('UNKNOWN TEST: %s' % entry, file=sys.stderr)
 
         if not what:
-            # TODO: This isn't really related to try, and should be
-            # extracted to a common library for vcs interactions when it is
-            # introduced in bug 1185599.
-            from autotry import AutoTry
+            from tryselect.selectors.syntax import AutoTry
             at = AutoTry(self.topsrcdir, resolver, self._mach_context)
-            changed_files = at.find_changed_files()
+            changed_files, changed_tags = at.find_paths_and_tags(
+                False, detect_paths=True)
             if changed_files:
                 print("Tests will be run based on modifications to the "
                       "following files:\n\t%s" % "\n\t".join(changed_files))
 
+            # 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)
 
             paths, tags, flavors = set(), set(), set()
             for info in files_info.values():
                 paths |= info.test_files
                 tags |= info.test_tags
                 flavors |= info.test_flavors