FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalys...
[WebKit-https.git] / JSTests / wasm / wast-tests / harness.js
1 asyncTestStart(1);
2 let context = {
3     env: globalThis,
4 };
5
6 globalThis.__linear_memory = new WebAssembly.Memory({ initial: 1 });
7
8 async function runWasmFile(filePath) {
9     let blob = readFile(filePath, "binary");
10     let instance;
11     let result;
12     try {
13         let compiled = await WebAssembly.instantiate(blob, context);
14         instance = compiled.instance;
15         result = instance.exports.test();
16
17         if (instance.exports.checkResult && !instance.exports.checkResult(result))
18             throw new Error("Got result " + result + " but checkResult returned false");
19     } catch (e) {
20         print(e);
21         throw e;
22     }
23
24     asyncTestPassed();
25 }
26
27 for (wasmFile of arguments)
28     runWasmFile(wasmFile);