test: Add basic WebAssembly test#16760
Conversation
cd894c3 to
f8bc445
Compare
There was a problem hiding this comment.
Does this pass make lint? I think we have a rule against assert.equal (in favour of assert.strictEqual)
f8bc445 to
9538932
Compare
|
Isn't this just testing a strictly V8 feature? Wouldn't it be best to leave this to the V8 test suite? |
|
@mscdex It will also be testing |
There was a problem hiding this comment.
fixtures.readSync('simple.wasm') and then drop the fs module from the test?
9538932 to
70ab5a2
Compare
Tests a basic WebAssembly module that adds two numbers. wasm example from the WebAssembly/wabt repo licensed Apache 2.0. Refs: https://github.com/WebAssembly/wabt/blob/master/demo/wat2wasm/examples.js#L27-L32
70ab5a2 to
71036dd
Compare
|
|
||
| assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); | ||
|
|
||
| WebAssembly.instantiate(buffer, {}).then((results) => { |
There was a problem hiding this comment.
Nit: common.mustCall around the then would be better.
There was a problem hiding this comment.
oh, right … we might also want common.crashOnUnhandledRejection() to make sure it really crashes when the promise gets rejected
edit: this test might be trickier than first thought 😄
| assert.strictEqual( | ||
| results.instance.exports.addTwo(10, 20), | ||
| 30, | ||
| 'Exported function should add two numbers.', |
There was a problem hiding this comment.
Suggestion: it would likely be better to either omit the message here or include the expected and actual values in the message.
There was a problem hiding this comment.
is this worth blocking on or should we land and fix in a follow up?
Tests a basic WebAssembly module that adds two numbers. wasm example from the WebAssembly/wabt repo licensed Apache 2.0. Refs: https://github.com/WebAssembly/wabt/blob/49b7984544ddaf14d5e2f1ad9115dad7e9a2b299/demo/wat2wasm/examples.js#L27-L32 PR-URL: #16760 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Tests a basic WebAssembly module that adds two numbers. wasm example from the WebAssembly/wabt repo licensed Apache 2.0. Refs: https://github.com/WebAssembly/wabt/blob/49b7984544ddaf14d5e2f1ad9115dad7e9a2b299/demo/wat2wasm/examples.js#L27-L32 PR-URL: #16760 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Tests a basic WebAssembly module that adds two numbers. wasm example from the WebAssembly/wabt repo licensed Apache 2.0. Refs: https://github.com/WebAssembly/wabt/blob/49b7984544ddaf14d5e2f1ad9115dad7e9a2b299/demo/wat2wasm/examples.js#L27-L32 PR-URL: #16760 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Tests a basic WebAssembly module that adds two numbers. wasm example from the WebAssembly/wabt repo licensed Apache 2.0. Refs: https://github.com/WebAssembly/wabt/blob/49b7984544ddaf14d5e2f1ad9115dad7e9a2b299/demo/wat2wasm/examples.js#L27-L32 PR-URL: #16760 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>

Tests a basic WebAssembly module that adds two numbers.
wasm example from the WebAssembly/wabt repo licensed Apache 2.0.
Not sure if there are licensing concerns. Please let me know if we need to add anything else.
Refs: https://github.com/WebAssembly/wabt/blob/master/demo/wat2wasm/examples.js#L27-L32
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test