Skip to content

Commit

Permalink
Fix memory64 tests (#3702)
Browse files Browse the repository at this point in the history
1) Use 'address' instead of 'index'; this was a last-minute change, see
   WebAssembly/memory64#90 and
   WebAssembly/memory64#92.
2) Only treat RangeError as passing test.

Note that the tests were passing before because engines threw a
TypeError if the memory descriptor used bigints without specifying
{address: 'i64'}.
  • Loading branch information
backes authored Dec 10, 2024
1 parent c5f8d7b commit 2010c61
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down
5 changes: 3 additions & 2 deletions sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down
5 changes: 3 additions & 2 deletions sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
(() => {
let view;
try {
view = new Uint8Array(new WebAssembly.Memory({ index: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
view = new Uint8Array(new WebAssembly.Memory({ address: 'i64', initial: BigInt(SIZE / PAGE) }).buffer);
} catch (e) {
testPassed(`Allocating ${SIZE} threw: ${e}`);
let fn = e instanceof RangeError ? testPassed : testFailed;
fn(`Allocating ${SIZE} threw: ${e}`);
return;
}

Expand Down

0 comments on commit 2010c61

Please sign in to comment.