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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan Hunt 2020-03-11 04:04:27 +00:00
parent 8edab673d8
commit dcfba1aa5c
2 changed files with 10 additions and 20 deletions

View File

@ -1,22 +1,6 @@
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 {

View File

@ -135,7 +135,8 @@ class JitTest:
# 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.
@ -168,7 +169,8 @@ class JitTest:
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
@ -283,7 +285,9 @@ class JitTest:
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':
@ -364,8 +368,10 @@ class JitTest:
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]