[flutter_tools] provide --timeout option to flutter drive (#114458)
This commit is contained in:
committed by
GitHub
parent
3b0f8335ee
commit
0211df9cfc
@@ -17,7 +17,14 @@ Future<void> main() async {
|
||||
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
|
||||
|
||||
try {
|
||||
await task(NewGalleryPerfTest(galleryDir).run);
|
||||
await task(
|
||||
NewGalleryPerfTest(
|
||||
galleryDir,
|
||||
// time out after 20 minutes allowing the tool to take a screenshot to debug
|
||||
// https://github.com/flutter/flutter/issues/114025.
|
||||
timeoutSeconds: 20 * 60,
|
||||
).run,
|
||||
);
|
||||
} finally {
|
||||
rmTree(galleryParentDir);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class NewGalleryPerfTest extends PerfTest {
|
||||
String timelineFileName = 'transitions',
|
||||
String dartDefine = '',
|
||||
bool enableImpeller = false,
|
||||
super.timeoutSeconds,
|
||||
}) : super(
|
||||
galleryDir.path,
|
||||
'test_driver/transitions_perf.dart',
|
||||
|
||||
@@ -914,6 +914,7 @@ class PerfTest {
|
||||
this.device,
|
||||
this.flutterDriveCallback,
|
||||
this.enableImpeller = false,
|
||||
this.timeoutSeconds,
|
||||
}): _resultFilename = resultFilename;
|
||||
|
||||
const PerfTest.e2e(
|
||||
@@ -929,6 +930,7 @@ class PerfTest {
|
||||
this.device,
|
||||
this.flutterDriveCallback,
|
||||
this.enableImpeller = false,
|
||||
this.timeoutSeconds,
|
||||
}) : saveTraceFile = false, timelineFileName = null, _resultFilename = resultFilename;
|
||||
|
||||
/// The directory where the app under test is defined.
|
||||
@@ -963,6 +965,9 @@ class PerfTest {
|
||||
/// Whether the perf test should enable Impeller.
|
||||
final bool enableImpeller;
|
||||
|
||||
/// Number of seconds to time out the test after, allowing debug callbacks to run.
|
||||
final int? timeoutSeconds;
|
||||
|
||||
/// The keys of the values that need to be reported.
|
||||
///
|
||||
/// If it's `null`, then report:
|
||||
@@ -1020,6 +1025,11 @@ class PerfTest {
|
||||
'-v',
|
||||
'--verbose-system-logs',
|
||||
'--profile',
|
||||
if (timeoutSeconds != null)
|
||||
...<String>[
|
||||
'--timeout',
|
||||
timeoutSeconds.toString(),
|
||||
],
|
||||
if (needsFullTimeline)
|
||||
'--trace-startup', // Enables "endless" timeline event buffering.
|
||||
'-t', testTarget,
|
||||
@@ -1039,7 +1049,7 @@ class PerfTest {
|
||||
if (flutterDriveCallback != null) {
|
||||
flutterDriveCallback!(options);
|
||||
} else {
|
||||
await flutter('drive', options:options);
|
||||
await flutter('drive', options: options);
|
||||
}
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/$resultFilename.json').readAsStringSync(),
|
||||
@@ -1140,7 +1150,7 @@ class PerfTestWithSkSL extends PerfTest {
|
||||
);
|
||||
|
||||
@override
|
||||
Future<TaskResult> run() async {
|
||||
Future<TaskResult> run({int? timeoutSeconds}) async {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
// Some initializations
|
||||
_device = await devices.workingDevice;
|
||||
|
||||
Reference in New Issue
Block a user