diff --git a/test/fixtures/shared-memory.wasm b/test/fixtures/shared-memory.wasm new file mode 100644 index 00000000000..497b8440bd2 Binary files /dev/null and b/test/fixtures/shared-memory.wasm differ diff --git a/test/fixtures/shared-memory.wat b/test/fixtures/shared-memory.wat new file mode 100644 index 00000000000..9dbaf7fa7fe --- /dev/null +++ b/test/fixtures/shared-memory.wat @@ -0,0 +1,8 @@ +;; Compiled using the WebAssembly Tootkit (https://github.com/WebAssembly/wabt) +;; $ wat2wasm --enable-threads shared-memory.wat -o shared-memory.wasm + +(module + ;; Create shared memory with initial 1 page (64KiB) and max 1 page + (memory $mem 1 1 shared) + (export "memory" (memory $mem)) +) \ No newline at end of file diff --git a/test/fixtures/simple.wasm b/test/fixtures/simple.wasm new file mode 100644 index 00000000000..357f72da7a0 Binary files /dev/null and b/test/fixtures/simple.wasm differ diff --git a/test/fixtures/simple.wat b/test/fixtures/simple.wat new file mode 100644 index 00000000000..e3026bffe5a --- /dev/null +++ b/test/fixtures/simple.wat @@ -0,0 +1,11 @@ +;; Compiled using the WebAssembly Tootkit (https://github.com/WebAssembly/wabt) +;; $ wat2wasm simple.wat -o simple.wasm + +(module + (func $add (param $a i32) (param $b i32) (result i32) + ;; return $a + $b + (i32.add (get_local $a) (get_local $b)) + ) + + (export "add" (func $add)) +) diff --git a/test/fixtures/test.wasm b/test/fixtures/test.wasm deleted file mode 100644 index da1b0330069..00000000000 Binary files a/test/fixtures/test.wasm and /dev/null differ diff --git a/test/fixtures/test.wat b/test/fixtures/test.wat deleted file mode 100644 index fa90b17cce0..00000000000 --- a/test/fixtures/test.wat +++ /dev/null @@ -1,10 +0,0 @@ -;; Compiled using the WebAssembly Tootkit (https://github.com/WebAssembly/wabt) -;; $ wat2wasm test.wat -o test.wasm -(module - (func $add (export "add") (param $first i32) (param $second i32) (result i32) - get_local $first - get_local $second - (i32.add) - ) - (export "addTwo" (func $add)) -) diff --git a/test/fixtures/wasm-threads-shared-memory.wasm b/test/fixtures/wasm-threads-shared-memory.wasm deleted file mode 100644 index 24b4d691058..00000000000 Binary files a/test/fixtures/wasm-threads-shared-memory.wasm and /dev/null differ diff --git a/test/fixtures/wasm-threads-shared-memory.wat b/test/fixtures/wasm-threads-shared-memory.wat deleted file mode 100644 index 68a2698df65..00000000000 --- a/test/fixtures/wasm-threads-shared-memory.wat +++ /dev/null @@ -1,4 +0,0 @@ -(module - (memory $mem 1 2 shared) - (export "memory" (memory $mem)) -) \ No newline at end of file diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index eba8583ee70..19b265ca2a7 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -9,7 +9,7 @@ const { internalBinding } = require('internal/test/binding'); const { JSStream } = internalBinding('js_stream'); const external = (new JSStream())._externalStream; -const wasmBuffer = fixtures.readSync('test.wasm'); +const wasmBuffer = fixtures.readSync('simple.wasm'); for (const [ value, _method ] of [ [ external, 'isExternal' ], diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index 3f88503546f..def4914e2e4 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -12,7 +12,7 @@ const os = require('os'); const circular = {}; circular.circular = circular; -const wasmModule = new WebAssembly.Module(fixtures.readSync('test.wasm')); +const wasmModule = new WebAssembly.Module(fixtures.readSync('simple.wasm')); const objects = [ { foo: 'bar' }, @@ -238,5 +238,5 @@ const deserializerTypeError = { const deserializedWasmModule = v8.deserialize(v8.serialize(wasmModule)); const instance = new WebAssembly.Instance(deserializedWasmModule); - assert.strictEqual(instance.exports.addTwo(10, 20), 30); + assert.strictEqual(instance.exports.add(10, 20), 30); } diff --git a/test/parallel/test-wasm-simple.js b/test/parallel/test-wasm-simple.js index ebcb366d551..f769925be91 100644 --- a/test/parallel/test-wasm-simple.js +++ b/test/parallel/test-wasm-simple.js @@ -4,14 +4,14 @@ require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); -const buffer = fixtures.readSync('test.wasm'); +const buffer = fixtures.readSync('simple.wasm'); assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); WebAssembly.instantiate(buffer, {}).then((results) => { // Exported function should add two numbers. assert.strictEqual( - results.instance.exports.addTwo(10, 20), + results.instance.exports.add(10, 20), 30 ); }); diff --git a/test/parallel/test-worker-message-port-wasm-module.js b/test/parallel/test-worker-message-port-wasm-module.js index 43c12a85199..922d8b11a30 100644 --- a/test/parallel/test-worker-message-port-wasm-module.js +++ b/test/parallel/test-worker-message-port-wasm-module.js @@ -5,13 +5,13 @@ const assert = require('assert'); const fixtures = require('../common/fixtures'); const { Worker } = require('worker_threads'); -const wasmModule = new WebAssembly.Module(fixtures.readSync('test.wasm')); +const wasmModule = new WebAssembly.Module(fixtures.readSync('simple.wasm')); const worker = new Worker(` const { parentPort } = require('worker_threads'); parentPort.once('message', ({ wasmModule }) => { const instance = new WebAssembly.Instance(wasmModule); - parentPort.postMessage(instance.exports.addTwo(10, 20)); + parentPort.postMessage(instance.exports.add(10, 20)); }); `, { eval: true }); diff --git a/test/parallel/test-worker-message-port-wasm-threads.js b/test/parallel/test-worker-message-port-wasm-threads.js index 891da80e30a..90b18cd759f 100644 --- a/test/parallel/test-worker-message-port-wasm-threads.js +++ b/test/parallel/test-worker-message-port-wasm-threads.js @@ -8,7 +8,7 @@ const { MessageChannel, Worker } = require('worker_threads'); // through MessageChannels (without crashing). const fixtures = require('../common/fixtures'); -const wasmSource = fixtures.readSync('wasm-threads-shared-memory.wasm'); +const wasmSource = fixtures.readSync('shared-memory.wasm'); const wasmModule = new WebAssembly.Module(wasmSource); const instance = new WebAssembly.Instance(wasmModule);