From 0c8dedd103f78e3f6f9cc907240b9beaabdf12c3 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sat, 5 Jan 2019 18:58:16 -0600 Subject: [PATCH] test: clean up wasm fixtures PR-URL: https://github.com/nodejs/node/pull/25360 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/fixtures/shared-memory.wasm | Bin 0 -> 26 bytes test/fixtures/shared-memory.wat | 8 ++++++++ test/fixtures/simple.wasm | Bin 0 -> 41 bytes test/fixtures/simple.wat | 11 +++++++++++ test/fixtures/test.wasm | Bin 50 -> 0 bytes test/fixtures/test.wat | 10 ---------- test/fixtures/wasm-threads-shared-memory.wasm | Bin 36 -> 0 bytes test/fixtures/wasm-threads-shared-memory.wat | 4 ---- test/parallel/test-util-types.js | 2 +- test/parallel/test-v8-serdes.js | 4 ++-- test/parallel/test-wasm-simple.js | 4 ++-- .../test-worker-message-port-wasm-module.js | 4 ++-- .../test-worker-message-port-wasm-threads.js | 2 +- 13 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 test/fixtures/shared-memory.wasm create mode 100644 test/fixtures/shared-memory.wat create mode 100644 test/fixtures/simple.wasm create mode 100644 test/fixtures/simple.wat delete mode 100644 test/fixtures/test.wasm delete mode 100644 test/fixtures/test.wat delete mode 100644 test/fixtures/wasm-threads-shared-memory.wasm delete mode 100644 test/fixtures/wasm-threads-shared-memory.wat diff --git a/test/fixtures/shared-memory.wasm b/test/fixtures/shared-memory.wasm new file mode 100644 index 0000000000000000000000000000000000000000..497b8440bd212e14fe51694b9c0e0fddf31f975f GIT binary patch literal 26 hcmZQbEY4+QU|?WnVPs}xWanaJ%T3MAFREl>001se1O)&9 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..357f72da7a0db8add83699082fd51d46bf3352fb GIT binary patch literal 41 wcmZQbEY4+QU|?WmXG~zKuV<`hW@2PuXJ=$iOi5v2;NoOtXHZ~JV9eqM0DJxgJ^%m! literal 0 HcmV?d00001 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 da1b0330069de60ad944216d8fd1ba403dd3f761..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmZQbEY4+QU|?WmXG~zKuV<`hW@2Pu7hqyeOi5v2U;~mN<@pQ@T%3&T3VBlcMOUzAWVq^dSU { // 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);