diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/webgpu/runtime/wpt.js')
-rw-r--r-- | tests/wpt/web-platform-tests/webgpu/runtime/wpt.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/wpt/web-platform-tests/webgpu/runtime/wpt.js b/tests/wpt/web-platform-tests/webgpu/runtime/wpt.js index d11499f1e8c..ec4ab012392 100644 --- a/tests/wpt/web-platform-tests/webgpu/runtime/wpt.js +++ b/tests/wpt/web-platform-tests/webgpu/runtime/wpt.js @@ -5,11 +5,13 @@ import { TestLoader } from '../framework/loader.js'; import { Logger } from '../framework/logger.js'; import { makeQueryString } from '../framework/url_query.js'; +import { AsyncMutex } from '../framework/util/async_mutex.js'; (async () => { const loader = new TestLoader(); const files = await loader.loadTestsFromQuery(window.location.search); const log = new Logger(); + const mutex = new AsyncMutex(); const running = []; for (const f of files) { @@ -17,20 +19,22 @@ import { makeQueryString } from '../framework/url_query.js'; continue; } - const [rec] = log.record(f.id); // TODO: don't run all tests all at once + const [rec] = log.record(f.id); for (const t of f.spec.g.iterate(rec)) { - const run = t.run(); - running.push(run); // Note: apparently, async_tests must ALL be added within the same task. - - async_test(async function () { - const r = await run; - this.step(() => { - if (r.status === 'fail') { - throw (r.logs || []).join('\n'); - } + // Note: apparently, async_tests must ALL be added within the same task. + async_test(function () { + const p = mutex.with(async () => { + const r = await t.run(); + this.step(() => { + if (r.status === 'fail') { + throw (r.logs || []).join('\n'); + } + }); + this.done(); }); - this.done(); + running.push(p); + return p; }, makeQueryString(f.id, t.id)); } } |