-
Notifications
You must be signed in to change notification settings - Fork 54
/
wpt.js
59 lines (50 loc) · 1.71 KB
/
wpt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
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';
import { optionEnabled } from './helper/options.js';
import { TestWorker } from './helper/test_worker.js';
(async () => {
const loader = new TestLoader();
const files = await loader.loadTestsFromQuery(window.location.search);
const worker = optionEnabled('worker') ? new TestWorker() : undefined;
const log = new Logger();
const mutex = new AsyncMutex();
const running = [];
for (const f of files) {
if (!('g' in f.spec)) {
continue;
}
const [rec] = log.record(f.id);
for (const t of f.spec.g.iterate(rec)) {
const name = makeQueryString(f.id, t.id); // Note: apparently, async_tests must ALL be added within the same task.
async_test(function () {
const p = mutex.with(async () => {
let r;
if (worker) {
r = await worker.run(name);
t.injectResult(r);
} else {
r = await t.run();
}
this.step(() => {
// Unfortunately, it seems not possible to surface any logs for warn/skip.
if (r.status === 'fail') {
throw (r.logs || []).map(s => s.toJSON()).join('\n\n');
}
});
this.done();
});
running.push(p);
return p;
}, name);
}
}
await Promise.all(running);
const resultsElem = document.getElementById('results');
resultsElem.textContent = log.asJSON(2);
})();
//# sourceMappingURL=wpt.js.map