mirror of
https://github.com/flutter/flutter
synced 2024-09-13 13:21:36 +00:00
parent
7e4822d5d6
commit
67810d672b
10
.ci.yaml
10
.ci.yaml
|
@ -4042,16 +4042,6 @@ targets:
|
|||
["devicelab", "ios", "mac"]
|
||||
task_name: flutter_gallery__transition_perf_e2e_impeller_ios
|
||||
|
||||
- name: Mac_ios flutter_gallery_ios_sksl_warmup__transition_perf
|
||||
bringup: true # Flaky https://github.com/flutter/flutter/issues/121231
|
||||
recipe: devicelab/devicelab_drone
|
||||
presubmit: false
|
||||
timeout: 60
|
||||
properties:
|
||||
tags: >
|
||||
["devicelab", "ios", "mac"]
|
||||
task_name: flutter_gallery_ios_sksl_warmup__transition_perf
|
||||
|
||||
- name: Mac_ios spell_check_test
|
||||
recipe: devicelab/devicelab_drone
|
||||
presubmit: false
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// 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.ios;
|
||||
await task(createFlutterGalleryTransitionsPerfSkSLWarmupTest());
|
||||
}
|
|
@ -128,14 +128,6 @@ TaskFunction createCubicBezierPerfE2ETest() {
|
|||
).run;
|
||||
}
|
||||
|
||||
TaskFunction createFlutterGalleryTransitionsPerfSkSLWarmupTest() {
|
||||
return PerfTestWithSkSL(
|
||||
'${flutterDirectory.path}/dev/integration_tests/flutter_gallery',
|
||||
'test_driver/transitions_perf.dart',
|
||||
'transitions',
|
||||
).run;
|
||||
}
|
||||
|
||||
TaskFunction createBackdropFilterPerfTest({
|
||||
bool measureCpuGpu = true,
|
||||
bool enableImpeller = false,
|
||||
|
@ -1025,9 +1017,7 @@ class PerfTest {
|
|||
|
||||
@protected
|
||||
Future<TaskResult> internalRun({
|
||||
bool cacheSkSL = false,
|
||||
String? existingApp,
|
||||
String? writeSkslFileName,
|
||||
}) {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
late Device selectedDevice;
|
||||
|
@ -1063,9 +1053,6 @@ class PerfTest {
|
|||
...<String>['--driver', testDriver!],
|
||||
if (existingApp != null)
|
||||
...<String>['--use-existing-app', existingApp],
|
||||
if (writeSkslFileName != null)
|
||||
...<String>['--write-sksl-on-exit', writeSkslFileName],
|
||||
if (cacheSkSL) '--cache-sksl',
|
||||
if (dartDefine.isNotEmpty)
|
||||
...<String>['--dart-define', dartDefine],
|
||||
if (enableImpeller) '--enable-impeller',
|
||||
|
@ -1154,149 +1141,6 @@ const List<String> _kCommonScoreKeys = <String>[
|
|||
'old_gen_gc_count',
|
||||
];
|
||||
|
||||
class PerfTestWithSkSL extends PerfTest {
|
||||
PerfTestWithSkSL(
|
||||
super.testDirectory,
|
||||
super.testTarget,
|
||||
String super.timelineFileName, {
|
||||
super.measureCpuGpu = false,
|
||||
super.testDriver,
|
||||
super.needsFullTimeline,
|
||||
super.benchmarkScoreKeys,
|
||||
});
|
||||
|
||||
|
||||
PerfTestWithSkSL.e2e(
|
||||
super.testDirectory,
|
||||
super.testTarget, {
|
||||
String super.testDriver,
|
||||
super.resultFilename,
|
||||
}) : super.e2e(
|
||||
needsFullTimeline: false,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<TaskResult> run({int? timeoutSeconds}) async {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
// Some initializations
|
||||
_device = await devices.workingDevice;
|
||||
_flutterPath = path.join(flutterDirectory.path, 'bin', 'flutter');
|
||||
|
||||
// Prepare the SkSL by running the driver test.
|
||||
await _generateSkSL();
|
||||
|
||||
// Build the app with SkSL artifacts and run that app
|
||||
final String vmServiceUri = await _runApp(skslPath: _skslJsonFileName);
|
||||
|
||||
// Attach to the running app and run the final driver test to get metrics.
|
||||
final TaskResult result = await internalRun(
|
||||
existingApp: vmServiceUri,
|
||||
);
|
||||
|
||||
_runProcess.kill();
|
||||
await _runProcess.exitCode;
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _generateSkSL() async {
|
||||
// `flutter drive` without `flutter run`, and `flutter drive --existing-app`
|
||||
// with `flutter run` may generate different SkSLs. Hence we run both
|
||||
// versions to generate as many SkSLs as possible.
|
||||
//
|
||||
// 1st, `flutter drive --existing-app` with `flutter run`. The
|
||||
// `--write-sksl-on-exit` option doesn't seem to be compatible with
|
||||
// `flutter drive --existing-app` as it will complain web socket connection
|
||||
// issues.
|
||||
final String vmServiceUri = await _runApp(cacheSkSL: true);
|
||||
await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
|
||||
_runProcess.kill();
|
||||
await _runProcess.exitCode;
|
||||
|
||||
// 2nd, `flutter drive` without `flutter run`. The --no-build option ensures
|
||||
// that we won't remove the SkSLs generated earlier.
|
||||
await super.internalRun(
|
||||
cacheSkSL: true,
|
||||
writeSkslFileName: _skslJsonFileName,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> _runApp({String? appBinary, bool cacheSkSL = false, String? skslPath}) async {
|
||||
if (File(_vmserviceFileName).existsSync()) {
|
||||
File(_vmserviceFileName).deleteSync();
|
||||
}
|
||||
final String? localEngine = localEngineFromEnv;
|
||||
final String? localEngineSrcPath = localEngineSrcPathFromEnv;
|
||||
_runProcess = await startProcess(
|
||||
_flutterPath,
|
||||
<String>[
|
||||
'run',
|
||||
if (localEngine != null)
|
||||
...<String>['--local-engine', localEngine],
|
||||
if (localEngineSrcPath != null)
|
||||
...<String>['--local-engine-src-path', localEngineSrcPath],
|
||||
'--no-dds',
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
|
||||
...<String>[
|
||||
'--device-timeout', '5',
|
||||
],
|
||||
'--verbose',
|
||||
'--verbose-system-logs',
|
||||
'--purge-persistent-cache',
|
||||
'--no-publish-port',
|
||||
'--profile',
|
||||
if (skslPath != null) '--bundle-sksl-path=$skslPath',
|
||||
if (cacheSkSL) '--cache-sksl',
|
||||
'-d', _device.deviceId,
|
||||
'-t', testTarget,
|
||||
'--endless-trace-buffer',
|
||||
if (appBinary != null) ...<String>['--use-application-binary', _appBinary],
|
||||
'--vmservice-out-file', _vmserviceFileName,
|
||||
],
|
||||
);
|
||||
|
||||
final Stream<List<int>> broadcastOut = _runProcess.stdout.asBroadcastStream();
|
||||
_forwardStream(broadcastOut, 'run stdout');
|
||||
_forwardStream(_runProcess.stderr, 'run stderr');
|
||||
|
||||
final File file = await waitForFile(_vmserviceFileName);
|
||||
return file.readAsStringSync();
|
||||
}
|
||||
|
||||
String get _skslJsonFileName => '$testDirectory/flutter_01.sksl.json';
|
||||
String get _vmserviceFileName => '$testDirectory/$_kVmserviceOutFileName';
|
||||
|
||||
bool get _isAndroid => deviceOperatingSystem == DeviceOperatingSystem.android;
|
||||
|
||||
String get _appBinary {
|
||||
if (_isAndroid) {
|
||||
return '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
|
||||
}
|
||||
for (final FileSystemEntity entry in Directory('$testDirectory/build/ios/iphoneos/').listSync()) {
|
||||
if (entry.path.endsWith('.app')) {
|
||||
return entry.path;
|
||||
}
|
||||
}
|
||||
throw 'No app found.';
|
||||
}
|
||||
|
||||
Stream<String> _transform(Stream<List<int>> stream) =>
|
||||
stream.transform<String>(utf8.decoder).transform<String>(const LineSplitter());
|
||||
|
||||
void _forwardStream(Stream<List<int>> stream, String label) {
|
||||
_transform(stream).listen((String line) {
|
||||
print('$label: $line');
|
||||
});
|
||||
}
|
||||
|
||||
late String _flutterPath;
|
||||
late Device _device;
|
||||
late Process _runProcess;
|
||||
|
||||
static const String _kVmserviceOutFileName = 'vmservice.out';
|
||||
}
|
||||
|
||||
/// Measures how long it takes to compile a Flutter app to JavaScript and how
|
||||
/// big the compiled code is.
|
||||
class WebCompileTest {
|
||||
|
|
Loading…
Reference in a new issue