summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js')
-rw-r--r--testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js53
1 files changed, 46 insertions, 7 deletions
diff --git a/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js b/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js
index 139c3bc29f..01b7d95889 100644
--- a/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js
+++ b/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/options.js
@@ -1,11 +1,14 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
-**/let windowURL = undefined;function getWindowURL() {if (windowURL === undefined) {
+**/import { unreachable } from '../../util/util.js';let windowURL = undefined;
+function getWindowURL() {
+ if (windowURL === undefined) {
windowURL = new URL(window.location.toString());
}
return windowURL;
}
+/** Parse a runner option that is always boolean-typed. False if missing or '0'. */
export function optionEnabled(
opt,
searchParams = getWindowURL().searchParams)
@@ -14,11 +17,32 @@ searchParams = getWindowURL().searchParams)
return val !== null && val !== '0';
}
+/** Parse a runner option that is string-typed. If the option is missing, returns `null`. */
export function optionString(
opt,
searchParams = getWindowURL().searchParams)
{
- return searchParams.get(opt) || '';
+ return searchParams.get(opt);
+}
+
+/** Runtime modes for running tests in different types of workers. */
+
+/** Parse a runner option for different worker modes (as in `?worker=shared`). Null if no worker. */
+export function optionWorkerMode(
+opt,
+searchParams = getWindowURL().searchParams)
+{
+ const value = searchParams.get(opt);
+ if (value === null || value === '0') {
+ return null;
+ } else if (value === 'service') {
+ return 'service';
+ } else if (value === 'shared') {
+ return 'shared';
+ } else if (value === '' || value === '1' || value === 'dedicated') {
+ return 'dedicated';
+ }
+ unreachable('invalid worker= option value');
}
/**
@@ -32,12 +56,16 @@ searchParams = getWindowURL().searchParams)
+
+
export const kDefaultCTSOptions = {
- worker: false,
+ worker: null,
debug: true,
compatibility: false,
+ forceFallbackAdapter: false,
unrollConstEvalLoops: false,
- powerPreference: ''
+ powerPreference: null,
+ logToWebSocket: false
};
/**
@@ -59,19 +87,30 @@ export const kDefaultCTSOptions = {
* Options to the CTS.
*/
export const kCTSOptionsInfo = {
- worker: { description: 'run in a worker' },
+ worker: {
+ description: 'run in a worker',
+ parser: optionWorkerMode,
+ selectValueDescriptions: [
+ { value: null, description: 'no worker' },
+ { value: 'dedicated', description: 'dedicated worker' },
+ { value: 'shared', description: 'shared worker' },
+ { value: 'service', description: 'service worker' }]
+
+ },
debug: { description: 'show more info' },
compatibility: { description: 'run in compatibility mode' },
+ forceFallbackAdapter: { description: 'pass forceFallbackAdapter: true to requestAdapter' },
unrollConstEvalLoops: { description: 'unroll const eval loops in WGSL' },
powerPreference: {
description: 'set default powerPreference for some tests',
parser: optionString,
selectValueDescriptions: [
- { value: '', description: 'default' },
+ { value: null, description: 'default' },
{ value: 'low-power', description: 'low-power' },
{ value: 'high-performance', description: 'high-performance' }]
- }
+ },
+ logToWebSocket: { description: 'send some logs to ws://localhost:59497/' }
};
/**