mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision 0abb411331f86f472103183c7ec1136ea21a7e1b
This commit is contained in:
parent
d671010e46
commit
5a5512f805
139 changed files with 2559 additions and 1445 deletions
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
|
||||
**/
|
||||
|
||||
const url = new URL(window.location.toString());
|
||||
export function optionEnabled(opt) {
|
||||
const val = url.searchParams.get(opt);
|
||||
return val !== null && val !== '0';
|
||||
}
|
||||
//# sourceMappingURL=options.js.map
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
|
||||
**/
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
export class TestWorker {
|
||||
constructor() {
|
||||
_defineProperty(this, "worker", void 0);
|
||||
|
||||
_defineProperty(this, "resolvers", new Map());
|
||||
|
||||
const selfPath = import.meta.url;
|
||||
const selfPathDir = selfPath.substring(0, selfPath.lastIndexOf('/'));
|
||||
const workerPath = selfPathDir + '/test_worker.worker.js';
|
||||
this.worker = new Worker(workerPath, {
|
||||
type: 'module'
|
||||
});
|
||||
|
||||
this.worker.onmessage = ev => {
|
||||
const {
|
||||
query,
|
||||
result
|
||||
} = ev.data;
|
||||
this.resolvers.get(query)(result); // TODO(kainino0x): update the Logger with this result (or don't have a logger and update the
|
||||
// entire results JSON somehow at some point).
|
||||
};
|
||||
}
|
||||
|
||||
run(query, debug = false) {
|
||||
this.worker.postMessage({
|
||||
query,
|
||||
debug
|
||||
});
|
||||
return new Promise(resolve => {
|
||||
this.resolvers.set(query, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//# sourceMappingURL=test_worker.js.map
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
|
||||
**/
|
||||
|
||||
import { TestLoader } from '../../framework/loader.js';
|
||||
import { Logger } from '../../framework/logger.js';
|
||||
// should be DedicatedWorkerGlobalScope
|
||||
const log = new Logger();
|
||||
const loader = new TestLoader();
|
||||
|
||||
self.onmessage = async ev => {
|
||||
const {
|
||||
query,
|
||||
debug
|
||||
} = ev.data;
|
||||
const files = Array.from((await loader.loadTests([query])));
|
||||
if (files.length !== 1) throw new Error('worker query resulted in != 1 files');
|
||||
const f = files[0];
|
||||
const [rec] = log.record(f.id);
|
||||
if (!('g' in f.spec)) throw new Error('worker query resulted in README');
|
||||
const cases = Array.from(f.spec.g.iterate(rec));
|
||||
if (cases.length !== 1) throw new Error('worker query resulted in != 1 cases');
|
||||
const c = cases[0];
|
||||
const result = await c.run(debug);
|
||||
self.postMessage({
|
||||
query,
|
||||
result
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=test_worker.worker.js.map
|
|
@ -6,10 +6,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';
|
||||
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 = [];
|
||||
|
@ -22,10 +25,19 @@ import { AsyncMutex } from '../framework/util/async_mutex.js';
|
|||
const [rec] = log.record(f.id);
|
||||
|
||||
for (const t of f.spec.g.iterate(rec)) {
|
||||
// Note: apparently, async_tests must ALL be added within the same task.
|
||||
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 () => {
|
||||
const r = await t.run();
|
||||
let r;
|
||||
|
||||
if (worker) {
|
||||
r = await worker.run(name);
|
||||
t.injectResult(r);
|
||||
} else {
|
||||
r = await t.run();
|
||||
}
|
||||
|
||||
this.step(() => {
|
||||
if (r.status === 'fail') {
|
||||
throw (r.logs || []).join('\n');
|
||||
|
@ -35,7 +47,7 @@ import { AsyncMutex } from '../framework/util/async_mutex.js';
|
|||
});
|
||||
running.push(p);
|
||||
return p;
|
||||
}, makeQueryString(f.id, t.id));
|
||||
}, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue