diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/common/framework/metadata.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/common/framework/metadata.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/common/framework/metadata.ts b/dom/webgpu/tests/cts/checkout/src/common/framework/metadata.ts new file mode 100644 index 0000000000..2c2a1ef794 --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/common/framework/metadata.ts @@ -0,0 +1,28 @@ +import { assert } from '../util/util.js'; + +/** Metadata about tests (that can't be derived at runtime). */ +export type TestMetadata = { + /** + * Estimated average time-per-subcase, in milliseconds. + * This is used to determine chunking granularity when exporting to WPT with + * chunking enabled (like out-wpt/cts-chunked2sec.https.html). + */ + subcaseMS: number; +}; + +export type TestMetadataListing = { + [testQuery: string]: TestMetadata; +}; + +export function loadMetadataForSuite(suiteDir: string): TestMetadataListing | null { + assert(typeof require !== 'undefined', 'loadMetadataForSuite is only implemented on Node'); + const fs = require('fs'); + + const metadataFile = `${suiteDir}/listing_meta.json`; + if (!fs.existsSync(metadataFile)) { + return null; + } + + const metadata: TestMetadataListing = JSON.parse(fs.readFileSync(metadataFile, 'utf8')); + return metadata; +} |