Unverified Commit 22c1ca76 authored by Dan Field's avatar Dan Field Committed by GitHub

Add a startup test that delays runApp (#91346)

parent 1c374c65
...@@ -1474,6 +1474,17 @@ targets: ...@@ -1474,6 +1474,17 @@ targets:
task_name: flutter_gallery__start_up task_name: flutter_gallery__start_up
scheduler: luci scheduler: luci
- name: Linux_android flutter_gallery__start_up_delayed
recipe: devicelab/devicelab_drone
bringup: true
presubmit: false
timeout: 60
properties:
tags: >
["devicelab","android","linux"]
task_name: flutter_gallery__start_up_delayed
scheduler: luci
- name: Linux_android flutter_gallery_android__compile - name: Linux_android flutter_gallery_android__compile
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
presubmit: false presubmit: false
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
/dev/devicelab/bin/tasks/flutter_gallery__image_cache_memory.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__image_cache_memory.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__memory_nav.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__memory_nav.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__start_up.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__start_up.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__start_up_delayed.dart @dnfield @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_e2e.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__transition_perf_e2e.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_hybrid.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__transition_perf_hybrid.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/flutter_gallery__transition_perf_with_semantics.dart @zanderso @flutter/engine
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createFlutterGalleryStartupTest(target: 'lib/delayed_main.dart'));
}
...@@ -215,9 +215,10 @@ TaskFunction createPictureCachePerfE2ETest() { ...@@ -215,9 +215,10 @@ TaskFunction createPictureCachePerfE2ETest() {
).run; ).run;
} }
TaskFunction createFlutterGalleryStartupTest() { TaskFunction createFlutterGalleryStartupTest({String target = 'lib/main.dart'}) {
return StartupTest( return StartupTest(
'${flutterDirectory.path}/dev/integration_tests/flutter_gallery', '${flutterDirectory.path}/dev/integration_tests/flutter_gallery',
target: target,
).run; ).run;
} }
...@@ -502,10 +503,11 @@ Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations ...@@ -502,10 +503,11 @@ Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations
/// Measure application startup performance. /// Measure application startup performance.
class StartupTest { class StartupTest {
const StartupTest(this.testDirectory, { this.reportMetrics = true }); const StartupTest(this.testDirectory, { this.reportMetrics = true, this.target = 'lib/main.dart' });
final String testDirectory; final String testDirectory;
final bool reportMetrics; final bool reportMetrics;
final String target;
Future<TaskResult> run() async { Future<TaskResult> run() async {
return inDirectory<TaskResult>(testDirectory, () async { return inDirectory<TaskResult>(testDirectory, () async {
...@@ -522,6 +524,7 @@ class StartupTest { ...@@ -522,6 +524,7 @@ class StartupTest {
'-v', '-v',
'--profile', '--profile',
'--target-platform=android-arm,android-arm64', '--target-platform=android-arm,android-arm64',
'--target=$target',
]); ]);
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk'; applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
break; break;
...@@ -531,6 +534,7 @@ class StartupTest { ...@@ -531,6 +534,7 @@ class StartupTest {
'-v', '-v',
'--profile', '--profile',
'--target-platform=android-arm', '--target-platform=android-arm',
'--target=$target',
]); ]);
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk'; applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
break; break;
...@@ -540,6 +544,7 @@ class StartupTest { ...@@ -540,6 +544,7 @@ class StartupTest {
'-v', '-v',
'--profile', '--profile',
'--target-platform=android-arm64', '--target-platform=android-arm64',
'--target=$target',
]); ]);
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk'; applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
break; break;
...@@ -548,6 +553,7 @@ class StartupTest { ...@@ -548,6 +553,7 @@ class StartupTest {
'ios', 'ios',
'-v', '-v',
'--profile', '--profile',
'--target=$target',
]); ]);
applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos'); applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos');
break; break;
...@@ -565,6 +571,7 @@ class StartupTest { ...@@ -565,6 +571,7 @@ class StartupTest {
'--verbose', '--verbose',
'--profile', '--profile',
'--trace-startup', '--trace-startup',
'--target=$target',
'-d', '-d',
device.deviceId, device.deviceId,
if (applicationBinaryPath != null) if (applicationBinaryPath != null)
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'gallery/app.dart';
Object? createGarbage() {
final List<dynamic> garbage = <dynamic>[];
for (int index = 0; index < 1000; index += 1) {
final List<int> moreGarbage = List<int>.filled(1000, index);
if (index.isOdd) {
garbage.add(moreGarbage);
}
}
return garbage;
}
Future<void> main() async {
// Create some garbage, and simulate some delays between that could be
// plugin or network call related.
final List<dynamic> garbage = <dynamic>[];
for (int index = 0; index < 20; index += 1) {
final Object? moreGarbage = createGarbage();
if (index.isOdd) {
garbage.add(moreGarbage);
await Future<void>.delayed(const Duration(milliseconds: 7));
}
}
runApp(const GalleryApp());
}
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