From c1ed02c7a269d2481bb14e7c803052f68533e403 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 10 Jul 2023 13:56:46 -0400 Subject: [PATCH 1/4] Add custom test script --- packages/web_benchmarks/tool/run_tests.dart | 74 +++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 packages/web_benchmarks/tool/run_tests.dart diff --git a/packages/web_benchmarks/tool/run_tests.dart b/packages/web_benchmarks/tool/run_tests.dart new file mode 100644 index 00000000000..ec2a7529842 --- /dev/null +++ b/packages/web_benchmarks/tool/run_tests.dart @@ -0,0 +1,74 @@ +// 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) { + 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; +} From 7a71b72dd7e091ff9cd0c19b2a3142e21eb8cab7 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 10 Jul 2023 13:59:34 -0400 Subject: [PATCH 2/4] Remove web_benchmark_tests Cirrus task --- .cirrus.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c3111708ca7..9351f72ac31 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -180,16 +180,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 From 546868bf07f4677bac72d733a1c56ad45b270538 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 10 Jul 2023 14:32:49 -0400 Subject: [PATCH 3/4] Add Chrome to bot config --- .ci.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index b507e185c66..d147c0ac1d7 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 @@ -253,11 +255,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 From f1bab9d602a3219d291969d8615ea519f2b0d8a3 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 10 Jul 2023 14:34:09 -0400 Subject: [PATCH 4/4] Add explanatory comment --- packages/web_benchmarks/tool/run_tests.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/web_benchmarks/tool/run_tests.dart b/packages/web_benchmarks/tool/run_tests.dart index ec2a7529842..3e0fb093442 100644 --- a/packages/web_benchmarks/tool/run_tests.dart +++ b/packages/web_benchmarks/tool/run_tests.dart @@ -16,6 +16,8 @@ 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); }