From 113013bb07d58132a876c1d86094dce632bc68a9 Mon Sep 17 00:00:00 2001 From: Jesse <103135467+sealesj@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:32:54 -0400 Subject: [PATCH] Refactor customer_testing (#145911) Refactor customer_testing suite in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing customer_testing tests Part of https://github.com/flutter/flutter/issues/145482 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* --- .../run_customer_testing_tests.dart | 51 +++++++++++++++++++ dev/bots/test.dart | 45 +--------------- 2 files changed, 53 insertions(+), 43 deletions(-) create mode 100644 dev/bots/suite_runners/run_customer_testing_tests.dart diff --git a/dev/bots/suite_runners/run_customer_testing_tests.dart b/dev/bots/suite_runners/run_customer_testing_tests.dart new file mode 100644 index 0000000000..d2e8e45e04 --- /dev/null +++ b/dev/bots/suite_runners/run_customer_testing_tests.dart @@ -0,0 +1,51 @@ +// Copyright 2014 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. + +import 'dart:io' show Platform; + +import 'package:path/path.dart' as path; + +import '../run_command.dart'; +import '../utils.dart'; + +Future customerTestingRunner(String flutterRoot) async { + printProgress('${green}Running customer testing$reset'); + await runCommand( + 'git', + const [ + 'fetch', + 'origin', + 'master', + ], + workingDirectory: flutterRoot, + ); + await runCommand( + 'git', + const [ + 'branch', + '-f', + 'master', + 'origin/master', + ], + workingDirectory: flutterRoot, + ); + final Map env = Platform.environment; + final String? revision = env['REVISION']; + if (revision != null) { + await runCommand( + 'git', + [ + 'checkout', + revision, + ], + workingDirectory: flutterRoot, + ); + } + final String winScript = path.join(flutterRoot, 'dev', 'customer_testing', 'ci.bat'); + await runCommand( + Platform.isWindows? winScript: './ci.sh', + [], + workingDirectory: path.join(flutterRoot, 'dev', 'customer_testing'), + ); +} diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 0b2c1f9321..a3fa4d95ab 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -66,6 +66,7 @@ import 'package:process/process.dart'; import 'run_command.dart'; import 'suite_runners/run_add_to_app_life_cycle_tests.dart'; import 'suite_runners/run_analyze_tests.dart'; +import 'suite_runners/run_customer_testing_tests.dart'; import 'suite_runners/run_docs_tests.dart'; import 'suite_runners/run_flutter_packages_tests.dart'; import 'suite_runners/run_realm_checker_tests.dart'; @@ -253,7 +254,7 @@ Future main(List args) async { 'flutter_plugins': () => flutterPackagesRunner(flutterRoot), 'skp_generator': skpGeneratorTestsRunner, 'realm_checker': () => realmCheckerTestRunner(flutterRoot), - 'customer_testing': _runCustomerTesting, + 'customer_testing': () => customerTestingRunner(flutterRoot), 'analyze': () => analyzeRunner(flutterRoot), 'fuchsia_precache': _runFuchsiaPrecache, 'docs': () => docsRunner(flutterRoot), @@ -1198,48 +1199,6 @@ Future _runWebUnitTests(String webRenderer, bool useWasm) async { await selectSubshard(subshards); } -// Runs customer_testing. -Future _runCustomerTesting() async { - printProgress('${green}Running customer testing$reset'); - await runCommand( - 'git', - [ - 'fetch', - 'origin', - 'master', - ], - workingDirectory: flutterRoot, - ); - await runCommand( - 'git', - [ - 'branch', - '-f', - 'master', - 'origin/master', - ], - workingDirectory: flutterRoot, - ); - final Map env = Platform.environment; - final String? revision = env['REVISION']; - if (revision != null) { - await runCommand( - 'git', - [ - 'checkout', - revision, - ], - workingDirectory: flutterRoot, - ); - } - final String winScript = path.join(flutterRoot, 'dev', 'customer_testing', 'ci.bat'); - await runCommand( - Platform.isWindows? winScript: './ci.sh', - [], - workingDirectory: path.join(flutterRoot, 'dev', 'customer_testing'), - ); -} - // Runs flutter_precache. Future _runFuchsiaPrecache() async { printProgress('${green}Running flutter precache tests$reset');