From 9051d76f3427cc4c22a62c71e0cd503f65ebff9f Mon Sep 17 00:00:00 2001 From: Keith Miller Date: Mon, 30 Nov 2026 21:10:24 -0500 Subject: [PATCH] Make Worker tests CLI friendly. This consists of two changes: 1) Don't error when running bomb-workers from the CLI. 2) Don't tear-down Workers in segmentation on a 1ms timeout. Instead add a validate() hook that terminates all the workers and clears the set. It's still necessary to pass `--tag=Default` to run Worker tests in the CLI as `Worker` isn't supported in `sm`. --- workloads/bomb-workers/bomb.js | 3 --- workloads/segmentation/segmentation.js | 13 ++++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/workloads/bomb-workers/bomb.js b/workloads/bomb-workers/bomb.js index 350a5448..7bdd9490 100644 --- a/workloads/bomb-workers/bomb.js +++ b/workloads/bomb-workers/bomb.js @@ -41,9 +41,6 @@ function startWorker(file) { } function startCycle() { - if (!JetStream.isInBrowser) - throw new Error("Only works in browser"); - const tests = [ JetStream.preload.rayTrace3D, JetStream.preload.accessNbody, diff --git a/workloads/segmentation/segmentation.js b/workloads/segmentation/segmentation.js index bf98fd25..0b845f48 100644 --- a/workloads/segmentation/segmentation.js +++ b/workloads/segmentation/segmentation.js @@ -596,13 +596,6 @@ class AsyncTaskWorker { if (AsyncTaskWorker._queue.length) AsyncTaskWorker._queue.pop()(this); - else { - var self = this; - setTimeout(function () { - if (self._currentTaskId == null) - AsyncTaskWorker._workerSet.delete(self); - }, 1000); - } callback(event.data); } @@ -689,4 +682,10 @@ class Benchmark { throw new Error("Bad result"); } } + + validate() { + for (const worker of AsyncTaskWorker._workerSet) + worker._webWorker.terminate(); + AsyncTaskWorker._workerSet.clear(); + } };