Unverified Commit 98b3e48e authored by Greg Price's avatar Greg Price Committed by GitHub

Fix hang on successful dev/bots/analyze.dart (#117660)

Fixes #117659

It turns out this was due to the output-suppression timer introduced
recently as part of cleaning up the output (#109206); on success, the
script would wait 10 minutes for the timeout to expire.  This didn't
affect CI because this feature doesn't apply in CI (as detected by
lack of color on stdout.)

Fix the issue by cleaning up the timer on success in the same way
as on failure.

While here, clean up the final summary messages slightly,
and also cut the trailing space that printProgress was leaving
on each line.
parent aed9b4ad
...@@ -47,10 +47,9 @@ Future<void> main(List<String> arguments) async { ...@@ -47,10 +47,9 @@ Future<void> main(List<String> arguments) async {
printProgress('STARTING ANALYSIS'); printProgress('STARTING ANALYSIS');
await run(arguments); await run(arguments);
if (hasError) { if (hasError) {
printProgress('${bold}Test failed.$reset'); reportErrorsAndExit('${bold}Analysis failed.$reset');
reportErrorsAndExit();
} }
printProgress('${bold}Analysis successful.$reset'); reportSuccessAndExit('${bold}Analysis successful.$reset');
} }
/// Scans [arguments] for an argument of the form `--dart-sdk` or /// Scans [arguments] for an argument of the form `--dart-sdk` or
......
...@@ -60,9 +60,9 @@ Future<void> main() async { ...@@ -60,9 +60,9 @@ Future<void> main() async {
await runWebServiceWorkerTestWithBlockedServiceWorkers(headless: false); await runWebServiceWorkerTestWithBlockedServiceWorkers(headless: false);
if (hasError) { if (hasError) {
print('One or more tests failed.'); reportErrorsAndExit('${bold}One or more tests failed.$reset');
reportErrorsAndExit();
} }
reportSuccessAndExit('${bold}Tests successful.$reset');
} }
// Regression test for https://github.com/flutter/flutter/issues/109093. // Regression test for https://github.com/flutter/flutter/issues/109093.
......
...@@ -271,11 +271,9 @@ Future<void> main(List<String> args) async { ...@@ -271,11 +271,9 @@ Future<void> main(List<String> args) async {
system.exit(255); system.exit(255);
} }
if (hasError) { if (hasError) {
printProgress('${bold}Test failed.$reset'); reportErrorsAndExit('${bold}Test failed.$reset');
reportErrorsAndExit();
} }
printProgress('${bold}Test successful.$reset'); reportSuccessAndExit('${bold}Test successful.$reset');
system.exit(0);
} }
final String _luciBotId = Platform.environment['SWARMING_BOT_ID'] ?? ''; final String _luciBotId = Platform.environment['SWARMING_BOT_ID'] ?? '';
......
...@@ -119,9 +119,17 @@ void resetErrorStatus() { ...@@ -119,9 +119,17 @@ void resetErrorStatus() {
_hideTimer = null; _hideTimer = null;
} }
Never reportErrorsAndExit() { Never reportSuccessAndExit(String message) {
_hideTimer?.cancel(); _hideTimer?.cancel();
_hideTimer = null; _hideTimer = null;
print('$clock $message$reset');
system.exit(0);
}
Never reportErrorsAndExit(String message) {
_hideTimer?.cancel();
_hideTimer = null;
print('$clock $message$reset');
print(redLine); print(redLine);
print('${red}For your convenience, the error messages reported above are repeated here:$reset'); print('${red}For your convenience, the error messages reported above are repeated here:$reset');
final bool printSeparators = _errorMessages.any((List<String> messages) => messages.length > 1); final bool printSeparators = _errorMessages.any((List<String> messages) => messages.length > 1);
...@@ -143,7 +151,7 @@ void printProgress(String message) { ...@@ -143,7 +151,7 @@ void printProgress(String message) {
_pendingLogs.clear(); _pendingLogs.clear();
_hideTimer?.cancel(); _hideTimer?.cancel();
_hideTimer = null; _hideTimer = null;
print('$clock $message $reset'); print('$clock $message$reset');
if (hasColor) { if (hasColor) {
// This sets up a timer to switch to verbose mode when the tests take too long, // 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. // so that if a test hangs we can see the logs.
......
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