Bug 1544041 - Add test-also support to wpt-in-jstests; r=bbouvier
authorMs2ger <Ms2ger@igalia.com>
Tue, 16 Apr 2019 10:03:55 +0000
changeset 469662 978eb962906f3cc5e61b8c7364bb627b325a6231
parent 469661 719725292e4cafffb19ff16688879875d4053b0e
child 469663 2cc6a2c9755e890869a67ccb6059314a571c2709
push id83272
push userarai_a@mac.com
push dateTue, 16 Apr 2019 10:36:06 +0000
treeherderautoland@978eb962906f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1544041
milestone68.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 1544041 - Add test-also support to wpt-in-jstests; r=bbouvier Differential Revision: https://phabricator.services.mozilla.com/D27478
js/src/tests/jstests.py
js/src/tests/lib/results.py
--- a/js/src/tests/jstests.py
+++ b/js/src/tests/jstests.py
@@ -400,27 +400,39 @@ def load_wpt_tests(xul_tester, requested
     ]
 
     def resolve(test_path, script):
         if script.startswith("/"):
             return os.path.join(wpt, script[1:])
 
         return os.path.join(wpt, os.path.dirname(test_path), script)
 
-    return [
-        RefTestCase(
-            wpt,
-            test_path,
-            extra_helper_paths=extra_helper_paths + [resolve(test_path, s) for s in test.scripts],
-            wpt=test
-        )
-        for test_path, test in (
-            (os.path.relpath(test.path, wpt), test) for test in loader.tests["testharness"]
-        )
-    ]
+    tests = []
+    for test in loader.tests["testharness"]:
+        test_path = os.path.relpath(test.path, wpt)
+        scripts = [resolve(test_path, s) for s in test.scripts]
+        extra_helper_paths_for_test = extra_helper_paths + scripts
+
+        # We must create at least one test with the default options, along with
+        # one test for each option given in a test-also annotation.
+        options = [None]
+        for m in test.itermeta():
+            if m.has_key("test-also"):  # NOQA: W601
+                options += m.get("test-also").split()
+        for option in options:
+            test_case = RefTestCase(
+                wpt,
+                test_path,
+                extra_helper_paths=extra_helper_paths_for_test[:],
+                wpt=test
+            )
+            if option:
+                test_case.options.append(option)
+            tests.append(test_case)
+    return tests
 
 
 def load_tests(options, requested_paths, excluded_paths):
     """
     Returns a tuple: (test_count, test_gen)
         test_count: [int] Number of tests that will be in test_gen
         test_gen: [iterable<Test>] Tests found that should be run.
     """
--- a/js/src/tests/lib/results.py
+++ b/js/src/tests/lib/results.py
@@ -362,16 +362,17 @@ class ResultsSink:
     def list(self, completed):
         for label, results in sorted(self.groups.items()):
             if label == '':
                 continue
 
             print(label)
             for result in results:
                 print('    {}'.format(' '.join(result.test.jitflags +
+                                               result.test.options +
                                                [result.test.path])))
 
         if self.options.failure_file:
             failure_file = open(self.options.failure_file, 'w')
             if not self.all_passed():
                 if 'REGRESSIONS' in self.groups:
                     for result in self.groups['REGRESSIONS']:
                         print(result.test.path, file=failure_file)