Migrate customer_testing to sharded tests. (#138659)

This will allow Dart Team to run customer tests as part of monorepo and will be a step forward to remove ad_hoc tests.

Bug: https://github.com/dart-lang/sdk/issues/51042
Bug: https://github.com/flutter/flutter/issues/115476
This commit is contained in:
godofredoc
2023-11-27 16:41:53 -08:00
committed by GitHub
parent fc203edcbf
commit fe7299d318
7 changed files with 66 additions and 28 deletions

View File

@@ -89,11 +89,12 @@ Future<Command> startCommand(String executable, List<String> arguments, {
bool Function(String)? removeLine,
void Function(String, io.Process)? outputListener,
}) async {
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
final String relativeWorkingDir = path.relative(workingDirectory ?? io.Directory.current.path);
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
print('RUNNING: cd $cyan$relativeWorkingDir$reset; $green$commandDescription$reset');
final Stopwatch time = Stopwatch()..start();
print('workingDirectory: $workingDirectory, executable: $executable, arguments: $arguments');
final io.Process process = await io.Process.start(executable, arguments,
workingDirectory: workingDirectory,
environment: environment,
@@ -160,7 +161,7 @@ Future<CommandResult> runCommand(String executable, List<String> arguments, {
void Function(String, io.Process)? outputListener,
}) async {
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
final String relativeWorkingDir = path.relative(workingDirectory ?? io.Directory.current.path);
final String relativeWorkingDir = workingDirectory ?? path.relative(io.Directory.current.path);
final Command command = await startCommand(executable, arguments,
workingDirectory: workingDirectory,

View File

@@ -263,6 +263,7 @@ Future<void> main(List<String> args) async {
'flutter_plugins': _runFlutterPackagesTests,
'skp_generator': _runSkpGeneratorTests,
'realm_checker': _runRealmCheckerTest,
'customer_testing': _runCustomerTesting,
kTestHarnessShardName: _runTestHarnessTests, // Used for testing this script; also run as part of SHARD=framework_tests, SUBSHARD=misc.
});
} catch (error, stackTrace) {
@@ -1547,6 +1548,46 @@ Future<void> _runFlutterPackagesTests() async {
});
}
// 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>[
'checkout',
'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 the skp_generator from the flutter/tests repo.
///
/// See also the customer_tests shard.