diff --git a/.ci.yaml b/.ci.yaml index 391da69293..3d39c8df70 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -238,9 +238,11 @@ targets: cores: "32" # Pigeon tests need Andoid deps (thus the Linux_android base) and # clang-format. + # web_benchmarks needs Chrome. dependencies: >- [ - {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"} + {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, + {"dependency": "chrome_and_driver", "version": "version:114.0"} ] channel: master @@ -251,11 +253,11 @@ targets: version_file: flutter_stable.version target_file: linux_custom_package_tests.yaml cores: "32" - # Pigeon tests need Android deps (thus the Linux_android base) and - # clang-format. + # See comments on 'master' version above. dependencies: >- [ - {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"} + {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, + {"dependency": "chrome_and_driver", "version": "version:114.0"} ] channel: stable diff --git a/.cirrus.yml b/.cirrus.yml index 7a5bae288d..be85fc9c01 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -170,16 +170,3 @@ task: - else - echo "This user does not have permission to run Firebase Test Lab tests." - fi - ### Web tasks ### - - name: web_benchmarks_test - env: - matrix: - CHROMIUM_BUILD: "950363" # Chromium 98.0.4758.0 - CHROMIUM_BUILD: "1097615" # Chromium 111 - << : *INSTALL_CHROME_LINUX - script: - - cd packages/web_benchmarks/testing/test_app - - flutter packages get - - cd ../.. - - flutter packages get - - dart testing/web_benchmarks_test.dart diff --git a/packages/web_benchmarks/tool/run_tests.dart b/packages/web_benchmarks/tool/run_tests.dart new file mode 100644 index 0000000000..3e0fb09344 --- /dev/null +++ b/packages/web_benchmarks/tool/run_tests.dart @@ -0,0 +1,76 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ignore_for_file: avoid_print + +// Runs `dart test -p chrome` in the root of the cross_file package. +// +// Called from the custom-tests CI action. +// +// usage: dart run tool/run_tests.dart +// (needs a `chrome` executable in $PATH, or a tweak to dart_test.yaml) +import 'dart:async'; +import 'dart:io'; +import 'package:path/path.dart' as p; + +Future main(List args) async { + if (!Platform.isLinux) { + // The test was migrated from a Linux-only task, so this preserves behavior. + // If desired, it can be enabled for other platforms in the future. + print('Skipping for non-Linux host'); + exit(0); + } + + final Directory packageDir = + Directory(p.dirname(Platform.script.path)).parent; + final String testingAppDirPath = + p.join(packageDir.path, 'testing', 'test_app'); + + // Fetch the test app's dependencies. + int status = await _runProcess( + 'flutter', + [ + 'pub', + 'get', + ], + workingDirectory: testingAppDirPath, + ); + if (status != 0) { + exit(status); + } + + // Run the tests. + status = await _runProcess( + 'flutter', + [ + 'test', + 'testing', + ], + workingDirectory: packageDir.path, + ); + + exit(status); +} + +Future _streamOutput(Future processFuture) async { + final Process process = await processFuture; + await Future.wait(>[ + stdout.addStream(process.stdout), + stderr.addStream(process.stderr), + ]); + return process; +} + +Future _runProcess( + String command, + List arguments, { + String? workingDirectory, +}) async { + final Process process = await _streamOutput(Process.start( + command, + arguments, + workingDirectory: workingDirectory, + )); + return process.exitCode; +}