summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore15
-rwxr-xr-xcheck.py14
-rw-r--r--scripts/test/node-esm-loader.mjs6
-rw-r--r--scripts/test/shared.py5
-rwxr-xr-xscripts/test/wasm2js.py3
-rw-r--r--src/binaryen-c.cpp2
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt2
-rw-r--r--test/example/c-api-kitchen-sink.txt2
8 files changed, 22 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index 5dbfd358a..6397ab108 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,21 +8,6 @@
# File generated by build-js.sh
/out/
-# autogenerated files by check.py
-a.*
-b.*
-c.*
-ab.wast
-actual.out
-example.o
-split.wast
-trace.cpp
-test/wasm-binaries-*.tbz2
-test/wasm-torture-s-*.tbz2
-test/wasm-install/
-test/validator/*.wasm
-*.map
-
# files related to building in-tree
CMakeFiles
*.cmake
diff --git a/check.py b/check.py
index 3c9e5255a..6cdbb2a44 100755
--- a/check.py
+++ b/check.py
@@ -29,7 +29,7 @@ from scripts.test.shared import (
fail_if_not_identical, fail_if_not_contained, has_vanilla_emcc,
has_vanilla_llvm, minify_check, options, tests, requested, warnings,
has_shell_timeout, fail_if_not_identical_to_file, with_pass_debug,
- validate_binary
+ validate_binary, test_out
)
# For shared.num_failures. Cannot import directly because modifications made in
@@ -84,9 +84,10 @@ def run_wasm_opt_tests():
for extra_args in [[], ['--no-validation']]:
wast = os.path.join(options.binaryen_test, 'hello_world.wast')
delete_from_orbit('a.wast')
- cmd = WASM_OPT + [wast, '-o', 'a.wast', '-S'] + extra_args
+ out = os.path.join(test_out, 'a.wast')
+ cmd = WASM_OPT + [wast, '-o', out, '-S'] + extra_args
run_command(cmd)
- fail_if_not_identical_to_file(open('a.wast').read(), wast)
+ fail_if_not_identical_to_file(open(out).read(), wast)
print('\n[ checking wasm-opt binary reading/writing... ]\n')
@@ -174,10 +175,11 @@ def run_wasm_opt_tests():
print('\n[ checking wasm-opt debugInfo read-write... ]\n')
- for t in os.listdir('test'):
+ test_dir = os.path.join(options.binaryen_root, 'test')
+ for t in os.listdir(test_dir):
if t.endswith('.fromasm') and 'debugInfo' in t:
print('..', t)
- t = os.path.join('test', t)
+ t = os.path.join(test_dir, t)
f = t + '.read-written'
run_command(WASM_AS + [t, '--source-map=a.map', '-o', 'a.wasm', '-g'])
run_command(WASM_OPT + ['a.wasm', '--input-source-map=a.map', '-o', 'b.wasm', '--output-source-map=b.map', '-g'])
@@ -493,7 +495,7 @@ def run_gcc_tests():
cmd = ['-I' + os.path.join(options.binaryen_root, 'src'), '-g', '-pthread', '-o', output_file]
if t.endswith('.txt'):
# check if there is a trace in the file, if so, we should build it
- out = subprocess.Popen([os.path.join('scripts', 'clean_c_api_trace.py'), os.path.join(options.binaryen_test, 'example', t)], stdout=subprocess.PIPE).communicate()[0]
+ out = subprocess.check_output([os.path.join(options.binaryen_root, 'scripts', 'clean_c_api_trace.py'), os.path.join(options.binaryen_test, 'example', t)])
if len(out) == 0:
print(' (no trace in ', t, ')')
continue
diff --git a/scripts/test/node-esm-loader.mjs b/scripts/test/node-esm-loader.mjs
index 5d41033fb..9d073c171 100644
--- a/scripts/test/node-esm-loader.mjs
+++ b/scripts/test/node-esm-loader.mjs
@@ -7,7 +7,9 @@ import Module from 'module';
const builtins = Module.builtinModules;
const baseURL = new URL('file://');
-baseURL.pathname = `${process.cwd()}/`;
+const binaryen_root = path.dirname(path.dirname(process.cwd()));
+baseURL.pathname = `${binaryen_root}/`;
+
export function resolve(specifier, parentModuleURL = baseURL, defaultResolve) {
if (builtins.includes(specifier)) {
@@ -18,7 +20,7 @@ export function resolve(specifier, parentModuleURL = baseURL, defaultResolve) {
}
// Resolve special modules used in our test suite.
if (specifier == 'spectest' || specifier == 'env' || specifier == 'mod.ule') {
- const resolved = new URL('./scripts/test/' + specifier + '.js', parentModuleURL);
+ const resolved = new URL('./scripts/test/' + specifier + '.js', baseURL);
return {
url: resolved.href,
format: 'esm'
diff --git a/scripts/test/shared.py b/scripts/test/shared.py
index ad2f44c14..921da1f7f 100644
--- a/scripts/test/shared.py
+++ b/scripts/test/shared.py
@@ -124,6 +124,11 @@ if not options.binaryen_root:
options.binaryen_test = os.path.join(options.binaryen_root, 'test')
+test_out = os.path.join(options.binaryen_root, 'out', 'test')
+if not os.path.exists(test_out):
+ os.makedirs(test_out)
+os.chdir(test_out)
+
# Finds the given executable 'program' in PATH.
# Operates like the Unix tool 'which'.
diff --git a/scripts/test/wasm2js.py b/scripts/test/wasm2js.py
index 39ba946fe..c1abaa8f9 100755
--- a/scripts/test/wasm2js.py
+++ b/scripts/test/wasm2js.py
@@ -86,7 +86,8 @@ def test_wasm2js_output():
# to enable ESM syntax and we're also passing a custom loader to handle the
# `spectest` and `env` modules in our tests.
if NODEJS:
- node = [NODEJS, '--experimental-modules', '--loader', './scripts/test/node-esm-loader.mjs']
+ loader = os.path.join(options.binaryen_root, 'scripts', 'test', 'node-esm-loader.mjs')
+ node = [NODEJS, '--experimental-modules', '--loader', loader]
cmd = node[:]
cmd.append('a.2asm.mjs')
out = run_command(cmd)
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 41fb245d4..d8f8163c4 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -4269,7 +4269,7 @@ void BinaryenSetAPITracing(int on) {
std::cout << "// beginning a Binaryen API trace\n"
"#include <math.h>\n"
"#include <map>\n"
- "#include \"src/binaryen-c.h\"\n"
+ "#include \"binaryen-c.h\"\n"
"int main() {\n"
" std::map<size_t, BinaryenFunctionTypeRef> functionTypes;\n"
" std::map<size_t, BinaryenExpressionRef> expressions;\n"
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 07a06b98b..b1f269a30 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -3421,7 +3421,7 @@ validation: 0
// beginning a Binaryen API trace
#include <math.h>
#include <map>
-#include "src/binaryen-c.h"
+#include "binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index d0582bd79..a46190fb4 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1960,7 +1960,7 @@ validation: 0
// beginning a Binaryen API trace
#include <math.h>
#include <map>
-#include "src/binaryen-c.h"
+#include "binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;