@@ -9,9 +9,23 @@ This script runs end2end tests by invoking the benchmark via the main
99Speedometer page in /index.html.
1010` . trim ( ) ;
1111
12+ const ONE_MINUTE_IN_MS = 60000 ;
13+
1214const { driver, PORT , stop } = await testSetup ( HELP ) ;
1315
14- const suites = benchmarkConfigurator . suites ;
16+ // Running all of the benchmarks is very slow (especially when the GPU is emulated). To run the
17+ // tests faster we run all of the Wasm benchmarks, and only a few GPU tests to cover most of
18+ // the common code. To run all benchmarks, enable this.
19+ const RUN_FULL_SUITE = false ;
20+ let tags = 'wasm,gpu-test-suite' ;
21+ let suites = benchmarkConfigurator . suites . filter ( suite => suite . tags . some ( ( tag ) => tag === 'wasm' || tag === 'gpu-test-suite' ) ) ;
22+ let timeout = 5 * ONE_MINUTE_IN_MS ;
23+
24+ if ( RUN_FULL_SUITE ) {
25+ tags = 'all' ;
26+ suites = benchmarkConfigurator . suites ;
27+ timeout = 20 * ONE_MINUTE_IN_MS ;
28+ }
1529
1630async function testPage ( url ) {
1731 console . log ( `Testing: ${ url } ` ) ;
@@ -72,7 +86,7 @@ function validateMetric(name, metric) {
7286
7387async function testIterations ( ) {
7488 const iterationCount = 2 ;
75- const metrics = await testPage ( `index.html?iterationCount=${ iterationCount } ` ) ;
89+ const metrics = await testPage ( `index.html?iterationCount=${ iterationCount } &tags= ${ tags } ` ) ;
7690 suites . forEach ( ( suite ) => {
7791 if ( suite . enabled ) {
7892 const metric = metrics [ suite . name ] ;
@@ -87,7 +101,7 @@ async function testIterations() {
87101}
88102
89103async function testAll ( ) {
90- const metrics = await testPage ( " index.html?iterationCount=1&tags=all" ) ;
104+ const metrics = await testPage ( ` index.html?iterationCount=1&tags=${ tags } ` ) ;
91105 suites . forEach ( ( suite ) => {
92106 assert ( suite . name in metrics ) ;
93107 const metric = metrics [ suite . name ] ;
@@ -98,10 +112,10 @@ async function testAll() {
98112}
99113
100114async function testDeveloperMode ( ) {
101- const params = [ "developerMode" , "iterationCount=1" , "warmupBeforeSync=2" , "waitBeforeSync=2" , "shuffleSeed=123" , "suites=Perf-Dashboard " ] ;
115+ const params = [ "developerMode" , "iterationCount=1" , "warmupBeforeSync=2" , "waitBeforeSync=2" , "shuffleSeed=123" , "suites=Image-Classification-LiteRT.js-wasm " ] ;
102116 const metrics = await testPage ( `index.html?${ params . join ( "&" ) } ` ) ;
103117 suites . forEach ( ( suite ) => {
104- if ( suite . name === "Perf-Dashboard " ) {
118+ if ( suite . name === "Image-Classification-LiteRT.js-wasm " ) {
105119 const metric = metrics [ suite . name ] ;
106120 assert ( metric . values . length === 1 ) ;
107121 } else {
@@ -112,7 +126,7 @@ async function testDeveloperMode() {
112126
113127async function test ( ) {
114128 try {
115- await driver . manage ( ) . setTimeouts ( { script : 60000 } ) ;
129+ await driver . manage ( ) . setTimeouts ( { script : timeout } ) ;
116130 await testIterations ( ) ;
117131 await testAll ( ) ;
118132 await testDeveloperMode ( ) ;
0 commit comments