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.
This commit is contained in:
Greg Price
2023-02-07 16:04:23 -08:00
committed by GitHub
parent aed9b4adce
commit 98b3e48ed4
4 changed files with 16 additions and 11 deletions

View File

@@ -47,10 +47,9 @@ Future<void> main(List<String> 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

View File

@@ -60,9 +60,9 @@ Future<void> 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.

View File

@@ -271,11 +271,9 @@ Future<void> main(List<String> 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'] ?? '';

View File

@@ -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<String> 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.