diff options
author | Filip Skokan <panva.ip@gmail.com> | 2023-02-22 21:45:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-22 21:45:21 +0100 |
commit | 5fcbdd62285140353edbb28e67f7d72e3317e96e (patch) | |
tree | 8af6cc82c9f92904b50ded04b68900a5f9a68b18 /tools | |
parent | a6ca4d0d61c95b9f7fa79ecce81a31a6d1f6cc5d (diff) |
test(wpt): implement process timeout (#17872)
```
response-consume-stream.any.js
Blob-stream.any.js
```
These tests just hang whenever they get to use byob mode. This PR adds a
timeout to the spawned process so that the WPTs finish running.
This first broke the daily run due to
https://github.com/web-platform-tests/wpt/commit/7b49c547d4b7bcc17e6308f741b080f4207d1e8a
Also fixes "Untitled" test names in
https://wpt.fyi/results/dom/events/Event-constructors.any.html?label=experimental&label=master&product=deno&product=chrome&aligned&view=subtest
Diffstat (limited to 'tools')
-rw-r--r-- | tools/wpt/expectation.json | 4 | ||||
-rw-r--r-- | tools/wpt/runner.ts | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index ebec7caf7..e9ee8e05e 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -1087,8 +1087,8 @@ "EventTarget-constructible.any.html": true, "EventTarget-constructible.any.worker.html": true, "Event-constructors.any.html": [ - "Untitled 3", - "Untitled 4" + "Event constructors 3", + "Event constructors 4" ], "Event-constructors.any.worker.html": [ "Event constructors 3", diff --git a/tools/wpt/runner.ts b/tools/wpt/runner.ts index a3c22006a..1b40e25b8 100644 --- a/tools/wpt/runner.ts +++ b/tools/wpt/runner.ts @@ -76,12 +76,15 @@ export async function runSingleTest( reporter: (result: TestCaseResult) => void, inspectBrk: boolean, ): Promise<TestResult> { + const timeout = _options.timeout === "long" ? 60_000 : 20_000; + const { title } = Object.fromEntries(_options.script_metadata || []); const bundle = await generateBundle(url); const tempFile = await Deno.makeTempFile({ prefix: "wpt-bundle-", suffix: ".js", }); + let interval; try { await Deno.writeTextFile(tempFile, bundle); @@ -107,6 +110,7 @@ export async function runSingleTest( "[]", ); + const start = performance.now(); const proc = new Deno.Command(denoBinary(), { args, env: { @@ -124,10 +128,19 @@ export async function runSingleTest( const lines = proc.stderr.pipeThrough(new TextDecoderStream()).pipeThrough( new TextLineStream(), ); + interval = setInterval(() => { + const passedTime = performance.now() - start; + if (passedTime > timeout) { + proc.kill("SIGINT"); + } + }, 1000); for await (const line of lines) { if (line.startsWith("{")) { const data = JSON.parse(line); const result = { ...data, passed: data.status == 0 }; + if (title && /^Untitled( \d+)?$/.test(result.name)) { + result.name = `${title}${result.name.slice(8)}`; + } cases.push(result); reporter(result); } else if (line.startsWith("#$#$#{")) { @@ -149,6 +162,7 @@ export async function runSingleTest( stderr, }; } finally { + clearInterval(interval); await Deno.remove(tempFile); } } |