From d92072c656ac0e764c1588ad5825ce6a10703352 Mon Sep 17 00:00:00 2001 From: Sean Michael Wykes <8363933+SeanWykes@users.noreply.github.com> Date: Thu, 6 Jan 2022 07:24:37 -0300 Subject: [PATCH] chore(wpt): add "--inspect-brk" flag to WPT runner (#13267) --- tools/wpt.ts | 3 +++ tools/wpt/runner.ts | 39 ++++++++++++++++++++++++++------------- tools/wpt/utils.ts | 3 ++- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/tools/wpt.ts b/tools/wpt.ts index d56ff34d66..b582219fac 100755 --- a/tools/wpt.ts +++ b/tools/wpt.ts @@ -20,6 +20,7 @@ import { getExpectation, getExpectFailForCase, getManifest, + inspectBrk, json, ManifestFolder, ManifestTestOptions, @@ -161,6 +162,7 @@ async function run() { test.url, test.options, createReportTestCase(test.expectation), + inspectBrk, ); results.push({ test, result }); reportVariation(result, test.expectation); @@ -312,6 +314,7 @@ async function update() { test.url, test.options, json ? () => {} : createReportTestCase(test.expectation), + inspectBrk, ); results.push({ test, result }); reportVariation(result, test.expectation); diff --git a/tools/wpt/runner.ts b/tools/wpt/runner.ts index 4f4389fd3d..b7a51af9dd 100644 --- a/tools/wpt/runner.ts +++ b/tools/wpt/runner.ts @@ -76,6 +76,7 @@ export async function runSingleTest( url: URL, _options: ManifestTestOptions, reporter: (result: TestCaseResult) => void, + inspectBrk: boolean, ): Promise { const bundle = await generateBundle(url); const tempFile = await Deno.makeTempFile({ @@ -88,20 +89,32 @@ export async function runSingleTest( const startTime = new Date().getTime(); + const cmd = [ + denoBinary(), + "run", + ]; + + cmd.push( + "-A", + "--unstable", + ); + + if (inspectBrk) { + cmd.push("--inspect-brk"); + } + + cmd.push( + "--enable-testing-features-do-not-use", + "--location", + url.toString(), + "--cert", + join(ROOT_PATH, `./tools/wpt/certs/cacert.pem`), + tempFile, + "[]", + ); + const proc = Deno.run({ - cmd: [ - denoBinary(), - "run", - "-A", - "--unstable", - "--enable-testing-features-do-not-use", - "--location", - url.toString(), - "--cert", - join(ROOT_PATH, `./tools/wpt/certs/cacert.pem`), - tempFile, - "[]", - ], + cmd, env: { NO_COLOR: "1", }, diff --git a/tools/wpt/utils.ts b/tools/wpt/utils.ts index 1a7a682be6..a5e7625271 100644 --- a/tools/wpt/utils.ts +++ b/tools/wpt/utils.ts @@ -12,10 +12,11 @@ export const { rebuild, ["--"]: rest, ["auto-config"]: autoConfig, + ["inspect-brk"]: inspectBrk, binary, } = parse(Deno.args, { "--": true, - boolean: ["quiet", "release", "no-interactive"], + boolean: ["quiet", "release", "no-interactive", "inspect-brk"], string: ["json", "wptreport", "binary"], });