Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions test/common/wpt.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -436,7 +436,6 @@ class WPTRunner {
);

this.results = {};
this.inProgress = new Set();
this.workers = new Map();
this.unexpectedFailures = [];

Expand DownExpand Up@@ -559,7 +558,7 @@ class WPTRunner {
queue = this.buildQueue();
}

this.inProgress = new Set(queue.map((spec) => spec.filename));
this.inProgress = new Set();

const run = limit(os.availableParallelism());

Expand DownExpand Up@@ -612,6 +611,7 @@ class WPTRunner {
needsGc,
},
});
this.inProgress.add(testFileName);
this.workers.set(testFileName, worker);

let reportResult;
Expand All@@ -621,7 +621,7 @@ class WPTRunner {
reportResult ||= this.report?.addResult(`/${relativePath}${variant}`, 'OK');
return this.resultCallback(testFileName, message.result, reportResult);
case 'completion':
return this.completionCallback(testFileName, message.status);
return this.completionCallback(testFileName, worker, message.status);
default:
throw new Error(`Unexpected message from worker: ${message.type}`);
}
Expand DownExpand Up@@ -661,6 +661,8 @@ class WPTRunner {
}
}

await Promise.all([...this.workers.values()].map((worker) => events.once(worker, 'exit')));

process.on('exit', () => {
if (this.inProgress.size > 0) {
for (const filename of this.inProgress) {
Expand DownExpand Up@@ -784,9 +786,10 @@ class WPTRunner {
* Report the status of each WPT test (one per file)
*
* @param {string} filename
* @param {string} worker - Reference to the worker.
* @param {object} harnessStatus - The status object returned by WPT harness.
*/
completionCallback(filename, harnessStatus) {
completionCallback(filename, worker, harnessStatus) {
// Treat it like a test case failure
if (harnessStatus.status === 2) {
const title = this.getTestTitle(filename);
Expand All@@ -796,7 +799,7 @@ class WPTRunner {
this.inProgress.delete(filename);
// Always force termination of the worker. Some tests allocate resources
// that would otherwise keep it alive.
this.workers.get(filename).terminate();
worker.terminate();
}

addTestResult(filename, item) {
Expand Down