Unverified Commit 27cacca0 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[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.
parent cef33536
...@@ -9,8 +9,6 @@ import 'dart:io'; ...@@ -9,8 +9,6 @@ import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/versions/gallery.dart' show galleryVersion;
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
await task(const NewGalleryChromeRunTest().run); await task(const NewGalleryChromeRunTest().run);
...@@ -34,14 +32,13 @@ class NewGalleryChromeRunTest { ...@@ -34,14 +32,13 @@ class NewGalleryChromeRunTest {
/// Runs the test. /// Runs the test.
Future<TaskResult> run() async { Future<TaskResult> run() async {
final Directory galleryParentDir = final TaskResult result = await inDirectory<TaskResult>('${flutterDirectory.path}/dev/integration_tests/new_gallery/', () async {
Directory.systemTemp.createTempSync('flutter_gallery_v2_chrome_run.'); await flutter('create', options: <String>[
final Directory galleryDir = '--platforms',
Directory(path.join(galleryParentDir.path, 'gallery')); 'web,android,ios',
'--no-overwrite',
await getNewGallery(galleryVersion, galleryDir); '.'
]);
final TaskResult result = await inDirectory<TaskResult>(galleryDir, () async {
await flutter('doctor'); await flutter('doctor');
await flutter('packages', options: <String>['get']); await flutter('packages', options: <String>['get']);
...@@ -105,8 +102,6 @@ class NewGalleryChromeRunTest { ...@@ -105,8 +102,6 @@ class NewGalleryChromeRunTest {
} }
}); });
rmTree(galleryParentDir);
return result; return result;
} }
} }
...@@ -2,14 +2,10 @@ ...@@ -2,14 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart' show WebCompileTest; import 'package:flutter_devicelab/tasks/perf_tests.dart' show WebCompileTest;
import 'package:flutter_devicelab/versions/gallery.dart' show galleryVersion;
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
await task(const NewGalleryWebCompileTest().run); await task(const NewGalleryWebCompileTest().run);
...@@ -24,28 +20,26 @@ class NewGalleryWebCompileTest { ...@@ -24,28 +20,26 @@ class NewGalleryWebCompileTest {
/// Runs the test. /// Runs the test.
Future<TaskResult> run() async { Future<TaskResult> run() async {
final Directory galleryParentDir =
Directory.systemTemp.createTempSync('flutter_gallery_v2_web_compile.');
final Directory galleryDir =
Directory(path.join(galleryParentDir.path, 'gallery'));
await getNewGallery(galleryVersion, galleryDir);
final Map<String, Object> metrics = await inDirectory<Map<String, int>>( final Map<String, Object> metrics = await inDirectory<Map<String, int>>(
galleryDir, '${flutterDirectory.path}/dev/integration_tests/new_gallery/',
() async { () async {
await flutter('doctor'); await flutter('doctor');
await flutter('create', options: <String>[
'--platforms',
'web,android,ios',
'--no-overwrite',
'.'
]);
return WebCompileTest.runSingleBuildTest( return WebCompileTest.runSingleBuildTest(
directory: galleryDir.path, directory: '${flutterDirectory.path}/dev/integration_tests/new_gallery/',
metric: metricKeyPrefix, metric: metricKeyPrefix,
measureBuildTime: true, measureBuildTime: true,
); );
}, },
); );
rmTree(galleryParentDir);
return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList()); return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
} }
} }
...@@ -2,31 +2,17 @@ ...@@ -2,31 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android; deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = await task(
Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); NewGalleryPerfTest(
final Directory galleryDir = timelineFileName: 'transitions-crane',
Directory(path.join(galleryParentDir.path, 'gallery')); dartDefine: 'onlyCrane=true',
).run,
try { );
await task(
NewGalleryPerfTest(
galleryDir,
timelineFileName: 'transitions-crane',
dartDefine: 'onlyCrane=true',
).run,
);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -2,30 +2,18 @@ ...@@ -2,30 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android; deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery')); NewGalleryPerfTest(
// time out after 20 minutes allowing the tool to take a screenshot to debug
try { // https://github.com/flutter/flutter/issues/114025.
await task( timeoutSeconds: 20 * 60,
NewGalleryPerfTest( ).run,
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);
}
} }
...@@ -2,23 +2,12 @@ ...@@ -2,23 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android; deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(NewGalleryPerfTest(enableImpeller: true).run);
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(NewGalleryPerfTest(galleryDir, enableImpeller: true).run);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -2,23 +2,12 @@ ...@@ -2,23 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android; deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(NewGalleryPerfTest(enableImpeller: true, dartDefine: 'flutter.benchmarks.force_disable_snapshot=true').run);
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(NewGalleryPerfTest(galleryDir, enableImpeller: true, dartDefine: 'flutter.benchmarks.force_disable_snapshot=true').run);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -2,23 +2,12 @@ ...@@ -2,23 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios; deviceOperatingSystem = DeviceOperatingSystem.ios;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(NewGalleryPerfTest().run);
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(NewGalleryPerfTest(galleryDir).run);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -2,23 +2,12 @@ ...@@ -2,23 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android; deviceOperatingSystem = DeviceOperatingSystem.android;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(NewGalleryPerfTest(enableImpeller: true, forceOpenGLES: true).run);
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(NewGalleryPerfTest(galleryDir, enableImpeller: true, forceOpenGLES: true).run);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -2,23 +2,12 @@ ...@@ -2,23 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/new_gallery.dart'; import 'package:flutter_devicelab/tasks/new_gallery.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios; deviceOperatingSystem = DeviceOperatingSystem.ios;
final Directory galleryParentDir = Directory.systemTemp.createTempSync('flutter_new_gallery_test.'); await task(NewGalleryPerfTest(enableImpeller: false).run);
final Directory galleryDir = Directory(path.join(galleryParentDir.path, 'gallery'));
try {
await task(NewGalleryPerfTest(galleryDir, enableImpeller: false).run);
} finally {
rmTree(galleryParentDir);
}
} }
...@@ -706,22 +706,6 @@ String jsonEncode(dynamic data) { ...@@ -706,22 +706,6 @@ String jsonEncode(dynamic data) {
return '$jsonValue\n'; 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]. /// Splits [from] into lines and selects those that contain [pattern].
Iterable<String> grep(Pattern pattern, {required String from}) { Iterable<String> grep(Pattern pattern, {required String from}) {
return from.split('\n').where((String line) { return from.split('\n').where((String line) {
......
...@@ -2,36 +2,21 @@ ...@@ -2,36 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import '../framework/task_result.dart';
import '../framework/utils.dart'; import '../framework/utils.dart';
import '../versions/gallery.dart' show galleryVersion;
import 'perf_tests.dart'; import 'perf_tests.dart';
class NewGalleryPerfTest extends PerfTest { class NewGalleryPerfTest extends PerfTest {
NewGalleryPerfTest( NewGalleryPerfTest({
this.galleryDir, {
String timelineFileName = 'transitions', String timelineFileName = 'transitions',
String dartDefine = '', String dartDefine = '',
super.enableImpeller, super.enableImpeller,
super.timeoutSeconds, super.timeoutSeconds,
super.forceOpenGLES, super.forceOpenGLES,
}) : super( }) : super(
galleryDir.path, '${flutterDirectory.path}/dev/integration_tests/new_gallery',
'test_driver/transitions_perf.dart', 'test_driver/transitions_perf.dart',
timelineFileName, timelineFileName,
dartDefine: dartDefine, 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;
} }
...@@ -1185,6 +1185,7 @@ class PerfTest { ...@@ -1185,6 +1185,7 @@ class PerfTest {
this.enableImpeller, this.enableImpeller,
this.forceOpenGLES, this.forceOpenGLES,
this.disablePartialRepaint = false, this.disablePartialRepaint = false,
this.createPlatforms = const <String>[],
}): _resultFilename = resultFilename; }): _resultFilename = resultFilename;
const PerfTest.e2e( const PerfTest.e2e(
...@@ -1204,6 +1205,7 @@ class PerfTest { ...@@ -1204,6 +1205,7 @@ class PerfTest {
this.enableImpeller, this.enableImpeller,
this.forceOpenGLES, this.forceOpenGLES,
this.disablePartialRepaint = false, this.disablePartialRepaint = false,
this.createPlatforms = const <String>[],
}) : saveTraceFile = false, timelineFileName = null, _resultFilename = resultFilename; }) : saveTraceFile = false, timelineFileName = null, _resultFilename = resultFilename;
/// The directory where the app under test is defined. /// The directory where the app under test is defined.
...@@ -1274,6 +1276,10 @@ class PerfTest { ...@@ -1274,6 +1276,10 @@ class PerfTest {
/// Additional flags for `--dart-define` to control the test /// Additional flags for `--dart-define` to control the test
final String dartDefine; final String dartDefine;
/// Additional platforms to create with `flutter create` before running
/// the test.
final List<String> createPlatforms;
Future<TaskResult> run() { Future<TaskResult> run() {
return internalRun(); return internalRun();
} }
...@@ -1295,6 +1301,15 @@ class PerfTest { ...@@ -1295,6 +1301,15 @@ class PerfTest {
final String? localEngineHost = localEngineHostFromEnv; final String? localEngineHost = localEngineHostFromEnv;
final String? localEngineSrcPath = localEngineSrcPathFromEnv; final String? localEngineSrcPath = localEngineSrcPathFromEnv;
if (createPlatforms.isNotEmpty) {
await flutter('create', options: <String>[
'--platforms',
createPlatforms.join(','),
'--no-overwrite',
'.'
]);
}
bool changedPlist = false; bool changedPlist = false;
bool changedManifest = false; bool changedManifest = false;
......
// 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';
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