From 4dbae087a1c842db94d5c1c61045d79e9daa4e2a Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 26 May 2016 10:38:48 +0200 Subject: [PATCH] Bug 1248555: run each WebAssembly spec test in its own script; r=mbx MozReview-Commit-ID: 3DsyJamjqKy --HG-- extra : rebase_source : 2d880e37e89f91ceb729b216fe7629ec6d26a13e --- js/src/jit-test/tests/wasm/spec.js | 24 +++++++---- .../jit-test/tests/wasm/spec/import_tests.sh | 6 +-- js/src/jit-test/tests/wasm/spec/list.js | 42 ------------------- 3 files changed, 19 insertions(+), 53 deletions(-) delete mode 100644 js/src/jit-test/tests/wasm/spec/list.js diff --git a/js/src/jit-test/tests/wasm/spec.js b/js/src/jit-test/tests/wasm/spec.js index 5e8ff783a36f..0aa7f5db49ed 100644 --- a/js/src/jit-test/tests/wasm/spec.js +++ b/js/src/jit-test/tests/wasm/spec.js @@ -1,5 +1,18 @@ load(libdir + "wasm.js"); -load(scriptdir + "spec/list.js"); + +// This is meant to be a small and dumb interpreter for wast files. Either it +// is imported by another script, which needs to define an array of arguments +// called importedArgs, or args need to be passed to the command line. +// +// Possible arguments include: +// -d enable debug verbose mode +// -c computes line numbers in wast files (disabled by default as it +// slows down the parser a lot) +// -s soft fail mode: if a test fails, don't abort but continue to +// the next one. +// * anything else is considered a relative path to the wast file to +// load and run. The path is relative to to the runner script, +// i.e. this file.. if (typeof assert === 'undefined') { var assert = function(c, msg) { @@ -295,7 +308,7 @@ function exec(e) { } } -var args = scriptArgs; +var args = typeof importedArgs !== 'undefined' ? importedArgs : scriptArgs; // Whether we should keep on executing tests if one of them failed or throw. var softFail = false; @@ -331,16 +344,13 @@ for (let arg of args) { } } -if (targets.length) - specTests = targets; - top_loop: -for (var test of specTests) { +for (var test of targets) { module = null; debug(`Running test ${test}...`); - let source = read(scriptdir + "spec/" + test); + let source = read(scriptdir + test); let root = new parseSExpression(source); diff --git a/js/src/jit-test/tests/wasm/spec/import_tests.sh b/js/src/jit-test/tests/wasm/spec/import_tests.sh index 89ef5e030885..a8428fcd1654 100755 --- a/js/src/jit-test/tests/wasm/spec/import_tests.sh +++ b/js/src/jit-test/tests/wasm/spec/import_tests.sh @@ -1,14 +1,12 @@ #!/bin/bash -rm -rf ./*.wast ./list.js +rm -rf ./*.wast ./list.js ./*.wast.js git clone https://github.com/WebAssembly/spec spec mv spec/ml-proto/test/*.wast ./ rm -rf spec/ -echo "// This is automatically generated by import_tests.sh. Do no modify by hand!" > list.js -echo "var specTests = [];" >> list.js for i in $(ls *.wast); do - echo "specTests.push(\"$i\");" >> list.js + echo "var importedArgs = ['$i']; load(scriptdir + '../spec.js');" > $i.js done; diff --git a/js/src/jit-test/tests/wasm/spec/list.js b/js/src/jit-test/tests/wasm/spec/list.js deleted file mode 100644 index b3ef0c23b4f5..000000000000 --- a/js/src/jit-test/tests/wasm/spec/list.js +++ /dev/null @@ -1,42 +0,0 @@ -// This is automatically generated by import_tests.sh. Do no modify by hand! -var specTests = []; -//specTests.push("address.wast"); // TODO wrapping offsets -//specTests.push("binary.wast"); // TODO binary text format -specTests.push("block_comments.wast"); -specTests.push("block.wast"); -specTests.push("break-drop.wast"); -//specTests.push("conversions.wast"); // TODO custom NaN -//specTests.push("endianness.wast"); // TODO i64 loads/stores -//specTests.push("exports.wast"); // TODO real memory exports -//specTests.push("f32_cmp.wast"); // TODO custom NaN -//specTests.push("f32.wast"); // TODO f32.trunc -//specTests.push("f64_cmp.wast"); // TODO custom NaN -//specTests.push("f64.wast"); // TODO f64.trunc -specTests.push("fac.wast"); -//specTests.push("float_exprs.wast"); // TODO custom NaN -//specTests.push("float_literals.wast"); // TODO custom NaN -//specTests.push("float_memory.wast"); // TODO custom NaN -//specTests.push("float_misc.wast"); // TODO copysign -specTests.push("forward.wast"); -//specTests.push("func_ptrs.wast"); // TODO pass table index in bad indirect error message -specTests.push("functions.wast"); -specTests.push("i32.wast"); -specTests.push("i64.wast"); -specTests.push("imports.wast"); -specTests.push("int_exprs.wast"); -specTests.push("int_literals.wast"); -//specTests.push("labels.wast"); // TODO br_if value/cond -//specTests.push("left-to-right.wast"); // TODO i64 loads/stores -specTests.push("memory_redundancy.wast"); -//specTests.push("memory_trap.wast"); // TODO current_memory opcode -//specTests.push("memory.wast"); // TODO alignment -specTests.push("names.wast"); -//specTests.push("nan-propagation.wast"); // TODO f32 trunc -//specTests.push("resizing.wast"); // TODO grow_memory opcode -specTests.push("runaway-recursion.wast"); -//specTests.push("select.wast"); // TODO custom NaN -//specTests.push("start.wast"); // TODO start opcode -//specTests.push("store_retval.wast"); // TODO i64 loads/stores -specTests.push("switch.wast"); -//specTests.push("traps.wast"); // TODO trap on OOB -specTests.push("unreachable.wast");