Bug 1583353 - [moztest.resolve] Move test_rewrites to a class property r=gbrown
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 21 Oct 2019 19:22:05 +0000
changeset 498618 391773a3c2e6f61091d075a3fdce180d48a0ac56
parent 498617 588f0a9ac709a04228bd4c149b53ce757fa23971
child 498619 74b431af3f3f0c90f083af364908e6a324bf86c4
push id36722
push userapavel@mozilla.com
push dateWed, 23 Oct 2019 09:48:16 +0000
treeherdermozilla-central@ad7a152bc66c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1583353
milestone72.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 1583353 - [moztest.resolve] Move test_rewrites to a class property r=gbrown A minor cleanup. Re-write paths will now automatically be joined to self.topobjdir. Depends on D49766 Differential Revision: https://phabricator.services.mozilla.com/D49767
testing/mozbase/moztest/moztest/resolve.py
--- a/testing/mozbase/moztest/moztest/resolve.py
+++ b/testing/mozbase/moztest/moztest/resolve.py
@@ -596,30 +596,27 @@ class TestMetadata(MozbuildObject):
                     })
 
         self._wpt_loaded = True
 
 
 class TestResolver(MozbuildObject):
     """Helper to resolve tests from the current environment to test files."""
 
+    test_rewrites = {
+        'a11y': '_tests/testing/mochitest/a11y',
+        'browser-chrome': '_tests/testing/mochitest/browser',
+        'chrome': '_tests/testing/mochitest/chrome',
+        'mochitest': '_tests/testing/mochitest/tests',
+        'xpcshell': '_tests/xpcshell',
+    }
+
     def __init__(self, *args, **kwargs):
         MozbuildObject.__init__(self, *args, **kwargs)
         self._tests = self._spawn(TestMetadata)
-        self._test_rewrites = {
-            'a11y': os.path.join(self.topobjdir, '_tests', 'testing',
-                                 'mochitest', 'a11y'),
-            'browser-chrome': os.path.join(self.topobjdir, '_tests', 'testing',
-                                           'mochitest', 'browser'),
-            'chrome': os.path.join(self.topobjdir, '_tests', 'testing',
-                                   'mochitest', 'chrome'),
-            'mochitest': os.path.join(self.topobjdir, '_tests', 'testing',
-                                      'mochitest', 'tests'),
-            'xpcshell': os.path.join(self.topobjdir, '_tests', 'xpcshell'),
-        }
         self.verbose = False
 
     def resolve_tests(self, cwd=None, **kwargs):
         """Resolve tests in the context of the current environment.
 
         This is a more intelligent version of TestMetadata.resolve_tests().
 
         This function provides additional massaging and filtering of low-level
@@ -647,19 +644,20 @@ class TestResolver(MozbuildObject):
                 reldir = norm_cwd[len(norm_srcdir)+1:]
 
             result = self._tests.resolve_tests(under_path=reldir, **kwargs)
 
         else:
             result = self._tests.resolve_tests(**kwargs)
 
         for test in result:
-            rewrite_base = self._test_rewrites.get(test['flavor'], None)
+            rewrite_base = self.test_rewrites.get(test['flavor'], None)
 
             if rewrite_base:
+                rewrite_base = os.path.join(self.topobjdir, os.path.normpath(rewrite_base))
                 yield rewrite_test_base(test, rewrite_base,
                                         honor_install_to_subdir=True)
             else:
                 yield test
 
     def get_outgoing_metadata(self):
         paths, tags, flavors = set(), set(), set()
         changed_files = self.repository.get_outgoing_files('AM')