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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/import { assert } from '../util/util.js';
import { parseQuery } from './query/parseQuery.js';
import { loadTreeForQuery } from './tree.js';
// A listing file, e.g. either of:
// - `src/webgpu/listing.ts` (which is dynamically computed, has a Promise<TestSuiteListing>)
// - `out/webgpu/listing.js` (which is pre-baked, has a TestSuiteListing)
// A .spec.ts file, as imported.
// Override the types for addEventListener/removeEventListener so the callbacks can be used as
// strongly-typed.
// Base class for DefaultTestFileLoader and FakeTestFileLoader.
export class TestFileLoader extends EventTarget {
async importSpecFile(suite, path) {
const url = `${suite}/${path.join('/')}.spec.js`;
this.dispatchEvent(new MessageEvent('import', { data: { url } }));
const ret = await this.import(url);
this.dispatchEvent(new MessageEvent('imported', { data: { url } }));
return ret;
}
async loadTree(
query,
{
subqueriesToExpand = [],
maxChunkTime = Infinity
} = {})
{
const tree = await loadTreeForQuery(this, query, {
subqueriesToExpand: subqueriesToExpand.map((s) => {
const q = parseQuery(s);
assert(q.level >= 2, () => `subqueriesToExpand entries should not be multi-file:\n ${q}`);
return q;
}),
maxChunkTime
});
this.dispatchEvent(new MessageEvent('finish'));
return tree;
}
async loadCases(query) {
const tree = await this.loadTree(query);
return tree.iterateLeaves();
}
}
export class DefaultTestFileLoader extends TestFileLoader {
async listing(suite) {
return (await import(`../../${suite}/listing.js`)).listing;
}
import(path) {
return import(`../../${path}`);
}
}
|