-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new testcases for instantiateStreaming, new Instance and expor…
…ts overwrite
- Loading branch information
Showing
14 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { delay } from '../../../dist/tests/test-utils.cjs' | ||
|
||
export default async function test(analyser) { | ||
const url = 'http://localhost:8000' | ||
await analyser.start(url, { headless: true }) | ||
await delay(100) | ||
return await analyser.stop() | ||
} |
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
tests/offline/basic-instantiateStreaming/website/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Worker test</title> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
WebAssembly.instantiateStreaming(fetch("add.wasm"), {}) | ||
.then((result) => console.log(`1 + 2 = ${result.instance.exports.add(1, 2)}`)); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { delay } from '../../../dist/tests/test-utils.cjs' | ||
|
||
export default async function test(analyser) { | ||
const url = 'http://localhost:8000' | ||
await analyser.start(url, { headless: true }) | ||
await delay(100) | ||
return await analyser.stop() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Worker test</title> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
fetch("add.wasm") | ||
.then((response) => response.arrayBuffer()) | ||
.then((bytes) => { | ||
const wasm = new WebAssembly.Instance(bytes, {}) | ||
console.log(`1 + 2 = ${wasm.instance.exports.add(1, 2)}`) | ||
}) | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { delay } from '../../../dist/tests/test-utils.cjs' | ||
|
||
export default async function test(analyser) { | ||
const url = 'http://localhost:8000' | ||
await analyser.start(url, { headless: true }) | ||
await delay(100) | ||
return await analyser.stop() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Worker test</title> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
fetch("mem.wasm") | ||
.then((response) => response.arrayBuffer()) | ||
.then((bytes) => WebAssembly.instantiate(bytes, {})) | ||
fetch("sub.wasm") | ||
.then((response) => response.arrayBuffer()) | ||
.then((bytes) => WebAssembly.instantiate(bytes, {})) | ||
.then((result) => { | ||
console.log(`9 - 3 = ${result.instance.exports.sub(9, 3)}`) | ||
if (analysis[0].Wasabi.module.memories.length === 0) { | ||
console.log('memory got overwritten') | ||
analysis[0].trace.push('Memory got overwritten! This trace event should not appear. If this test fails, webapps like sqllite will likely not work with wasm-r3') | ||
} else { | ||
console.log('memory is fine') | ||
} | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(module | ||
(memory (export "memory") 1) | ||
) |
Binary file not shown.