
This only tests "can it be parsed", but the goal of this commit is to provide a test framework that can be built upon :) The conformance tests are downloaded, compiled* and installed only if the INCLUDE_WASM_SPEC_TESTS cmake option is enabled. (*) Since we do not yet have a wast parser, the compilation is delegated to an external tool from binaryen, `wasm-as`, which is required for the test suite download/install to succeed. This *does* run the tests in CI, but it currently does not include the spec conformance tests.
23 lines
934 B
JavaScript
23 lines
934 B
JavaScript
let haveSpecTestSuite = false;
|
|
try {
|
|
readBinaryWasmFile("Fixtures/SpecTests/address.wasm");
|
|
haveSpecTestSuite = true;
|
|
} catch {}
|
|
|
|
let testFunction = haveSpecTestSuite ? test : test.skip;
|
|
|
|
// prettier-ignore
|
|
const tests = [
|
|
"address", "align", "binary", "binary-leb128", "br_table", "comments", "endianness", "exports",
|
|
"f32", "f32_bitwise", "f32_cmp", "f64", "f64_bitwise", "f64_cmp", "float_exprs", "float_literals",
|
|
"float_memory", "float_misc", "forward", "func_ptrs", "int_exprs", "int_literals", "labels",
|
|
"left-to-right", "linking", "load", "local_get", "memory", "memory_grow", "memory_redundancy",
|
|
"memory_size", "memory_trap", "names", "return", "switch", "table", "traps", "type"
|
|
];
|
|
|
|
for (let testName of tests) {
|
|
testFunction(`parse ${testName}`, () => {
|
|
const contents = readBinaryWasmFile(`Fixtures/SpecTests/${testName}.wasm`);
|
|
parseWebAssemblyModule(contents);
|
|
});
|
|
}
|