mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +00:00
LibWasm+Meta: Add test-wasm and optionally test the conformance tests
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.
This commit is contained in:
parent
ba2fce14d3
commit
b3c13c3e8a
11 changed files with 207 additions and 1 deletions
23
Userland/Libraries/LibWasm/Tests/Parser/spec-testsuite.js
Normal file
23
Userland/Libraries/LibWasm/Tests/Parser/spec-testsuite.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
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);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue