forked from firka/flutter
Add debugging for iOS startup test flakes (#130099)
Adding debugging for https://github.com/flutter/flutter/issues/129836. Takes a screenshot when startup test takes too long (10 minutes). Also, removes some old debugging and add new debugging message.
This commit is contained in:
committed by
GitHub
parent
d55a7d89e0
commit
6683468f0b
@@ -771,6 +771,15 @@ class StartupTest {
|
||||
const int maxFailures = 3;
|
||||
int currentFailures = 0;
|
||||
for (int i = 0; i < iterations; i += 1) {
|
||||
// Startup should not take more than a few minutes. After 10 minutes,
|
||||
// take a screenshot to help debug.
|
||||
final Timer timer = Timer(const Duration(minutes: 10), () async {
|
||||
print('Startup not completed within 10 minutes. Taking a screenshot...');
|
||||
await _flutterScreenshot(
|
||||
device.deviceId,
|
||||
'screenshot_startup_${DateTime.now().toLocal().toIso8601String()}.png',
|
||||
);
|
||||
});
|
||||
final int result = await flutter('run', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'--no-publish-port',
|
||||
@@ -782,7 +791,8 @@ class StartupTest {
|
||||
device.deviceId,
|
||||
if (applicationBinaryPath != null)
|
||||
'--use-application-binary=$applicationBinaryPath',
|
||||
], canFail: true);
|
||||
], canFail: true);
|
||||
timer.cancel();
|
||||
if (result == 0) {
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/start_up_info.json').readAsStringSync(),
|
||||
@@ -790,20 +800,10 @@ class StartupTest {
|
||||
results.add(data);
|
||||
} else {
|
||||
currentFailures += 1;
|
||||
if (hostAgent.dumpDirectory != null) {
|
||||
await flutter(
|
||||
'screenshot',
|
||||
options: <String>[
|
||||
'-d',
|
||||
device.deviceId,
|
||||
'--out',
|
||||
hostAgent.dumpDirectory!
|
||||
.childFile('screenshot_startup_failure_$currentFailures.png')
|
||||
.path,
|
||||
],
|
||||
canFail: true,
|
||||
);
|
||||
}
|
||||
await _flutterScreenshot(
|
||||
device.deviceId,
|
||||
'screenshot_startup_failure_$currentFailures.png',
|
||||
);
|
||||
i -= 1;
|
||||
if (currentFailures == maxFailures) {
|
||||
return TaskResult.failure('Application failed to start $maxFailures times');
|
||||
@@ -829,6 +829,23 @@ class StartupTest {
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _flutterScreenshot(String deviceId, String screenshotName) async {
|
||||
if (hostAgent.dumpDirectory != null) {
|
||||
await flutter(
|
||||
'screenshot',
|
||||
options: <String>[
|
||||
'-d',
|
||||
deviceId,
|
||||
'--out',
|
||||
hostAgent.dumpDirectory!
|
||||
.childFile(screenshotName)
|
||||
.path,
|
||||
],
|
||||
canFail: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A one-off test to verify that devtools starts in profile mode.
|
||||
|
||||
Reference in New Issue
Block a user