Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd391b5

Browse filesBrowse files
committed
test: wpt for Wasm jsapi including new ESM Integration tests
PR-URL: #59034 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 1a88acb commit cd391b5
Copy full SHA for cd391b5

124 files changed

+3,347-141Lines changed: 3347 additions & 141 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/common/wpt.js‎

Copy file name to clipboardExpand all lines: test/common/wpt.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ class WPTRunner {
922922
console.log(test.stack);
923923
}
924924
const command = `${process.execPath} ${process.execArgv}` +
925-
` ${require.main.filename} '${spec.filename}${spec.variant}'`;
925+
` ${require.main?.filename} '${spec.filename}${spec.variant}'`;
926926
console.log(`Command: ${command}\n`);
927927

928928
reportResult?.addSubtest(test.name, 'FAIL', test.message);
Collapse file

‎test/common/wpt/worker.js‎

Copy file name to clipboardExpand all lines: test/common/wpt/worker.js
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
'use strict';
22

3-
const { runInNewContext, runInThisContext } = require('vm');
3+
const {
4+
runInNewContext,
5+
runInThisContext,
6+
constants: { USE_MAIN_CONTEXT_DEFAULT_LOADER },
7+
} = require('vm');
48
const { setFlagsFromString } = require('v8');
59
const { parentPort, workerData } = require('worker_threads');
610

@@ -28,11 +32,14 @@ globalThis.fetch = function fetch(file) {
2832
};
2933

3034
if (workerData.initScript) {
31-
runInThisContext(workerData.initScript);
35+
runInThisContext(workerData.initScript, {
36+
importModuleDynamically: USE_MAIN_CONTEXT_DEFAULT_LOADER,
37+
});
3238
}
3339

3440
runInThisContext(workerData.harness.code, {
3541
filename: workerData.harness.filename,
42+
importModuleDynamically: USE_MAIN_CONTEXT_DEFAULT_LOADER,
3643
});
3744

3845
// eslint-disable-next-line no-undef
@@ -66,5 +73,8 @@ add_completion_callback((_, status) => {
6673
});
6774

6875
for (const scriptToRun of workerData.scriptsToRun) {
69-
runInThisContext(scriptToRun.code, { filename: scriptToRun.filename });
76+
runInThisContext(scriptToRun.code, {
77+
filename: scriptToRun.filename,
78+
importModuleDynamically: USE_MAIN_CONTEXT_DEFAULT_LOADER,
79+
});
7080
}
Collapse file

‎test/fixtures/wpt/README.md‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Last update:
3131
- url: https://github.com/web-platform-tests/wpt/tree/fc3e651593/url
3232
- urlpattern: https://github.com/web-platform-tests/wpt/tree/a2e15ad405/urlpattern
3333
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
34-
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
34+
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/65a2134d50/wasm/jsapi
3535
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
3636
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
3737
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/2cb332d710/WebCryptoAPI
Collapse file

‎test/fixtures/wpt/versions.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"path": "user-timing"
8585
},
8686
"wasm/jsapi": {
87-
"commit": "cde25e7e3c3b9d2280eb088a3fb9da988793d255",
87+
"commit": "65a2134d50",
8888
"path": "wasm/jsapi"
8989
},
9090
"wasm/webapi": {
Collapse file
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
features:
2+
- name: wasm
3+
files:
4+
- "*"
Collapse file

‎test/fixtures/wpt/wasm/jsapi/assertions.js‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/wasm/jsapi/assertions.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function assert_function_name(fn, name, description) {
66
assert_true(propdesc.configurable, "configurable", `${description} name should be configurable`);
77
assert_equals(propdesc.value, name, `${description} name should be ${name}`);
88
}
9+
globalThis.assert_function_name = assert_function_name;
910

1011
function assert_function_length(fn, length, description) {
1112
const propdesc = Object.getOwnPropertyDescriptor(fn, "length");
@@ -15,6 +16,7 @@ function assert_function_length(fn, length, description) {
1516
assert_true(propdesc.configurable, "configurable", `${description} length should be configurable`);
1617
assert_equals(propdesc.value, length, `${description} length should be ${length}`);
1718
}
19+
globalThis.assert_function_length = assert_function_length;
1820

1921
function assert_exported_function(fn, { name, length }, description) {
2022
if (WebAssembly.Function === undefined) {
@@ -28,6 +30,7 @@ function assert_exported_function(fn, { name, length }, description) {
2830
assert_function_name(fn, name, description);
2931
assert_function_length(fn, length, description);
3032
}
33+
globalThis.assert_exported_function = assert_exported_function;
3134

3235
function assert_Instance(instance, expected_exports) {
3336
assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype,
@@ -77,6 +80,7 @@ function assert_Instance(instance, expected_exports) {
7780
}
7881
}
7982
}
83+
globalThis.assert_Instance = assert_Instance;
8084

8185
function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
8286
assert_equals(Object.getPrototypeOf(actual), Object.prototype,
@@ -98,3 +102,4 @@ function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
98102
assert_true(instance.configurable, "instance: configurable");
99103
assert_Instance(instance.value, expected_exports);
100104
}
105+
globalThis.assert_WebAssemblyInstantiatedSource = assert_WebAssemblyInstantiatedSource;
Collapse file

‎test/fixtures/wpt/wasm/jsapi/bad-imports.js‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/wasm/jsapi/bad-imports.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,4 @@ function test_bad_imports(t) {
183183
});
184184
}
185185
}
186+
globalThis.test_bad_imports = test_bad_imports;
Collapse file
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
features:
2+
- name: wasm
3+
files:
4+
- "*"
5+
- "!multi-value.any.js"
6+
- name: wasm-multi-value
7+
files:
8+
- "multi-value.any.js"
Collapse file

‎test/fixtures/wpt/wasm/jsapi/constructor/compile.any.js‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/wasm/jsapi/constructor/compile.any.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// META: global=window,dedicatedworker,jsshell
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
22
// META: script=/wasm/jsapi/wasm-module-builder.js
33

44
function assert_Module(module) {
Collapse file

‎test/fixtures/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.js‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// META: global=window,dedicatedworker,jsshell
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
22
// META: script=/wasm/jsapi/wasm-module-builder.js
33
// META: script=/wasm/jsapi/bad-imports.js
44

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.