[js/webgpu] Support Chrome Canary in unit tests (#21750)

Chrome Canary is helpful to test some new features. With this PR, we can
enable Chrome Canary in unit tests with command like "npm test -- op
abs.jsonc -b=webgpu -e=chromecanary".
This commit is contained in:
Yang Gu 2024-08-16 10:27:54 +08:00 committed by GitHub
parent 754dba2674
commit f8efc086ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -131,7 +131,7 @@ Examples:
export declare namespace TestRunnerCliArgs {
type Mode = 'suite0' | 'suite1' | 'model' | 'unittest' | 'op';
type Backend = 'cpu' | 'webgl' | 'webgpu' | 'wasm' | 'onnxruntime' | 'webnn';
type Environment = 'chrome' | 'edge' | 'firefox' | 'electron' | 'safari' | 'node' | 'bs';
type Environment = 'chrome' | 'chromecanary' | 'edge' | 'firefox' | 'electron' | 'safari' | 'node' | 'bs';
type BundleMode = 'dev' | 'perf';
type IOBindingMode = 'none' | 'gpu-tensor' | 'gpu-location';
}
@ -385,7 +385,7 @@ export function parseTestRunnerCliArgs(cmdlineArgs: string[]): TestRunnerCliArgs
// Option: -e=<...>, --env=<...>
const envArg = args.env || args.e;
const env = typeof envArg !== 'string' ? 'chrome' : envArg;
if (['chrome', 'edge', 'firefox', 'electron', 'safari', 'node', 'bs'].indexOf(env) === -1) {
if (['chrome', 'chromecanary', 'edge', 'firefox', 'electron', 'safari', 'node', 'bs'].indexOf(env) === -1) {
throw new Error(`not supported env ${env}`);
}

View file

@ -708,6 +708,8 @@ async function main() {
switch (env) {
case 'chrome':
return 'ChromeTest';
case 'chromecanary':
return 'ChromeCanaryTest';
case 'edge':
return 'EdgeTest';
case 'firefox':