Bug 1617827 - Tests: Allow specifying an 'include' relative to directives.txt in jit-tests. r=lth
authorRyan Hunt <rhunt@eqrion.net>
Wed, 11 Mar 2020 04:04:27 +0000
changeset 518064 2c328ec4ae21bd006b309bbbb3d27ae75b6adc06
parent 518063 43269f6c47816c6642323e918c3cf62642e6a0de
child 518065 f5b812ee53b20bb4f5522280bff416bacd268aff
push id109764
push userrhunt@eqrion.net
push dateWed, 11 Mar 2020 04:24:05 +0000
treeherderautoland@9b6eb4ab142b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1617827
milestone76.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 1617827 - Tests: Allow specifying an 'include' relative to directives.txt in jit-tests. r=lth This is needed so that we can find include the 'harness/sync_index.js' for each proposal using its directives.txt. Before this commit, this was done by lib/wasm-testharness.js loading it from a relative path. We could assume that each proposal has the same sync_index.js, as it doesn't change often, but that seemed like it could lead to a hard to discover bug later down the road. Differential Revision: https://phabricator.services.mozilla.com/D65194
js/src/jit-test/lib/wasm-testharness.js
js/src/tests/lib/jittests.py
--- a/js/src/jit-test/lib/wasm-testharness.js
+++ b/js/src/jit-test/lib/wasm-testharness.js
@@ -1,27 +1,11 @@
 if (!wasmIsSupported())
     quit();
 
-// We need to find the absolute path that ends like this:
-//
-//  js/src/jit-test/tests/wasm/spec/harness/
-//
-// because that's where the test harness lives.  Fortunately we are provided
-// with |libdir|, which is a path that ends thusly
-//
-//  js/src/jit-test/lib/
-//
-// That is, it has a fixed offset relative to what we need.  So we can
-// simply do this:
-
-let harnessdir = libdir + "../tests/wasm/spec/harness/";
-
-load(harnessdir + 'sync_index.js');
-
 function test(func, description) {
     let maybeErr;
     try {
         func();
     } catch(e) {
         maybeErr = e;
     }
 
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -130,17 +130,18 @@ class JitTest:
         self.allow_unhandlable_oom = False
         # True means that hitting recursion the limits is not considered a failure.
         self.allow_overrecursed = False
         # True means run under valgrind
         self.valgrind = False
         # True means force Pacific time for the test
         self.tz_pacific = False
         # Additional files to include, in addition to prologue.js
-        self.other_includes = []
+        self.other_lib_includes = []
+        self.other_script_includes = []
         # List of other configurations to test with.
         self.test_also = []
         # List of other configurations to test with all existing variants.
         self.test_join = []
         # Errors to expect and consider passing
         self.expect_error = ''
         # Exit status to expect from shell
         self.expect_status = 0
@@ -163,17 +164,18 @@ class JitTest:
         t = JitTest(self.path)
         t.jitflags = self.jitflags[:]
         t.slow = self.slow
         t.allow_oom = self.allow_oom
         t.allow_unhandlable_oom = self.allow_unhandlable_oom
         t.allow_overrecursed = self.allow_overrecursed
         t.valgrind = self.valgrind
         t.tz_pacific = self.tz_pacific
-        t.other_includes = self.other_includes[:]
+        t.other_lib_includes = self.other_lib_includes[:]
+        t.other_script_includes = self.other_script_includes[:]
         t.test_also = self.test_also
         t.test_join = self.test_join
         t.expect_error = self.expect_error
         t.expect_status = self.expect_status
         t.expect_crash = self.expect_crash
         t.test_reflect_stringify = self.test_reflect_stringify
         t.enable = True
         t.is_module = self.is_module
@@ -278,17 +280,19 @@ class JitTest:
                     elif name == 'thread-count':
                         try:
                             test.jitflags.append('--thread-count={}'.format(
                                 int(value, 0)))
                         except ValueError:
                             print("warning: couldn't parse thread-count"
                                   " {}".format(value))
                     elif name == 'include':
-                        test.other_includes.append(value)
+                        test.other_lib_includes.append(value)
+                    elif name == 'local-include':
+                        test.other_script_includes.append(value)
                     elif name == 'skip-if':
                         test.skip_if_cond = extend_condition(test.skip_if_cond, value)
                     elif name == 'skip-variant-if':
                         try:
                             [variant, condition] = value.split(',')
                             test.skip_variant_if_cond[variant] = extend_condition(
                                 test.skip_if_cond,
                                 condition)
@@ -359,18 +363,20 @@ class JitTest:
                  "const scriptdir={}".format(js_quote(quotechar, scriptdir_var))]
 
         # We may have specified '-a' or '-d' twice: once via --jitflags, once
         # via the "|jit-test|" line.  Remove dups because they are toggles.
         cmd = prefix + []
         cmd += list(set(self.jitflags))
         for expr in exprs:
             cmd += ['-e', expr]
-        for inc in self.other_includes:
+        for inc in self.other_lib_includes:
             cmd += ['-f', libdir + inc]
+        for inc in self.other_script_includes:
+            cmd += ['-f', scriptdir_var + inc]
         if self.skip_if_cond:
             cmd += ['-e', "if ({}) quit({})".format(self.skip_if_cond, self.SKIPPED_EXIT_STATUS)]
         cmd += ['--module-load-path', moduledir]
         if self.is_module:
             cmd += ['--module', path]
         elif self.is_binast:
             # In builds with BinAST, this will run the test file. In builds without,
             # It's a no-op and the tests will silently pass.