Skip to content

Commit

Permalink
test: clean up wasm fixtures
Browse files Browse the repository at this point in the history
PR-URL: #25360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
devsnek authored and addaleax committed Jan 8, 2019
1 parent c1aa5f0 commit c826af7
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 22 deletions.
Binary file added test/fixtures/shared-memory.wasm
Binary file not shown.
8 changes: 8 additions & 0 deletions test/fixtures/shared-memory.wat
Original file line number Diff line number Diff line change
@@ -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))
)
Binary file added test/fixtures/simple.wasm
Binary file not shown.
11 changes: 11 additions & 0 deletions test/fixtures/simple.wat
Original file line number Diff line number Diff line change
@@ -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))
)
Binary file removed test/fixtures/test.wasm
Binary file not shown.
10 changes: 0 additions & 10 deletions test/fixtures/test.wat

This file was deleted.

Binary file removed test/fixtures/wasm-threads-shared-memory.wasm
Binary file not shown.
4 changes: 0 additions & 4 deletions test/fixtures/wasm-threads-shared-memory.wat

This file was deleted.

2 changes: 1 addition & 1 deletion test/parallel/test-util-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ],
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions test/parallel/test-wasm-simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});
4 changes: 2 additions & 2 deletions test/parallel/test-worker-message-port-wasm-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-message-port-wasm-threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c826af7

Please sign in to comment.