Separate tools tests from other tests and put them in a different shard. (#19593)
diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index e49ba77..a88eaa0 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -24,10 +24,13 @@
final String yellow = hasColor ? '\x1B[33m' : '';
final String cyan = hasColor ? '\x1B[36m' : '';
final String reset = hasColor ? '\x1B[0m' : '';
+const String arrow = 'β©';
+const String clock = 'π';
const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
'analyze': _analyzeRepo,
'tests': _runTests,
+ 'tool_tests': _runToolTests,
'coverage': _runCoverage,
// 'docs': handled by travis_script.sh and docs.sh
// 'build_and_deploy_gallery': handled by travis_script.sh
@@ -172,7 +175,7 @@
print('${bold}DONE: Analysis successful.$reset');
}
-Future<Null> _runTests() async {
+Future<Null> _runSmokeTests() async {
// Verify that the tests actually return failure on failure and success on
// success.
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
@@ -250,14 +253,24 @@
// Verify that we correctly generated the version file.
await _verifyVersion(path.join(flutterRoot, 'version'));
+}
- // Run tests.
+Future<Null> _runToolTests() async {
+ await _runSmokeTests();
+
+ await _pubRunTest(path.join(flutterRoot, 'packages', 'flutter_tools'));
+
+ print('${bold}DONE: All tests successful.$reset');
+}
+
+Future<Null> _runTests() async {
+ await _runSmokeTests();
+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'));
- await _pubRunTest(path.join(flutterRoot, 'packages', 'flutter_tools'));
await _pubRunTest(path.join(flutterRoot, 'dev', 'bots'));
await _pubRunTest(path.join(flutterRoot, 'dev', 'devicelab'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests'));
@@ -336,6 +349,7 @@
}
_printProgress('RUNNING', relativeWorkingDir, commandDescription);
+ final DateTime start = new DateTime.now();
final Process process = await Process.start(executable, arguments,
workingDirectory: workingDirectory,
environment: environment,
@@ -349,6 +363,8 @@
stderr: utf8.decode((await savedStderr).expand((List<int> ints) => ints).toList()),
);
+ print('$clock ELAPSED TIME: $bold${elapsedTime(start)}$reset for $commandDescription in $relativeWorkingDir: ');
+
if (exitCode != 0) {
stderr.write(result.stderr);
print(
@@ -364,6 +380,10 @@
return result;
}
+String elapsedTime(DateTime start) {
+ return new DateTime.now().difference(start).toString();
+}
+
Future<Null> _runCommand(String executable, List<String> arguments, {
String workingDirectory,
Map<String, String> environment,
@@ -381,6 +401,7 @@
}
_printProgress('RUNNING', relativeWorkingDir, commandDescription);
+ final DateTime start = new DateTime.now();
final Process process = await Process.start(executable, arguments,
workingDirectory: workingDirectory,
environment: environment,
@@ -401,6 +422,7 @@
stderr.writeln('Process timed out after $timeout');
return expectFailure ? 0 : 1;
});
+ print('$clock ELAPSED TIME: $bold${elapsedTime(start)}$reset for $commandDescription in $relativeWorkingDir: ');
if ((exitCode == 0) == expectFailure || (expectedExitCode != null && exitCode != expectedExitCode)) {
if (!printOutput) {
stdout.writeln(utf8.decode((await savedStdout).expand((List<int> ints) => ints).toList()));
@@ -409,6 +431,8 @@
print(
'$redβββββββββββββββββββββββββββββββββββββββββββββββββββ$reset\n'
'${bold}ERROR:$red Last command exited with $exitCode (expected: ${expectFailure ? 'non-zero' : 'zero'}).$reset\n'
+ '${bold}Command:$cyan $commandDescription$reset\n'
+ '${bold}Relative working directory:$red $relativeWorkingDir$reset\n'
'$redβββββββββββββββββββββββββββββββββββββββββββββββββββ$reset'
);
exit(1);
@@ -606,7 +630,6 @@
}
void _printProgress(String action, String workingDir, String command) {
- const String arrow = 'β©';
print('$arrow $action: cd $cyan$workingDir$reset; $yellow$command$reset');
}
@@ -666,9 +689,10 @@
bool _isGeneratedPluginRegistrant(File file) {
final String filename = path.basename(file.path);
- return filename == 'GeneratedPluginRegistrant.java' ||
- filename == 'GeneratedPluginRegistrant.h' ||
- filename == 'GeneratedPluginRegistrant.m';
+ return !file.path.contains('.pub-cache')
+ && (filename == 'GeneratedPluginRegistrant.java' ||
+ filename == 'GeneratedPluginRegistrant.h' ||
+ filename == 'GeneratedPluginRegistrant.m');
}
Future<Null> _verifyVersion(String filename) async {