Bug 1346782 - Use full path when searching for wpt directory metadata, r=Ms2ger draft
authorJames Graham <james@hoppipolla.co.uk>
Mon, 13 Mar 2017 11:58:38 +0000
changeset 497561 cb1da81a5c3e03963aa9555cef3f2fab989ba4c1
parent 497560 1065219eebfa6b8e9acad0129b675ad60b22019e
child 548923 d2757ae050f2aee82ba09d0bae73b0fb02bf3d02
push id48938
push userbmo:james@hoppipolla.co.uk
push dateMon, 13 Mar 2017 14:19:39 +0000
reviewersMs2ger
bugs1346782
milestone55.0a1
Bug 1346782 - Use full path when searching for wpt directory metadata, r=Ms2ger This avoids a cache collision between directories in the main test set and vendor-specific tests under some different metadata root. MozReview-Commit-ID: 5WaEtaLJkVD
testing/web-platform/harness/wptrunner/manifestexpected.py
testing/web-platform/harness/wptrunner/testloader.py
--- a/testing/web-platform/harness/wptrunner/manifestexpected.py
+++ b/testing/web-platform/harness/wptrunner/manifestexpected.py
@@ -232,25 +232,23 @@ def get_manifest(metadata_root, test_pat
             return static.compile(f,
                                   run_info,
                                   data_cls_getter=data_cls_getter,
                                   test_path=test_path,
                                   url_base=url_base)
     except IOError:
         return None
 
-def get_dir_manifest(metadata_root, path, run_info):
+def get_dir_manifest(path, run_info):
     """Get the ExpectedManifest for a particular test path, or None if there is no
     metadata stored for that test path.
 
-    :param metadata_root: Absolute path to the root of the metadata directory
-    :param path: Path to the ini file relative to the metadata root
+    :param path: Full path to the ini file
     :param run_info: Dictionary of properties of the test run for which the expectation
                      values should be computed.
     """
-    full_path = os.path.join(metadata_root, path)
     try:
-        with open(full_path) as f:
+        with open(path) as f:
             return static.compile(f,
                                   run_info,
                                   data_cls_getter=lambda x,y: DirectoryManifest)
     except IOError:
         return None
--- a/testing/web-platform/harness/wptrunner/testloader.py
+++ b/testing/web-platform/harness/wptrunner/testloader.py
@@ -491,20 +491,20 @@ class TestLoader(object):
             test_metadata = test_metadata.get_test(manifest_test.id)
 
         return wpttest.from_manifest(manifest_test, inherit_metadata, test_metadata)
 
     def load_dir_metadata(self, test_manifest, metadata_path, test_path):
         rv = []
         path_parts = os.path.dirname(test_path).split(os.path.sep)
         for i in xrange(1,len(path_parts) + 1):
-            path = os.path.join(os.path.sep.join(path_parts[:i]), "__dir__.ini")
+            path = os.path.join(metadata_path, os.path.sep.join(path_parts[:i]), "__dir__.ini")
             if path not in self.directory_manifests:
-                self.directory_manifests[path] = manifestexpected.get_dir_manifest(
-                    metadata_path, path, self.run_info)
+                self.directory_manifests[path] = manifestexpected.get_dir_manifest(path,
+                                                                                   self.run_info)
             manifest = self.directory_manifests[path]
             if manifest is not None:
                 rv.append(manifest)
         return rv
 
     def load_metadata(self, test_manifest, metadata_path, test_path):
         inherit_metadata = self.load_dir_metadata(test_manifest, metadata_path, test_path)
         test_metadata = manifestexpected.get_manifest(