From 2010c617adfff4dbbb7b4c6bd6b3b805c5ea78dc Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Tue, 10 Dec 2024 03:48:15 +0100 Subject: [PATCH] Fix memory64 tests (#3702) 1) Use 'address' instead of 'index'; this was a last-minute change, see https://github.com/WebAssembly/memory64/pull/90 and https://github.com/WebAssembly/memory64/pull/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'}. --- sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html | 5 +++-- .../conformance2/wasm/buffersubdata-16gb-wasm-memory.html | 5 +++-- .../conformance2/wasm/getbuffersubdata-16gb-wasm-memory.html | 5 +++-- sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html | 5 +++-- sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html | 5 +++-- .../conformance2/wasm/texsubimage2d-16gb-wasm-memory.html | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html index 92228903d..71907e325 100644 --- a/sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/bufferdata-16gb-wasm-memory.html @@ -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; } diff --git a/sdk/tests/conformance2/wasm/buffersubdata-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/buffersubdata-16gb-wasm-memory.html index 284840e5d..386d9a226 100644 --- a/sdk/tests/conformance2/wasm/buffersubdata-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/buffersubdata-16gb-wasm-memory.html @@ -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; } diff --git a/sdk/tests/conformance2/wasm/getbuffersubdata-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/getbuffersubdata-16gb-wasm-memory.html index 42bfa781a..fdc22d5f1 100644 --- a/sdk/tests/conformance2/wasm/getbuffersubdata-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/getbuffersubdata-16gb-wasm-memory.html @@ -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; } diff --git a/sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html index 844e0881b..cf6509e99 100644 --- a/sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/readpixels-16gb-wasm-memory.html @@ -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; } diff --git a/sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html index 791cc579b..0f03d829d 100644 --- a/sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/teximage2d-16gb-wasm-memory.html @@ -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; } diff --git a/sdk/tests/conformance2/wasm/texsubimage2d-16gb-wasm-memory.html b/sdk/tests/conformance2/wasm/texsubimage2d-16gb-wasm-memory.html index 4af628139..b28924b06 100644 --- a/sdk/tests/conformance2/wasm/texsubimage2d-16gb-wasm-memory.html +++ b/sdk/tests/conformance2/wasm/texsubimage2d-16gb-wasm-memory.html @@ -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; }