From 0022c35a237773b50a771b0fef48cac734f7a9d6 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Tue, 5 Mar 2024 11:41:16 +1100 Subject: [PATCH] chore: move `tools/wpt` to `tests/wpt/runner` (#22545) Towards #22525 --------- Signed-off-by: Asher Gomez Co-authored-by: Matt Mastracci --- .dprint.json | 4 ++-- .github/workflows/ci.generate.ts | 8 ++++---- .github/workflows/ci.yml | 8 ++++---- .github/workflows/wpt_epoch.yml | 4 ++-- .gitignore | 6 +++--- .../wpt => tests/wpt/runner}/certs/README.md | 8 ++++---- .../wpt => tests/wpt/runner}/certs/cacert.key | 0 .../wpt => tests/wpt/runner}/certs/cacert.pem | 0 .../wpt/runner}/certs/web-platform.test.key | 0 .../wpt/runner}/certs/web-platform.test.pem | 0 tests/wpt/runner/config.json | 11 +++++++++++ .../wpt => tests/wpt/runner}/expectation.json | 0 {tools/wpt => tests/wpt/runner}/runner.ts | 14 ++++++++++---- .../wpt/runner}/testharnessreport.js | 0 {tools/wpt => tests/wpt/runner}/utils.ts | 8 ++++---- {tools => tests/wpt}/wpt.ts | 18 ++++++------------ tools/wpt/config.json | 11 ----------- 17 files changed, 50 insertions(+), 50 deletions(-) rename {tools/wpt => tests/wpt/runner}/certs/README.md (65%) rename {tools/wpt => tests/wpt/runner}/certs/cacert.key (100%) rename {tools/wpt => tests/wpt/runner}/certs/cacert.pem (100%) rename {tools/wpt => tests/wpt/runner}/certs/web-platform.test.key (100%) rename {tools/wpt => tests/wpt/runner}/certs/web-platform.test.pem (100%) create mode 100644 tests/wpt/runner/config.json rename {tools/wpt => tests/wpt/runner}/expectation.json (100%) rename {tools/wpt => tests/wpt/runner}/runner.ts (95%) rename {tools/wpt => tests/wpt/runner}/testharnessreport.js (100%) rename {tools/wpt => tests/wpt/runner}/utils.ts (94%) rename {tools => tests/wpt}/wpt.ts (98%) delete mode 100644 tools/wpt/config.json diff --git a/.dprint.json b/.dprint.json index 7e64267cab..76c84b68b1 100644 --- a/.dprint.json +++ b/.dprint.json @@ -51,8 +51,8 @@ "third_party", "tools/node_compat/TODO.md", "tools/node_compat/node", - "tools/wpt/expectation.json", - "tools/wpt/manifest.json", + "tests/wpt/runner/expectation.json", + "tests/wpt/runner/manifest.json", "ext/websocket/autobahn/reports" ], "plugins": [ diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index b2a8c99c96..8ad59150b5 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -850,11 +850,11 @@ const ci = { "deno run --allow-env --allow-net --allow-read --allow-run \\", " --allow-write --unstable \\", " --lock=tools/deno.lock.json \\", - " ./tools/wpt.ts setup", + " ./tests/wpt/runner/runner.ts setup", "deno run --allow-env --allow-net --allow-read --allow-run \\", " --allow-write --unstable \\", " --lock=tools/deno.lock.json \\", - ' ./tools/wpt.ts run --quiet --binary="$DENO_BIN"', + ' ./tests/wpt/runner/runner.ts run --quiet --binary="$DENO_BIN"', ].join("\n"), }, { @@ -867,11 +867,11 @@ const ci = { "deno run --allow-env --allow-net --allow-read --allow-run \\", " --allow-write --unstable \\", " --lock=tools/deno.lock.json \\", - " ./tools/wpt.ts setup", + " ./tests/wpt/runner/runner.ts setup", "deno run --allow-env --allow-net --allow-read --allow-run \\", " --allow-write --unstable \\", " --lock=tools/deno.lock.json \\", - " ./tools/wpt.ts run --quiet --release \\", + " ./tests/wpt/runner/runner.ts run --quiet --release \\", ' --binary="$DENO_BIN" \\', " --json=wpt.json \\", " --wptreport=wptreport.json", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b36195beb5..7a5f2ce647 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -519,11 +519,11 @@ jobs: deno run --allow-env --allow-net --allow-read --allow-run \ --allow-write --unstable \ --lock=tools/deno.lock.json \ - ./tools/wpt.ts setup + ./tests/wpt/runner/runner.ts setup deno run --allow-env --allow-net --allow-read --allow-run \ --allow-write --unstable \ --lock=tools/deno.lock.json \ - ./tools/wpt.ts run --quiet --binary="$DENO_BIN" + ./tests/wpt/runner/runner.ts run --quiet --binary="$DENO_BIN" - name: Run web platform tests (release) if: '!(matrix.skip) && (matrix.wpt && matrix.profile == ''release'')' env: @@ -532,11 +532,11 @@ jobs: deno run --allow-env --allow-net --allow-read --allow-run \ --allow-write --unstable \ --lock=tools/deno.lock.json \ - ./tools/wpt.ts setup + ./tests/wpt/runner/runner.ts setup deno run --allow-env --allow-net --allow-read --allow-run \ --allow-write --unstable \ --lock=tools/deno.lock.json \ - ./tools/wpt.ts run --quiet --release \ + ./tests/wpt/runner/runner.ts run --quiet --release \ --binary="$DENO_BIN" \ --json=wpt.json \ --wptreport=wptreport.json diff --git a/.github/workflows/wpt_epoch.yml b/.github/workflows/wpt_epoch.yml index 2bc4472b15..359c8ef270 100644 --- a/.github/workflows/wpt_epoch.yml +++ b/.github/workflows/wpt_epoch.yml @@ -68,10 +68,10 @@ jobs: run: | deno run --unstable --allow-write --allow-read --allow-net \ --allow-env --allow-run --lock=tools/deno.lock.json \ - ./tools/wpt.ts setup + ./tests/wpt/runner/runner.ts setup deno run --unstable --allow-write --allow-read --allow-net \ --allow-env --allow-run --lock=tools/deno.lock.json \ - ./tools/wpt.ts run \ + ./tests/wpt/runner/runner.ts run \ \ --binary=$(which deno) --quiet --release --no-ignore --json=wpt.json --wptreport=wptreport.json - name: Upload wpt results to wpt.fyi diff --git a/.gitignore b/.gitignore index 37f568324f..8be7f979d1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ gclient_config.py_entries /target/ /std/hash/_wasm/target -/tools/wpt/manifest.json +/tests/wpt/runner/manifest.json /third_party/ /tests/napi/node_modules /tests/napi/build @@ -25,8 +25,8 @@ gclient_config.py_entries /flamegraph*.svg # WPT generated cert files -/tools/wpt/certs/index.txt* -/tools/wpt/certs/serial* +/tests/wpt/runner/certs/index.txt* +/tests/wpt/runner/certs/serial* /ext/websocket/autobahn/reports diff --git a/tools/wpt/certs/README.md b/tests/wpt/runner/certs/README.md similarity index 65% rename from tools/wpt/certs/README.md rename to tests/wpt/runner/certs/README.md index c2d74ee3dc..f3ebfc6526 100644 --- a/tools/wpt/certs/README.md +++ b/tests/wpt/runner/certs/README.md @@ -23,8 +23,8 @@ index 87a8cc9cc7..bbf500d8ca 100644 4. Run: ``` -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 +cp tests/wpt/suite/tools/certs/cacert.key tests/wpt/runner/certs/cacert.key +cp tests/wpt/suite/tools/certs/cacert.pem tests/wpt/runner/certs/cacert.pem +cp tests/wpt/suite/tools/certs/web-platform.test.key tests/wpt/runner/certs/web-platform.test.key +cp tests/wpt/suite/tools/certs/web-platform.test.pem tests/wpt/runner/certs/web-platform.test.pem ``` diff --git a/tools/wpt/certs/cacert.key b/tests/wpt/runner/certs/cacert.key similarity index 100% rename from tools/wpt/certs/cacert.key rename to tests/wpt/runner/certs/cacert.key diff --git a/tools/wpt/certs/cacert.pem b/tests/wpt/runner/certs/cacert.pem similarity index 100% rename from tools/wpt/certs/cacert.pem rename to tests/wpt/runner/certs/cacert.pem diff --git a/tools/wpt/certs/web-platform.test.key b/tests/wpt/runner/certs/web-platform.test.key similarity index 100% rename from tools/wpt/certs/web-platform.test.key rename to tests/wpt/runner/certs/web-platform.test.key diff --git a/tools/wpt/certs/web-platform.test.pem b/tests/wpt/runner/certs/web-platform.test.pem similarity index 100% rename from tools/wpt/certs/web-platform.test.pem rename to tests/wpt/runner/certs/web-platform.test.pem diff --git a/tests/wpt/runner/config.json b/tests/wpt/runner/config.json new file mode 100644 index 0000000000..92472371f6 --- /dev/null +++ b/tests/wpt/runner/config.json @@ -0,0 +1,11 @@ +{ + "check_subdomains": false, + "ssl": { + "type": "pregenerated", + "pregenerated": { + "ca_cert_path": "../../../tests/wpt/runner/certs/cacert.pem", + "host_cert_path": "../../../tests/wpt/runner/certs/web-platform.test.pem", + "host_key_path": "../../../tests/wpt/runner/certs/web-platform.test.key" + } + } +} diff --git a/tools/wpt/expectation.json b/tests/wpt/runner/expectation.json similarity index 100% rename from tools/wpt/expectation.json rename to tests/wpt/runner/expectation.json diff --git a/tools/wpt/runner.ts b/tests/wpt/runner/runner.ts similarity index 95% rename from tools/wpt/runner.ts rename to tests/wpt/runner/runner.ts index ee2fc2b74e..c7234da63f 100644 --- a/tools/wpt/runner.ts +++ b/tests/wpt/runner/runner.ts @@ -1,5 +1,11 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { delay, join, ROOT_PATH, TextLineStream, toFileUrl } from "../util.js"; +import { + delay, + join, + ROOT_PATH, + TextLineStream, + toFileUrl, +} from "../../../tools/util.js"; import { assert, denoBinary, ManifestTestOptions, runPy } from "./utils.ts"; import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.3-alpha2/deno-dom-wasm.ts"; @@ -11,7 +17,7 @@ export async function runWithTestUtil( "wpt", "serve", "--config", - "../../../tools/wpt/config.json", + "../../../tests/wpt/runner/config.json", ], { stdout: verbose ? "inherit" : "piped", stderr: verbose ? "inherit" : "piped", @@ -123,7 +129,7 @@ export async function runSingleTest( "--location", url.toString(), "--cert", - join(ROOT_PATH, `./tools/wpt/certs/cacert.pem`), + join(ROOT_PATH, `./tests/wpt/runner/certs/cacert.pem`), tempFile, "[]", ); @@ -205,7 +211,7 @@ async function generateBundle(location: URL): Promise { const src = script.getAttribute("src"); if (src === "/resources/testharnessreport.js") { const url = toFileUrl( - join(ROOT_PATH, "./tools/wpt/testharnessreport.js"), + join(ROOT_PATH, "./tests/wpt/runner/testharnessreport.js"), ); const contents = await Deno.readTextFile(url); scriptContents.push([url.href, contents]); diff --git a/tools/wpt/testharnessreport.js b/tests/wpt/runner/testharnessreport.js similarity index 100% rename from tools/wpt/testharnessreport.js rename to tests/wpt/runner/testharnessreport.js diff --git a/tools/wpt/utils.ts b/tests/wpt/runner/utils.ts similarity index 94% rename from tools/wpt/utils.ts rename to tests/wpt/runner/utils.ts index bc25505bd3..5e3399fa73 100644 --- a/tools/wpt/utils.ts +++ b/tests/wpt/runner/utils.ts @@ -1,8 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. /// FLAGS -import { parse } from "../../tests/util/std/flags/mod.ts"; -import { join, resolve, ROOT_PATH } from "../util.js"; +import { parse } from "../../util/std/flags/mod.ts"; +import { join, resolve, ROOT_PATH } from "../../../tools/util.js"; export const { json, @@ -51,7 +51,7 @@ export interface ManifestTestOptions { script_metadata: [string, string][]; } -const MANIFEST_PATH = join(ROOT_PATH, "./tools/wpt/manifest.json"); +const MANIFEST_PATH = join(ROOT_PATH, "./tests/wpt/runner/manifest.json"); export async function updateManifest() { const status = await runPy( @@ -76,7 +76,7 @@ export function getManifest(): Manifest { /// WPT TEST EXPECTATIONS -const EXPECTATION_PATH = join(ROOT_PATH, "./tools/wpt/expectation.json"); +const EXPECTATION_PATH = join(ROOT_PATH, "./tests/wpt/runner/expectation.json"); export interface Expectation { [key: string]: Expectation | boolean | string[]; diff --git a/tools/wpt.ts b/tests/wpt/wpt.ts similarity index 98% rename from tools/wpt.ts rename to tests/wpt/wpt.ts index 93b96b201c..351ee518cb 100755 --- a/tools/wpt.ts +++ b/tests/wpt/wpt.ts @@ -8,7 +8,7 @@ import { runWithTestUtil, TestCaseResult, TestResult, -} from "./wpt/runner.ts"; +} from "./runner/runner.ts"; import { assert, autoConfig, @@ -31,17 +31,11 @@ import { runPy, updateManifest, wptreport, -} from "./wpt/utils.ts"; -import { pooledMap } from "../tests/util/std/async/pool.ts"; -import { - blue, - bold, - green, - red, - yellow, -} from "../tests/util/std/fmt/colors.ts"; -import { writeAll, writeAllSync } from "../tests/util/std/streams/write_all.ts"; -import { saveExpectation } from "./wpt/utils.ts"; +} from "./runner/utils.ts"; +import { pooledMap } from "../util/std/async/pool.ts"; +import { blue, bold, green, red, yellow } from "../util/std/fmt/colors.ts"; +import { writeAll, writeAllSync } from "../util/std/streams/write_all.ts"; +import { saveExpectation } from "./runner/utils.ts"; class TestFilter { filter?: string[]; diff --git a/tools/wpt/config.json b/tools/wpt/config.json deleted file mode 100644 index 4b2a914f9b..0000000000 --- a/tools/wpt/config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "check_subdomains": false, - "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" - } - } -}