[devicelab] migrate new gallery benchmarks to local copy. (#143545)

This is the next step in archiving flutter/gallery - move devicelab tests to use the local copy.
This commit is contained in:
Jonah Williams
2024-02-15 14:32:38 -08:00
committed by GitHub
parent cef33536aa
commit 27cacca011
13 changed files with 52 additions and 166 deletions

View File

@@ -706,22 +706,6 @@ String jsonEncode(dynamic data) {
return '$jsonValue\n';
}
Future<void> getNewGallery(String revision, Directory galleryDir) async {
section('Get New Flutter Gallery!');
if (exists(galleryDir)) {
galleryDir.deleteSync(recursive: true);
}
await inDirectory<void>(galleryDir.parent, () async {
await exec('git', <String>['clone', 'https://github.com/flutter/gallery.git']);
});
await inDirectory<void>(galleryDir, () async {
await exec('git', <String>['checkout', revision]);
});
}
/// Splits [from] into lines and selects those that contain [pattern].
Iterable<String> grep(Pattern pattern, {required String from}) {
return from.split('\n').where((String line) {

View File

@@ -2,36 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import '../framework/task_result.dart';
import '../framework/utils.dart';
import '../versions/gallery.dart' show galleryVersion;
import 'perf_tests.dart';
class NewGalleryPerfTest extends PerfTest {
NewGalleryPerfTest(
this.galleryDir, {
NewGalleryPerfTest({
String timelineFileName = 'transitions',
String dartDefine = '',
super.enableImpeller,
super.timeoutSeconds,
super.forceOpenGLES,
}) : super(
galleryDir.path,
'${flutterDirectory.path}/dev/integration_tests/new_gallery',
'test_driver/transitions_perf.dart',
timelineFileName,
dartDefine: dartDefine,
createPlatforms: <String>['android', 'ios', 'web']
);
@override
Future<TaskResult> run() async {
// Manually roll the new gallery version for now. If the new gallery repo
// turns out to be updated frequently in the future, we can set up an auto
// roller to update this version.
await getNewGallery(galleryVersion, galleryDir);
return super.run();
}
final Directory galleryDir;
}

View File

@@ -1185,6 +1185,7 @@ class PerfTest {
this.enableImpeller,
this.forceOpenGLES,
this.disablePartialRepaint = false,
this.createPlatforms = const <String>[],
}): _resultFilename = resultFilename;
const PerfTest.e2e(
@@ -1204,6 +1205,7 @@ class PerfTest {
this.enableImpeller,
this.forceOpenGLES,
this.disablePartialRepaint = false,
this.createPlatforms = const <String>[],
}) : saveTraceFile = false, timelineFileName = null, _resultFilename = resultFilename;
/// The directory where the app under test is defined.
@@ -1274,6 +1276,10 @@ class PerfTest {
/// Additional flags for `--dart-define` to control the test
final String dartDefine;
/// Additional platforms to create with `flutter create` before running
/// the test.
final List<String> createPlatforms;
Future<TaskResult> run() {
return internalRun();
}
@@ -1295,6 +1301,15 @@ class PerfTest {
final String? localEngineHost = localEngineHostFromEnv;
final String? localEngineSrcPath = localEngineSrcPathFromEnv;
if (createPlatforms.isNotEmpty) {
await flutter('create', options: <String>[
'--platforms',
createPlatforms.join(','),
'--no-overwrite',
'.'
]);
}
bool changedPlist = false;
bool changedManifest = false;

View File

@@ -1,6 +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.
/// The pinned version of flutter gallery, used for devicelab tests.
const String galleryVersion = 'fa031bfe9d131010e7a56ee5d343f9f85b367d64';