blob: d845f502c7be0367098f5ce7de6cb7dc8b403203 [file] [log] [blame]
asyncTestStart(1);
let context = {
env: globalThis,
};
globalThis.__linear_memory = new WebAssembly.Memory({ initial: 1 });
globalThis.callerIsOMGCompiled = callerIsBBQOrOMGCompiled; // Can't change the .wast easily...
async function runWasmFile(filePath) {
let blob = readFile(filePath, "binary");
let instance;
let result;
try {
let compiled = await WebAssembly.instantiate(blob, context);
instance = compiled.instance;
result = instance.exports.test();
if (instance.exports.checkResult && !instance.exports.checkResult(result))
throw new Error("Got result " + result + " but checkResult returned false");
} catch (e) {
print(e);
throw e;
}
asyncTestPassed();
}
for (wasmFile of arguments)
runWasmFile(wasmFile);