diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index 304b4068dd..df185c8e15 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -47,10 +47,9 @@ Future main(List arguments) async { printProgress('STARTING ANALYSIS'); await run(arguments); if (hasError) { - printProgress('${bold}Test failed.$reset'); - reportErrorsAndExit(); + reportErrorsAndExit('${bold}Analysis failed.$reset'); } - printProgress('${bold}Analysis successful.$reset'); + reportSuccessAndExit('${bold}Analysis successful.$reset'); } /// Scans [arguments] for an argument of the form `--dart-sdk` or diff --git a/dev/bots/service_worker_test.dart b/dev/bots/service_worker_test.dart index 95d898b915..8454ed648c 100644 --- a/dev/bots/service_worker_test.dart +++ b/dev/bots/service_worker_test.dart @@ -60,9 +60,9 @@ Future main() async { await runWebServiceWorkerTestWithBlockedServiceWorkers(headless: false); if (hasError) { - print('One or more tests failed.'); - reportErrorsAndExit(); + reportErrorsAndExit('${bold}One or more tests failed.$reset'); } + reportSuccessAndExit('${bold}Tests successful.$reset'); } // Regression test for https://github.com/flutter/flutter/issues/109093. diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 388023da8e..bd8f32e2d2 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -271,11 +271,9 @@ Future main(List args) async { system.exit(255); } if (hasError) { - printProgress('${bold}Test failed.$reset'); - reportErrorsAndExit(); + reportErrorsAndExit('${bold}Test failed.$reset'); } - printProgress('${bold}Test successful.$reset'); - system.exit(0); + reportSuccessAndExit('${bold}Test successful.$reset'); } final String _luciBotId = Platform.environment['SWARMING_BOT_ID'] ?? ''; diff --git a/dev/bots/utils.dart b/dev/bots/utils.dart index 91d744d5af..24f0298c4c 100644 --- a/dev/bots/utils.dart +++ b/dev/bots/utils.dart @@ -119,9 +119,17 @@ void resetErrorStatus() { _hideTimer = null; } -Never reportErrorsAndExit() { +Never reportSuccessAndExit(String message) { _hideTimer?.cancel(); _hideTimer = null; + print('$clock $message$reset'); + system.exit(0); +} + +Never reportErrorsAndExit(String message) { + _hideTimer?.cancel(); + _hideTimer = null; + print('$clock $message$reset'); print(redLine); print('${red}For your convenience, the error messages reported above are repeated here:$reset'); final bool printSeparators = _errorMessages.any((List messages) => messages.length > 1); @@ -143,7 +151,7 @@ void printProgress(String message) { _pendingLogs.clear(); _hideTimer?.cancel(); _hideTimer = null; - print('$clock $message $reset'); + print('$clock $message$reset'); if (hasColor) { // This sets up a timer to switch to verbose mode when the tests take too long, // so that if a test hangs we can see the logs.