Unverified Commit 54f674c2 authored by Daco Harkes's avatar Daco Harkes Committed by GitHub

Migrate bots/test.dart from `pub run` to `dart run` (#97575)

parent 2b14a3ec
...@@ -34,7 +34,6 @@ final String bat = Platform.isWindows ? '.bat' : ''; ...@@ -34,7 +34,6 @@ final String bat = Platform.isWindows ? '.bat' : '';
final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script)))); final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
final String flutter = path.join(flutterRoot, 'bin', 'flutter$bat'); final String flutter = path.join(flutterRoot, 'bin', 'flutter$bat');
final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dart$exe'); final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dart$exe');
final String pub = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'pub$bat');
final String pubCache = path.join(flutterRoot, '.pub-cache'); final String pubCache = path.join(flutterRoot, '.pub-cache');
final String toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools'); final String toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools');
final String engineVersionFile = path.join(flutterRoot, 'bin', 'internal', 'engine.version'); final String engineVersionFile = path.join(flutterRoot, 'bin', 'internal', 'engine.version');
...@@ -340,7 +339,7 @@ Future<void> _runSmokeTests() async { ...@@ -340,7 +339,7 @@ Future<void> _runSmokeTests() async {
} }
Future<void> _runGeneralToolTests() async { Future<void> _runGeneralToolTests() async {
await _pubRunTest( await _dartRunTest(
path.join(flutterRoot, 'packages', 'flutter_tools'), path.join(flutterRoot, 'packages', 'flutter_tools'),
testPaths: <String>[path.join('test', 'general.shard')], testPaths: <String>[path.join('test', 'general.shard')],
enableFlutterToolAsserts: false, enableFlutterToolAsserts: false,
...@@ -352,7 +351,7 @@ Future<void> _runGeneralToolTests() async { ...@@ -352,7 +351,7 @@ Future<void> _runGeneralToolTests() async {
} }
Future<void> _runCommandsToolTests() async { Future<void> _runCommandsToolTests() async {
await _pubRunTest( await _dartRunTest(
path.join(flutterRoot, 'packages', 'flutter_tools'), path.join(flutterRoot, 'packages', 'flutter_tools'),
forceSingleCore: true, forceSingleCore: true,
testPaths: <String>[path.join('test', 'commands.shard')], testPaths: <String>[path.join('test', 'commands.shard')],
...@@ -360,7 +359,7 @@ Future<void> _runCommandsToolTests() async { ...@@ -360,7 +359,7 @@ Future<void> _runCommandsToolTests() async {
} }
Future<void> _runWebToolTests() async { Future<void> _runWebToolTests() async {
await _pubRunTest( await _dartRunTest(
path.join(flutterRoot, 'packages', 'flutter_tools'), path.join(flutterRoot, 'packages', 'flutter_tools'),
forceSingleCore: true, forceSingleCore: true,
testPaths: <String>[path.join('test', 'web.shard')], testPaths: <String>[path.join('test', 'web.shard')],
...@@ -375,7 +374,7 @@ Future<void> _runIntegrationToolTests() async { ...@@ -375,7 +374,7 @@ Future<void> _runIntegrationToolTests() async {
.map<String>((FileSystemEntity entry) => path.relative(entry.path, from: toolsPath)) .map<String>((FileSystemEntity entry) => path.relative(entry.path, from: toolsPath))
.where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList(); .where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList();
await _pubRunTest( await _dartRunTest(
toolsPath, toolsPath,
forceSingleCore: true, forceSingleCore: true,
testPaths: _selectIndexOfTotalSubshard<String>(allTests), testPaths: _selectIndexOfTotalSubshard<String>(allTests),
...@@ -851,9 +850,9 @@ Future<void> _runFrameworkTests() async { ...@@ -851,9 +850,9 @@ Future<void> _runFrameworkTests() async {
Future<void> runPrivateTests() async { Future<void> runPrivateTests() async {
final List<String> args = <String>[ final List<String> args = <String>[
'run',
'--sound-null-safety', '--sound-null-safety',
'test_private.dart', 'run',
'bin/test_private.dart',
]; ];
final Map<String, String> environment = <String, String>{ final Map<String, String> environment = <String, String>{
'FLUTTER_ROOT': flutterRoot, 'FLUTTER_ROOT': flutterRoot,
...@@ -862,7 +861,7 @@ Future<void> _runFrameworkTests() async { ...@@ -862,7 +861,7 @@ Future<void> _runFrameworkTests() async {
}; };
adjustEnvironmentToEnableFlutterAsserts(environment); adjustEnvironmentToEnableFlutterAsserts(environment);
await runCommand( await runCommand(
pub, dart,
args, args,
workingDirectory: path.join(flutterRoot, 'packages', 'flutter', 'test_private'), workingDirectory: path.join(flutterRoot, 'packages', 'flutter', 'test_private'),
environment: environment, environment: environment,
...@@ -872,9 +871,9 @@ Future<void> _runFrameworkTests() async { ...@@ -872,9 +871,9 @@ Future<void> _runFrameworkTests() async {
Future<void> runMisc() async { Future<void> runMisc() async {
print('${green}Running package tests$reset for directories other than packages/flutter'); print('${green}Running package tests$reset for directories other than packages/flutter');
await runExampleTests(); await runExampleTests();
await _pubRunTest(path.join(flutterRoot, 'dev', 'bots')); await _dartRunTest(path.join(flutterRoot, 'dev', 'bots'));
await _pubRunTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209 await _dartRunTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209
await _pubRunTest(path.join(flutterRoot, 'dev', 'conductor', 'core'), forceSingleCore: true); await _dartRunTest(path.join(flutterRoot, 'dev', 'conductor', 'core'), forceSingleCore: true);
// TODO(gspencergoog): Remove the exception for fatalWarnings once https://github.com/flutter/flutter/pull/91127 has landed. // TODO(gspencergoog): Remove the exception for fatalWarnings once https://github.com/flutter/flutter/pull/91127 has landed.
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'android_semantics_testing'), fatalWarnings: false); await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'android_semantics_testing'), fatalWarnings: false);
await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests')); await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests'));
...@@ -1605,7 +1604,7 @@ Future<void> _runFlutterWebTest(String webRenderer, String workingDirectory, Lis ...@@ -1605,7 +1604,7 @@ Future<void> _runFlutterWebTest(String webRenderer, String workingDirectory, Lis
// properly when overriding the local engine (for example, because some platform // properly when overriding the local engine (for example, because some platform
// dependent targets are only built on some engines). // dependent targets are only built on some engines).
// See https://github.com/flutter/flutter/issues/72368 // See https://github.com/flutter/flutter/issues/72368
Future<void> _pubRunTest(String workingDirectory, { Future<void> _dartRunTest(String workingDirectory, {
List<String>? testPaths, List<String>? testPaths,
bool enableFlutterToolAsserts = true, bool enableFlutterToolAsserts = true,
bool useBuildRunner = false, bool useBuildRunner = false,
...@@ -1674,7 +1673,7 @@ Future<void> _pubRunTest(String workingDirectory, { ...@@ -1674,7 +1673,7 @@ Future<void> _pubRunTest(String workingDirectory, {
Stream<String> testOutput; Stream<String> testOutput;
try { try {
testOutput = runAndGetStdout( testOutput = runAndGetStdout(
pub, dart,
args, args,
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
environment: environment, environment: environment,
...@@ -1685,7 +1684,7 @@ Future<void> _pubRunTest(String workingDirectory, { ...@@ -1685,7 +1684,7 @@ Future<void> _pubRunTest(String workingDirectory, {
await _processTestOutput(formatter, testOutput); await _processTestOutput(formatter, testOutput);
} else { } else {
await runCommand( await runCommand(
pub, dart,
args, args,
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
environment: environment, environment: environment,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment