Skip to content

Commit c15aa87

Browse files
restore quit timeout, adjust some integration test behaviors (flutter#55812)
1 parent ffcf1db commit c15aa87

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

dev/devicelab/bin/tasks/flutter_attach_test_android.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ Future<void> testReload(Process process, { Future<void> Function() onListening }
5353
process.exitCode.then<void>((int processExitCode) { exitCode = processExitCode; });
5454

5555
Future<dynamic> eventOrExit(Future<void> event) {
56-
return Future.any<dynamic>(<Future<dynamic>>[ event, process.exitCode ]);
56+
return Future.any<dynamic>(<Future<dynamic>>[
57+
event,
58+
process.exitCode,
59+
// Keep the test from running for 15 minutes if it gets stuck.
60+
Future<void>.delayed(const Duration(seconds: 10)),
61+
]);
5762
}
5863

5964
await eventOrExit(listening.future);
@@ -63,13 +68,16 @@ Future<void> testReload(Process process, { Future<void> Function() onListening }
6368
throw TaskResult.failure('Failed to attach to test app; command unexpected exited, with exit code $exitCode.');
6469

6570
process.stdin.write('r');
66-
process.stdin.flush();
71+
print('run:stdin: r');
72+
await process.stdin.flush();
6773
await eventOrExit(reloaded.future);
6874
process.stdin.write('R');
69-
process.stdin.flush();
75+
print('run:stdin: R');
76+
await process.stdin.flush();
7077
await eventOrExit(restarted.future);
7178
process.stdin.write('q');
72-
process.stdin.flush();
79+
print('run:stdin: q');
80+
await process.stdin.flush();
7381
await eventOrExit(finished.future);
7482

7583
await process.exitCode;

packages/flutter_tools/lib/src/resident_runner.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,19 @@ class FlutterDevice {
286286
));
287287
}
288288
}
289-
return vmService.onDone;
289+
return vmService.onDone
290+
.catchError((dynamic error, StackTrace stackTrace) {
291+
globals.logger.printError(
292+
'unhanlded error waiting for vm service exit:\n $error',
293+
stackTrace: stackTrace,
294+
);
295+
})
296+
.timeout(const Duration(seconds: 2), onTimeout: () {
297+
// TODO(jonahwilliams): this only seems to fail on CI in the
298+
// flutter_attach_android_test. This log should help verify this
299+
// is where the tool is getting stuck.
300+
globals.logger.printTrace('error: vm service shutdown failed');
301+
});
290302
}
291303

292304
Future<Uri> setupDevFS(

0 commit comments

Comments
 (0)