diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts b/dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts index 44a73fb38b..2a00640f0e 100644 --- a/dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts +++ b/dom/webgpu/tests/cts/checkout/src/common/runtime/cmdline.ts @@ -3,6 +3,7 @@ import * as fs from 'fs'; import { dataCache } from '../framework/data_cache.js'; +import { getResourcePath, setBaseResourcePath } from '../framework/resources.js'; import { globalTestConfig } from '../framework/test_config.js'; import { DefaultTestFileLoader } from '../internal/file_loader.js'; import { prettyPrintLog } from '../internal/logging/log_message.js'; @@ -37,6 +38,12 @@ Options: return sys.exit(rc); } +if (!sys.existsSync('src/common/runtime/cmdline.ts')) { + console.log('Must be run from repository root'); + usage(1); +} +setBaseResourcePath('out-node/resources'); + // The interface that exposes creation of the GPU, and optional interface to code coverage. interface GPUProviderModule { // @returns a GPU with the given flags @@ -60,12 +67,10 @@ Colors.enabled = false; let verbose = false; let emitCoverage = false; let listMode: listModes = 'none'; -let debug = false; let printJSON = false; let quiet = false; let loadWebGPUExpectations: Promise<unknown> | undefined = undefined; let gpuProviderModule: GPUProviderModule | undefined = undefined; -let dataPath: string | undefined = undefined; const queries: string[] = []; const gpuProviderFlags: string[] = []; @@ -83,9 +88,7 @@ for (let i = 0; i < sys.args.length; ++i) { } else if (a === '--list-unimplemented') { listMode = 'unimplemented'; } else if (a === '--debug') { - debug = true; - } else if (a === '--data') { - dataPath = sys.args[++i]; + globalTestConfig.enableDebugLogs = true; } else if (a === '--print-json') { printJSON = true; } else if (a === '--expectations') { @@ -102,6 +105,10 @@ for (let i = 0; i < sys.args.length; ++i) { globalTestConfig.unrollConstEvalLoops = true; } else if (a === '--compat') { globalTestConfig.compatibility = true; + } else if (a === '--force-fallback-adapter') { + globalTestConfig.forceFallbackAdapter = true; + } else if (a === '--log-to-websocket') { + globalTestConfig.logToWebSocket = true; } else { console.log('unrecognized flag: ', a); usage(1); @@ -113,9 +120,12 @@ for (let i = 0; i < sys.args.length; ++i) { let codeCoverage: CodeCoverageProvider | undefined = undefined; -if (globalTestConfig.compatibility) { +if (globalTestConfig.compatibility || globalTestConfig.forceFallbackAdapter) { // MAINTENANCE_TODO: remove the cast once compatibilityMode is officially added - setDefaultRequestAdapterOptions({ compatibilityMode: true } as GPURequestAdapterOptions); + setDefaultRequestAdapterOptions({ + compatibilityMode: globalTestConfig.compatibility, + forceFallbackAdapter: globalTestConfig.forceFallbackAdapter, + } as GPURequestAdapterOptions); } if (gpuProviderModule) { @@ -132,21 +142,20 @@ Did you remember to build with code coverage instrumentation enabled?` } } -if (dataPath !== undefined) { - dataCache.setStore({ - load: (path: string) => { - return new Promise<Uint8Array>((resolve, reject) => { - fs.readFile(`${dataPath}/${path}`, (err, data) => { - if (err !== null) { - reject(err.message); - } else { - resolve(data); - } - }); +dataCache.setStore({ + load: (path: string) => { + return new Promise<Uint8Array>((resolve, reject) => { + fs.readFile(getResourcePath(`cache/${path}`), (err, data) => { + if (err !== null) { + reject(err.message); + } else { + resolve(data); + } }); - }, - }); -} + }); + }, +}); + if (verbose) { dataCache.setDebugLogger(console.log); } @@ -166,7 +175,6 @@ if (queries.length === 0) { filterQuery ); - Logger.globalDebugMode = debug; const log = new Logger(); const failed: Array<[string, LiveTestCaseResult]> = []; |