1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

chore(wpt): Mark a WPT test as failed if it exits before completion (#11371)

Currently, a WPT test is considered failed if its status code is
anything other than 0, regardless of whether the test suite completed
running or not, and any subtests that haven't finished running are not
considered to be failures.

But a test can exit with a zero status code before it has completed
running, if the event loop has run out of tasks because of a bug in one
of the ops, leading to false positives. This change fixes that.
This commit is contained in:
Andreu Botella 2021-07-12 21:15:07 +02:00 committed by GitHub
parent 6d4e9bad98
commit 2c7c130f0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 19 deletions

View file

@ -210,6 +210,14 @@ async function generateWptReport(
: result.harnessStatus?.status === 0 : result.harnessStatus?.status === 0
? "OK" ? "OK"
: "ERROR"; : "ERROR";
let message;
if (result.harnessStatus === null && result.status === 0) {
// If the only error is the event loop running out of tasks, using stderr
// as the message won't help.
message = "Event loop run out of tasks.";
} else {
message = result.harnessStatus?.message ?? (result.stderr.trim() || null);
}
const reportResult = { const reportResult = {
test: test.url.pathname + test.url.search + test.url.hash, test: test.url.pathname + test.url.search + test.url.hash,
subtests: result.cases.map((case_) => { subtests: result.cases.map((case_) => {
@ -231,9 +239,7 @@ async function generateWptReport(
}; };
}), }),
status, status,
message: escapeLoneSurrogates( message: escapeLoneSurrogates(message),
result.harnessStatus?.message ?? (result.stderr.trim() || null),
),
duration: result.duration, duration: result.duration,
expected: status === "OK" ? undefined : "OK", expected: status === "OK" ? undefined : "OK",
"known_intermittent": [], "known_intermittent": [],
@ -320,14 +326,14 @@ async function update() {
const resultTests: Record< const resultTests: Record<
string, string,
{ passed: string[]; failed: string[]; status: number } { passed: string[]; failed: string[]; testSucceeded: boolean }
> = {}; > = {};
for (const { test, result } of results) { for (const { test, result } of results) {
if (!resultTests[test.path]) { if (!resultTests[test.path]) {
resultTests[test.path] = { resultTests[test.path] = {
passed: [], passed: [],
failed: [], failed: [],
status: result.status, testSucceeded: result.status === 0 && result.harnessStatus !== null,
}; };
} }
for (const case_ of result.cases) { for (const case_ of result.cases) {
@ -342,11 +348,11 @@ async function update() {
const currentExpectation = getExpectation(); const currentExpectation = getExpectation();
for (const path in resultTests) { for (const path in resultTests) {
const { passed, failed, status } = resultTests[path]; const { passed, failed, testSucceeded } = resultTests[path];
let finalExpectation: boolean | string[]; let finalExpectation: boolean | string[];
if (failed.length == 0 && status == 0) { if (failed.length == 0 && testSucceeded) {
finalExpectation = true; finalExpectation = true;
} else if (failed.length > 0 && passed.length > 0 && status == 0) { } else if (failed.length > 0 && passed.length > 0 && testSucceeded) {
finalExpectation = failed; finalExpectation = failed;
} else { } else {
finalExpectation = false; finalExpectation = false;
@ -413,7 +419,7 @@ function reportFinal(
result, result,
test.expectation, test.expectation,
); );
if (result.status !== 0) { if (result.status !== 0 || result.harnessStatus === null) {
if (test.expectation === false) { if (test.expectation === false) {
finalExpectedFailedAndFailedCount += 1; finalExpectedFailedAndFailedCount += 1;
} else { } else {
@ -520,15 +526,18 @@ function analyzeTestResult(
} }
function reportVariation(result: TestResult, expectation: boolean | string[]) { function reportVariation(result: TestResult, expectation: boolean | string[]) {
if (result.status !== 0) { if (result.status !== 0 || result.harnessStatus === null) {
console.log(`test stderr:`); console.log(`test stderr:`);
writeAllSync(Deno.stdout, new TextEncoder().encode(result.stderr)); writeAllSync(Deno.stdout, new TextEncoder().encode(result.stderr));
const expectFail = expectation === false; const expectFail = expectation === false;
const failReason = result.status !== 0
? "runner failed during test"
: "the event loop run out of tasks during the test";
console.log( console.log(
`\nfile result: ${ `\nfile result: ${
expectFail ? yellow("failed (expected)") : red("failed") expectFail ? yellow("failed (expected)") : red("failed")
}. runner failed during test\n`, }. ${failReason}\n`,
); );
return; return;
} }

View file

@ -2252,12 +2252,7 @@
"enqueue-with-detached-buffer.window.html": false "enqueue-with-detached-buffer.window.html": false
}, },
"readable-streams": { "readable-streams": {
"async-iterator.any.html": [ "async-iterator.any.html": false,
"Async-iterating a pull source manually",
"next() rejects if the stream errors",
"return() does not rejects if the stream has not errored yet",
"next() that succeeds; next() that reports an error; next()"
],
"bad-strategies.any.html": true, "bad-strategies.any.html": true,
"bad-underlying-sources.any.html": true, "bad-underlying-sources.any.html": true,
"cancel.any.html": true, "cancel.any.html": true,
@ -2799,7 +2794,7 @@
"reading-data-section": { "reading-data-section": {
"Determining-Encoding.any.html": true, "Determining-Encoding.any.html": true,
"FileReader-event-handler-attributes.any.html": true, "FileReader-event-handler-attributes.any.html": true,
"FileReader-multiple-reads.any.html": true, "FileReader-multiple-reads.any.html": false,
"filereader_abort.any.html": true, "filereader_abort.any.html": true,
"filereader_error.any.html": true, "filereader_error.any.html": true,
"filereader_events.any.html": false, "filereader_events.any.html": false,
@ -2825,7 +2820,7 @@
"type-long-settimeout.any.html": true "type-long-settimeout.any.html": true
}, },
"microtask-queuing": { "microtask-queuing": {
"queue-microtask-exceptions.any.html": true, "queue-microtask-exceptions.any.html": false,
"queue-microtask.any.html": true "queue-microtask.any.html": true
} }
} }