From 54f674c23ab7e0f47f090cbeefe2316c73bfe807 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Wed, 2 Feb 2022 23:40:15 +0100 Subject: [PATCH] Migrate bots/test.dart from `pub run` to `dart run` (#97575) --- dev/bots/test.dart | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 651e4437f3..4390335665 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -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 flutter = path.join(flutterRoot, 'bin', 'flutter$bat'); 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 toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools'); final String engineVersionFile = path.join(flutterRoot, 'bin', 'internal', 'engine.version'); @@ -340,7 +339,7 @@ Future _runSmokeTests() async { } Future _runGeneralToolTests() async { - await _pubRunTest( + await _dartRunTest( path.join(flutterRoot, 'packages', 'flutter_tools'), testPaths: [path.join('test', 'general.shard')], enableFlutterToolAsserts: false, @@ -352,7 +351,7 @@ Future _runGeneralToolTests() async { } Future _runCommandsToolTests() async { - await _pubRunTest( + await _dartRunTest( path.join(flutterRoot, 'packages', 'flutter_tools'), forceSingleCore: true, testPaths: [path.join('test', 'commands.shard')], @@ -360,7 +359,7 @@ Future _runCommandsToolTests() async { } Future _runWebToolTests() async { - await _pubRunTest( + await _dartRunTest( path.join(flutterRoot, 'packages', 'flutter_tools'), forceSingleCore: true, testPaths: [path.join('test', 'web.shard')], @@ -375,7 +374,7 @@ Future _runIntegrationToolTests() async { .map((FileSystemEntity entry) => path.relative(entry.path, from: toolsPath)) .where((String testPath) => path.basename(testPath).endsWith('_test.dart')).toList(); - await _pubRunTest( + await _dartRunTest( toolsPath, forceSingleCore: true, testPaths: _selectIndexOfTotalSubshard(allTests), @@ -851,9 +850,9 @@ Future _runFrameworkTests() async { Future runPrivateTests() async { final List args = [ - 'run', '--sound-null-safety', - 'test_private.dart', + 'run', + 'bin/test_private.dart', ]; final Map environment = { 'FLUTTER_ROOT': flutterRoot, @@ -862,7 +861,7 @@ Future _runFrameworkTests() async { }; adjustEnvironmentToEnableFlutterAsserts(environment); await runCommand( - pub, + dart, args, workingDirectory: path.join(flutterRoot, 'packages', 'flutter', 'test_private'), environment: environment, @@ -872,9 +871,9 @@ Future _runFrameworkTests() async { Future runMisc() async { print('${green}Running package tests$reset for directories other than packages/flutter'); await runExampleTests(); - await _pubRunTest(path.join(flutterRoot, 'dev', 'bots')); - await _pubRunTest(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', 'bots')); + await _dartRunTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209 + 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. await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'android_semantics_testing'), fatalWarnings: false); await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests')); @@ -1605,7 +1604,7 @@ Future _runFlutterWebTest(String webRenderer, String workingDirectory, Lis // properly when overriding the local engine (for example, because some platform // dependent targets are only built on some engines). // See https://github.com/flutter/flutter/issues/72368 -Future _pubRunTest(String workingDirectory, { +Future _dartRunTest(String workingDirectory, { List? testPaths, bool enableFlutterToolAsserts = true, bool useBuildRunner = false, @@ -1674,7 +1673,7 @@ Future _pubRunTest(String workingDirectory, { Stream testOutput; try { testOutput = runAndGetStdout( - pub, + dart, args, workingDirectory: workingDirectory, environment: environment, @@ -1685,7 +1684,7 @@ Future _pubRunTest(String workingDirectory, { await _processTestOutput(formatter, testOutput); } else { await runCommand( - pub, + dart, args, workingDirectory: workingDirectory, environment: environment,