[flutter_tool] support --use-application-binary in flutter drive (#68060)
--use-application-binary allows running with an already built APK. This can be useful for speeding up CI test cases, or in our case eventually supporting some sort of build server. Demonstrate that this works by updating the old gallery test to use it. Fixes #56604 Co-authored-by: Jenn Magder <magder@google.com>
This commit is contained in:
@@ -62,21 +62,40 @@ class GalleryTransitionTest {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
final String deviceId = device.deviceId;
|
||||
final Directory galleryDirectory =
|
||||
dir('${flutterDirectory.path}/dev/integration_tests/flutter_gallery');
|
||||
final Directory galleryDirectory = dir('${flutterDirectory.path}/dev/integration_tests/flutter_gallery');
|
||||
await inDirectory<void>(galleryDirectory, () async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
String applicationBinaryPath;
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.android) {
|
||||
section('BUILDING APPLICATION');
|
||||
await flutter(
|
||||
'build',
|
||||
options: <String>[
|
||||
'apk',
|
||||
'--profile',
|
||||
'-t',
|
||||
'test_driver/$testFile.dart',
|
||||
'--target-platform',
|
||||
'android-arm,android-arm64',
|
||||
],
|
||||
);
|
||||
applicationBinaryPath = 'build/app/outputs/flutter-apk/app-profile.apk';
|
||||
}
|
||||
|
||||
final String testDriver = driverFile ?? (semanticsEnabled
|
||||
? '${testFile}_with_semantics_test'
|
||||
: '${testFile}_test');
|
||||
|
||||
section('DRIVE START');
|
||||
await flutter('drive', options: <String>[
|
||||
'--profile',
|
||||
if (needFullTimeline)
|
||||
'--trace-startup',
|
||||
'-t',
|
||||
'test_driver/$testFile.dart',
|
||||
if (applicationBinaryPath != null)
|
||||
'--use-application-binary=$applicationBinaryPath'
|
||||
else
|
||||
...<String>[
|
||||
'-t',
|
||||
'test_driver/$testFile.dart',
|
||||
],
|
||||
'--driver',
|
||||
'test_driver/$testDriver.dart',
|
||||
'-d',
|
||||
|
||||
@@ -572,7 +572,6 @@ class PerfTest {
|
||||
@protected
|
||||
Future<TaskResult> internalRun({
|
||||
bool cacheSkSL = false,
|
||||
bool noBuild = false,
|
||||
String existingApp,
|
||||
String writeSkslFileName,
|
||||
}) {
|
||||
@@ -589,7 +588,6 @@ class PerfTest {
|
||||
if (needsFullTimeline)
|
||||
'--trace-startup', // Enables "endless" timeline event buffering.
|
||||
'-t', testTarget,
|
||||
if (noBuild) '--no-build',
|
||||
if (testDriver != null)
|
||||
...<String>['--driver', testDriver],
|
||||
if (existingApp != null)
|
||||
@@ -730,7 +728,6 @@ class PerfTestWithSkSL extends PerfTest {
|
||||
// that we won't remove the SkSLs generated earlier.
|
||||
await super.internalRun(
|
||||
cacheSkSL: true,
|
||||
noBuild: true,
|
||||
writeSkslFileName: _skslJsonFileName,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user