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].*
This commit is contained in:
Jesse 2024-04-03 12:32:54 -04:00 committed by GitHub
parent 80d774d8dc
commit 113013bb07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 53 additions and 43 deletions

View File

@ -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<void> customerTestingRunner(String flutterRoot) async {
printProgress('${green}Running customer testing$reset');
await runCommand(
'git',
const <String>[
'fetch',
'origin',
'master',
],
workingDirectory: flutterRoot,
);
await runCommand(
'git',
const <String>[
'branch',
'-f',
'master',
'origin/master',
],
workingDirectory: flutterRoot,
);
final Map<String, String> env = Platform.environment;
final String? revision = env['REVISION'];
if (revision != null) {
await runCommand(
'git',
<String>[
'checkout',
revision,
],
workingDirectory: flutterRoot,
);
}
final String winScript = path.join(flutterRoot, 'dev', 'customer_testing', 'ci.bat');
await runCommand(
Platform.isWindows? winScript: './ci.sh',
<String>[],
workingDirectory: path.join(flutterRoot, 'dev', 'customer_testing'),
);
}

View File

@ -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<void> main(List<String> 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<void> _runWebUnitTests(String webRenderer, bool useWasm) async {
await selectSubshard(subshards);
}
// Runs customer_testing.
Future<void> _runCustomerTesting() async {
printProgress('${green}Running customer testing$reset');
await runCommand(
'git',
<String>[
'fetch',
'origin',
'master',
],
workingDirectory: flutterRoot,
);
await runCommand(
'git',
<String>[
'branch',
'-f',
'master',
'origin/master',
],
workingDirectory: flutterRoot,
);
final Map<String, String> env = Platform.environment;
final String? revision = env['REVISION'];
if (revision != null) {
await runCommand(
'git',
<String>[
'checkout',
revision,
],
workingDirectory: flutterRoot,
);
}
final String winScript = path.join(flutterRoot, 'dev', 'customer_testing', 'ci.bat');
await runCommand(
Platform.isWindows? winScript: './ci.sh',
<String>[],
workingDirectory: path.join(flutterRoot, 'dev', 'customer_testing'),
);
}
// Runs flutter_precache.
Future<void> _runFuchsiaPrecache() async {
printProgress('${green}Running flutter precache tests$reset');