Bug 1304046 - Pass absolute test path in to pytest, r=Ms2ger
authorJames Graham <james@hoppipolla.co.uk>
Fri, 23 Sep 2016 16:09:45 +0100
changeset 315762 f07b305e3d1142f86eca2b730815f3dbe347f733
parent 315761 9fd9536c6fbb6cab78949fe7e8161116aede0883
child 315763 215adbcb1987f3a8e065f4c92a3d4215d3f93dd1
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs1304046
milestone52.0a1
Bug 1304046 - Pass absolute test path in to pytest, r=Ms2ger MozReview-Commit-ID: 5XpFQoNPP5t
testing/web-platform/harness/wptrunner/executors/executormarionette.py
testing/web-platform/harness/wptrunner/wpttest.py
--- a/testing/web-platform/harness/wptrunner/executors/executormarionette.py
+++ b/testing/web-platform/harness/wptrunner/executors/executormarionette.py
@@ -538,17 +538,17 @@ class MarionetteWdspecExecutor(WdspecExe
     def on_environment_change(self, new_environment):
         pass
 
     def do_test(self, test):
         timeout = test.timeout * self.timeout_multiplier + extra_timeout
 
         success, data = WdspecRun(self.do_wdspec,
                                   self.protocol.session,
-                                  test.path,
+                                  test.abs_path,
                                   timeout).run()
 
         if success:
             return self.convert_result(test, data)
 
         return (test.result_cls(*data), [])
 
     def do_wdspec(self, session, path, timeout):
--- a/testing/web-platform/harness/wptrunner/wpttest.py
+++ b/testing/web-platform/harness/wptrunner/wpttest.py
@@ -107,46 +107,53 @@ class B2GRunInfo(RunInfo):
         self["os"] = "b2g"
 
 
 class Test(object):
     result_cls = None
     subtest_result_cls = None
     test_type = None
 
-    def __init__(self, url, inherit_metadata, test_metadata, timeout=DEFAULT_TIMEOUT, path=None,
-                 protocol="http"):
+    def __init__(self, tests_root, url, inherit_metadata, test_metadata,
+                 timeout=DEFAULT_TIMEOUT, path=None, protocol="http"):
+        self.tests_root = tests_root
         self.url = url
         self._inherit_metadata = inherit_metadata
         self._test_metadata = test_metadata
         self.timeout = timeout
         self.path = path
         self.environment = {"protocol": protocol, "prefs": self.prefs}
 
     def __eq__(self, other):
         return self.id == other.id
 
     @classmethod
     def from_manifest(cls, manifest_item, inherit_metadata, test_metadata):
         timeout = LONG_TIMEOUT if manifest_item.timeout == "long" else DEFAULT_TIMEOUT
-        return cls(manifest_item.url,
+        protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http"
+        return cls(manifest_item.source_file.tests_root,
+                   manifest_item.url,
                    inherit_metadata,
                    test_metadata,
                    timeout=timeout,
                    path=manifest_item.path,
-                   protocol="https" if hasattr(manifest_item, "https") and manifest_item.https else "http")
+                   protocol=protocol)
 
     @property
     def id(self):
         return self.url
 
     @property
     def keys(self):
         return tuple()
 
+    @property
+    def abs_path(self):
+        return os.path.join(self.tests_root, self.path)
+
     def _get_metadata(self, subtest=None):
         if self._test_metadata is not None and subtest is not None:
             return self._test_metadata.get_subtest(subtest)
         else:
             return self._test_metadata
 
     def itermeta(self, subtest=None):
         for metadata in self._inherit_metadata:
@@ -237,20 +244,21 @@ class ManualTest(Test):
     def id(self):
         return self.url
 
 
 class ReftestTest(Test):
     result_cls = ReftestResult
     test_type = "reftest"
 
-    def __init__(self, url, inherit_metadata, test_metadata, references,
+    def __init__(self, tests_root, url, inherit_metadata, test_metadata, references,
                  timeout=DEFAULT_TIMEOUT, path=None, viewport_size=None,
                  dpi=None, protocol="http"):
-        Test.__init__(self, url, inherit_metadata, test_metadata, timeout, path, protocol)
+        Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout,
+                      path, protocol)
 
         for _, ref_type in references:
             if ref_type not in ("==", "!="):
                 raise ValueError
 
         self.references = references
         self.viewport_size = viewport_size
         self.dpi = dpi
@@ -267,17 +275,18 @@ class ReftestTest(Test):
 
         if nodes is None:
             nodes = {}
         if references_seen is None:
             references_seen = set()
 
         url = manifest_test.url
 
-        node = cls(manifest_test.url,
+        node = cls(manifest_test.source_file.tests_root,
+                   manifest_test.url,
                    inherit_metadata,
                    test_metadata,
                    [],
                    timeout=timeout,
                    path=manifest_test.path,
                    viewport_size=manifest_test.viewport_size,
                    dpi=manifest_test.dpi,
                    protocol="https" if hasattr(manifest_test, "https") and manifest_test.https else "http")
@@ -301,17 +310,21 @@ class ReftestTest(Test):
             manifest_node = manifest_test.manifest.get_reference(ref_url)
             if manifest_node:
                 reference = ReftestTest.from_manifest(manifest_node,
                                                       [],
                                                       None,
                                                       nodes,
                                                       references_seen)
             else:
-                reference = ReftestTest(ref_url, [], None, [])
+                reference = ReftestTest(manifest_test.source_file.tests_root,
+                                        ref_url,
+                                        [],
+                                        None,
+                                        [])
 
             node.references.append((reference, ref_type))
 
         return node
 
     @property
     def id(self):
         return self.url