Skip to content

Commit

Permalink
chore: move test_util/wpt to tests/wpt/suite (#22412)
Browse files Browse the repository at this point in the history
As discussed with @mmastrac. I'll move `tools/wpt` to `tests/wpt` in a
follow-up PR.

---------

Co-authored-by: Matt Mastracci <[email protected]>
  • Loading branch information
iuioiua and mmastrac committed Feb 16, 2024
1 parent 4f80d83 commit 5596de8
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,7 @@
"target",
"tests/ffi/tests/test.js",
"tests/util/std",
"test_util/wpt",
"tests/wpt/suite",
"third_party",
"tools/node_compat/TODO.md",
"tools/node_compat/node",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 447,7 @@ const ci = {
...cloneRepoStep,
submoduleStep("./tests/util/std"),
{
...submoduleStep("./test_util/wpt"),
...submoduleStep("./tests/wpt/suite"),
if: "matrix.wpt",
},
{
Expand Down Expand Up @@ -833,7 833,7 @@ const ci = {
name: "Configure hosts file for WPT",
if: "matrix.wpt",
run: "./wpt make-hosts-file | sudo tee -a /etc/hosts",
"working-directory": "test_util/wpt/",
"working-directory": "tests/wpt/suite/",
},
{
name: "Run web platform tests (debug)",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 152,8 @@ jobs:
- name: Clone submodule ./tests/util/std
run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
if: '!(matrix.skip)'
- name: Clone submodule ./test_util/wpt
run: git submodule update --init --recursive --depth=1 -- ./test_util/wpt
- name: Clone submodule ./tests/wpt/suite
run: git submodule update --init --recursive --depth=1 -- ./tests/wpt/suite
if: '!(matrix.skip) && (matrix.wpt)'
- name: Clone submodule ./tools/node_compat/node
run: git submodule update --init --recursive --depth=1 -- ./tools/node_compat/node
Expand Down Expand Up @@ -506,7 506,7 @@ jobs:
- name: Configure hosts file for WPT
if: '!(matrix.skip) && (matrix.wpt)'
run: ./wpt make-hosts-file | sudo tee -a /etc/hosts
working-directory: test_util/wpt/
working-directory: tests/wpt/suite/
- name: Run web platform tests (debug)
if: '!(matrix.skip) && (matrix.wpt && matrix.profile == ''debug'')'
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wpt_epoch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 45,7 @@ jobs:
deno --version
- name: Switch WPT submodule to epochs/daily
working-directory: test_util/wpt/
working-directory: tests/wpt/suite/
shell: bash
run: |
git remote set-branches origin '*'
Expand All @@ -55,12 55,12 @@ jobs:
- name: Configure hosts file for WPT (unix)
if: runner.os != 'Windows'
working-directory: test_util/wpt/
working-directory: tests/wpt/suite/
run: ./wpt make-hosts-file | sudo tee -a /etc/hosts

- name: Configure hosts file for WPT (windows)
if: runner.os == 'Windows'
working-directory: test_util/wpt/
working-directory: tests/wpt/suite/
run: python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts -Encoding ascii -Append

- name: Run web platform tests
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 2,8 @@
path = tests/util/std
url = https://github.com/denoland/deno_std
shallow = true
[submodule "test_util/wpt"]
path = test_util/wpt
[submodule "tests/wpt/suite"]
path = tests/wpt/suite
url = https://github.com/web-platform-tests/wpt.git

[submodule "tools/node_compat/node"]
Expand Down
2 changes: 1 addition & 1 deletion tools/copyright_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 29,7 @@ export async function checkCopyright() {
":!:cli/tsc/dts/**",
":!:cli/tsc/*typescript.js",
":!:cli/tsc/compiler.d.ts",
":!:test_util/wpt/**",
":!:tests/wpt/suite/**",
":!:cli/tools/init/templates/**",
":!:tests/unit_node/testdata/**",
":!:tests/node_compat/test/**",
Expand Down
16 changes: 15 additions & 1 deletion tools/deno.lock.json
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
{
"version": "2",
"version": "3",
"remote": {
"https://cdn.skypack.dev/-/@octokit/[email protected]/dist=es2019,mode=imports/optimized/@octokit/auth-token.js": "5247df74f0bd63d994d1ab5b52265761cf2eb1b67f12171a030ebef4027d5eb6",
"https://cdn.skypack.dev/-/@octokit/[email protected]/dist=es2019,mode=imports/optimized/@octokit/core.js": "a1f82f18dccc5b09d753690a8addd839e4fe0b5a6f6831b17437f136c8921db3",
Expand Down Expand Up @@ -108,6 108,7 @@
"https://deno.land/[email protected]/path/win32.ts": "2edb2f71f10578ee1168de01a8cbd3c65483e45a46bc2fa3156a0c6bfbd2720d",
"https://deno.land/[email protected]/testing/_diff.ts": "ccd6c3af6e44c74bf1591acb1361995f5f50df64323a6e7fb3f16c8ea792c940",
"https://deno.land/[email protected]/testing/asserts.ts": "6b0d6ba564bdff807bd0f0e93e02c48aa3177acf19416bf84a7f420191ef74cd",
"https://deno.land/[email protected]/fmt/colors.ts": "03ad95e543d2808bc43c17a3dd29d25b43d0f16287fe562a0be89bf632454a12",
"https://deno.land/[email protected]/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462",
"https://deno.land/[email protected]/bytes/bytes_list.ts": "b4cbdfd2c263a13e8a904b12d082f6177ea97d9297274a4be134e989450dfa6a",
"https://deno.land/[email protected]/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2",
Expand Down Expand Up @@ -261,6 262,19 @@
"https://deno.land/x/[email protected]/src/parser.ts": "bda4ab4a1c9a2e156877f33ee4e60caac935a7c995a86bbe026bdc0f0d31b8c1",
"https://deno.land/x/[email protected]/data_local_dir/mod.ts": "91eb1c4bfadfbeda30171007bac6d85aadacd43224a5ed721bbe56bc64e9eb66",
"https://deno.land/x/[email protected]/src/index.ts": "6dc3df4108d5d6fedcdb974844d321037ca81eaaa16be6073235ff3268841a22",
"https://deno.land/x/[email protected]/ansi_regex.ts": "1d3b0c7289164f93c9ebafe3bbd05a723568a250cc5c29c0cc922ff55af9a238",
"https://deno.land/x/[email protected]/combining.ts": "a615e9479d8bc901e3a727e5cae83c0aa1d4ca1e75fa040861d9905d16b30ffc",
"https://deno.land/x/[email protected]/is_interactive.ts": "37080d92399827215e60a57d97013aefbdbc038e7a5d2346abd298a7010525e6",
"https://deno.land/x/[email protected]/mod.ts": "65f44c03d7c3daee2b87c6a2a20b0653dec9e3b4ece8183bb0a82233a0e05ff0",
"https://deno.land/x/[email protected]/strip_ansi.ts": "6671d8d44da192a713aac06fb9a0959a3c0b11a161438fdf540856e2208857d9",
"https://deno.land/x/[email protected]/tty_async.ts": "cbcdc8132754084153680dd3fbc73acb58e0b9232aff09897a46edcf6f637967",
"https://deno.land/x/[email protected]/tty_sync.ts": "ad5d986dbd561e5768c49bf48a54580521bdfe95aa41869e8c84d99dbae0ff08",
"https://deno.land/x/[email protected]/util.ts": "fd50eb009b46f01461f3d38decaf4366c4970bbd818edc39b58a574efe67dbb7",
"https://deno.land/x/[email protected]/wcwidth.ts": "ab712adbbe4a07c27cc0ab89b99c3a77d28fe911c0fd1c8cebd867efc1fb4416",
"https://deno.land/x/[email protected]/deps.ts": "df762b698a00cd71463cf24cea0737d5ae49f50957c9cfcc15f7e15a5a5cad9f",
"https://deno.land/x/[email protected]/log_symbols.ts": "cdf2d0aa44754d10fddd55999e933886a4d753f2acfc1219f629427ccc776ac7",
"https://deno.land/x/[email protected]/mod.ts": "83211441439cd0f794f4e95fbb6c766929dd6886169100d3bdf2ea1ea5e3adfe",
"https://deno.land/x/[email protected]/spinners.ts": "289346d54f8d6152a5dcd67b67e47784cf9b7a8a8f6f0b6dc041ebc2ef6bb76c",
"https://deno.land/x/[email protected]/mod.ts": "fd5335ef1c89bda4c7942d69dd8f895270207ba0384a97c4862ac65bba1f2343",
"https://raw.githubusercontent.com/denoland/automation/0.19.0/cargo.ts": "c686a658dca9ef5865a67ed3967affdc0d3e30c1b0b98ac85e17bf11843b46c2",
"https://raw.githubusercontent.com/denoland/automation/0.19.0/crate.ts": "47f0504eca340db871d5978915b2700345cfdd1d2875bd8dd86dbe828dc9cfca",
Expand Down
2 changes: 1 addition & 1 deletion tools/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 59,7 @@ async function dlint() {
":!:tests/testdata/test/glob/**",
":!:cli/tsc/*typescript.js",
":!:cli/tsc/compiler.d.ts",
":!:test_util/wpt/**",
":!:tests/wpt/suite/**",
]);

if (!sourceFiles.length) {
Expand Down
4 changes: 2 additions & 2 deletions tools/wpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 149,15 @@ async function setup() {
if (Deno.build.os == "windows") {
console.log("To do this run the following command in PowerShell:");
console.log("");
console.log(" cd test_util/wpt/");
console.log(" cd tests/wpt/suite/");
console.log(
" python.exe wpt make-hosts-file | Out-File $env:SystemRoot\\System32\\drivers\\etc\\hosts -Encoding ascii -Append",
);
console.log("");
} else {
console.log("To do this run the following command in your shell:");
console.log("");
console.log(" cd test_util/wpt/");
console.log(" cd tests/wpt/suite/");
console.log(
" python3 ./wpt make-hosts-file | sudo tee -a /etc/hosts",
);
Expand Down
10 changes: 5 additions & 5 deletions tools/wpt/certs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 18,13 @@ index 87a8cc9cc7..bbf500d8ca 100644
"duration": duration,
```

2. `cd test_util/wpt/`
2. `cd tests/wpt/suite/`
3. `./wpt serve --config tools/certs/config.json`
4. Run:

```
cp test_util/wpt/tools/certs/cacert.key tools/wpt/certs/cacert.key
cp test_util/wpt/tools/certs/cacert.pem tools/wpt/certs/cacert.pem
cp test_util/wpt/tools/certs/web-platform.test.key tools/wpt/certs/web-platform.test.key
cp test_util/wpt/tools/certs/web-platform.test.pem tools/wpt/certs/web-platform.test.pem
cp tests/wpt/suite/tools/certs/cacert.key tools/wpt/certs/cacert.key
cp tests/wpt/suite/tools/certs/cacert.pem tools/wpt/certs/cacert.pem
cp tests/wpt/suite/tools/certs/web-platform.test.key tools/wpt/certs/web-platform.test.key
cp tests/wpt/suite/tools/certs/web-platform.test.pem tools/wpt/certs/web-platform.test.pem
```
6 changes: 3 additions & 3 deletions tools/wpt/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 3,9 @@
"ssl": {
"type": "pregenerated",
"pregenerated": {
"ca_cert_path": "../../tools/wpt/certs/cacert.pem",
"host_cert_path": "../../tools/wpt/certs/web-platform.test.pem",
"host_key_path": "../../tools/wpt/certs/web-platform.test.key"
"ca_cert_path": "../../../tools/wpt/certs/cacert.pem",
"host_cert_path": "../../../tools/wpt/certs/web-platform.test.pem",
"host_key_path": "../../../tools/wpt/certs/web-platform.test.key"
}
}
}
14 changes: 11 additions & 3 deletions tools/wpt/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@ export async function runWithTestUtil<T>(
"wpt",
"serve",
"--config",
"../../tools/wpt/config.json",
"../../../tools/wpt/config.json",
], {
stdout: verbose ? "inherit" : "piped",
stderr: verbose ? "inherit" : "piped",
Expand All @@ -31,7 31,11 @@ export async function runWithTestUtil<T>(
}
const passedTime = performance.now() - start;
if (passedTime > 15000) {
proc.kill("SIGINT");
try {
proc.kill("SIGINT");
} catch {
// Might have already died
}
await proc.status;
throw new Error("Timed out while trying to start wpt test util.");
}
Expand All @@ -43,7 47,11 @@ export async function runWithTestUtil<T>(
return await f();
} finally {
if (verbose) console.log("Killing wpt test util.");
proc.kill("SIGINT");
try {
proc.kill("SIGINT");
} catch {
// Might have already died
}
await proc.status;
}
}
Expand Down
6 changes: 3 additions & 3 deletions tools/wpt/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 130,7 @@ export function runPy<T extends Omit<Deno.CommandOptions, "cwd">>(
stdout: "inherit",
stderr: "inherit",
...options,
cwd: join(ROOT_PATH, "./test_util/wpt/"),
cwd: join(ROOT_PATH, "./tests/wpt/suite/"),
}).spawn();
}

Expand Down Expand Up @@ -181,13 181,13 @@ export async function generateRunInfo(): Promise<unknown> {
};
const proc = await new Deno.Command("git", {
args: ["rev-parse", "HEAD"],
cwd: join(ROOT_PATH, "test_util", "wpt"),
cwd: join(ROOT_PATH, "tests", "wpt", "suite"),
stderr: "inherit",
}).output();
const revision = (new TextDecoder().decode(proc.stdout)).trim();
const proc2 = await new Deno.Command(denoBinary(), {
args: ["eval", "console.log(JSON.stringify(Deno.version))"],
cwd: join(ROOT_PATH, "test_util", "wpt"),
cwd: join(ROOT_PATH, "tests", "wpt", "suite"),
}).output();
const version = JSON.parse(new TextDecoder().decode(proc2.stdout));
const runInfo = {
Expand Down

0 comments on commit 5596de8

Please sign in to comment.