Unverified Commit 59859df1 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Add Windows performance benchmark (#99564)

parent 4b902c79
...@@ -4403,6 +4403,17 @@ targets: ...@@ -4403,6 +4403,17 @@ targets:
- bin/** - bin/**
- .ci.yaml - .ci.yaml
- name: Windows windows_home_scroll_perf__timeline_summary
recipe: devicelab/devicelab_drone
bringup: true
timeout: 60
properties:
tags: >
["devicelab","hostonly"]
task_name: windows_home_scroll_perf__timeline_summary
benchmark: "true"
scheduler: luci
- name: Windows_android basic_material_app_win__compile - name: Windows_android basic_material_app_win__compile
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
presubmit: false presubmit: false
......
...@@ -199,6 +199,7 @@ ...@@ -199,6 +199,7 @@
/dev/devicelab/bin/tasks/module_test_ios.dart @jmagman @flutter/tool /dev/devicelab/bin/tasks/module_test_ios.dart @jmagman @flutter/tool
/dev/devicelab/bin/tasks/plugin_lint_mac.dart @stuartmorgan @flutter/plugin /dev/devicelab/bin/tasks/plugin_lint_mac.dart @stuartmorgan @flutter/plugin
/dev/devicelab/bin/tasks/entrypoint_dart_registrant.dart @aaclarke @flutter/plugin /dev/devicelab/bin/tasks/entrypoint_dart_registrant.dart @aaclarke @flutter/plugin
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine
## Host only framework tests ## Host only framework tests
# Linux analyze # Linux analyze
......
// 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.windows;
await task(createHomeScrollPerfTest());
}
...@@ -52,7 +52,7 @@ String? _findMatchId(List<String> idList, String idPattern) { ...@@ -52,7 +52,7 @@ String? _findMatchId(List<String> idList, String idPattern) {
DeviceDiscovery get devices => DeviceDiscovery(); DeviceDiscovery get devices => DeviceDiscovery();
/// Device operating system the test is configured to test. /// Device operating system the test is configured to test.
enum DeviceOperatingSystem { android, androidArm, androidArm64 ,ios, fuchsia, fake } enum DeviceOperatingSystem { android, androidArm, androidArm64 ,ios, fuchsia, fake, windows }
/// Device OS to test on. /// Device OS to test on.
DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android; DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android;
...@@ -71,6 +71,8 @@ abstract class DeviceDiscovery { ...@@ -71,6 +71,8 @@ abstract class DeviceDiscovery {
return IosDeviceDiscovery(); return IosDeviceDiscovery();
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
return FuchsiaDeviceDiscovery(); return FuchsiaDeviceDiscovery();
case DeviceOperatingSystem.windows:
return WindowsDeviceDiscovery();
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
print('Looking for fake devices! You should not see this in release builds.'); print('Looking for fake devices! You should not see this in release builds.');
return FakeDeviceDiscovery(); return FakeDeviceDiscovery();
...@@ -332,6 +334,41 @@ class AndroidDeviceDiscovery implements DeviceDiscovery { ...@@ -332,6 +334,41 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
} }
} }
class WindowsDeviceDiscovery implements DeviceDiscovery {
factory WindowsDeviceDiscovery() {
return _instance ??= WindowsDeviceDiscovery._();
}
WindowsDeviceDiscovery._();
static WindowsDeviceDiscovery? _instance;
static const WindowsDevice _device = WindowsDevice();
@override
Future<Map<String, HealthCheckResult>> checkDevices() async {
return <String, HealthCheckResult>{};
}
@override
Future<void> chooseWorkingDevice() async { }
@override
Future<void> chooseWorkingDeviceById(String deviceId) async { }
@override
Future<List<String>> discoverDevices() async {
return <String>['windows'];
}
@override
Future<void> performPreflightTasks() async { }
@override
Future<Device> get workingDevice async => _device;
}
class FuchsiaDeviceDiscovery implements DeviceDiscovery { class FuchsiaDeviceDiscovery implements DeviceDiscovery {
factory FuchsiaDeviceDiscovery() { factory FuchsiaDeviceDiscovery() {
return _instance ??= FuchsiaDeviceDiscovery._(); return _instance ??= FuchsiaDeviceDiscovery._();
...@@ -943,6 +980,55 @@ class IosDevice extends Device { ...@@ -943,6 +980,55 @@ class IosDevice extends Device {
} }
} }
class WindowsDevice extends Device {
const WindowsDevice();
@override
String get deviceId => 'windows';
@override
Future<Map<String, dynamic>> getMemoryStats(String packageName) async {
return <String, dynamic>{};
}
@override
Future<void> home() async { }
@override
Future<bool> isAsleep() async {
return false;
}
@override
Future<bool> isAwake() async {
return true;
}
@override
Stream<String> get logcat => const Stream<String>.empty();
@override
Future<void> reboot() async { }
@override
Future<void> sendToSleep() async { }
@override
Future<void> stop(String packageName) async { }
@override
Future<void> tap(int x, int y) async { }
@override
Future<void> togglePower() async { }
@override
Future<void> unlock() async { }
@override
Future<void> wakeUp() async { }
}
/// Fuchsia device. /// Fuchsia device.
class FuchsiaDevice extends Device { class FuchsiaDevice extends Device {
const FuchsiaDevice({ required this.deviceId }); const FuchsiaDevice({ required this.deviceId });
......
...@@ -615,6 +615,7 @@ class StartupTest { ...@@ -615,6 +615,7 @@ class StartupTest {
]); ]);
applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos'); applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos');
break; break;
case DeviceOperatingSystem.windows:
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
break; break;
...@@ -730,6 +731,7 @@ class DevtoolsStartupTest { ...@@ -730,6 +731,7 @@ class DevtoolsStartupTest {
]); ]);
applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos'); applicationBinaryPath = _findIosAppInBuildDirectory('$testDirectory/build/ios/iphoneos');
break; break;
case DeviceOperatingSystem.windows:
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
break; break;
...@@ -1307,6 +1309,8 @@ class CompileTest { ...@@ -1307,6 +1309,8 @@ class CompileTest {
if (reportPackageContentSizes) if (reportPackageContentSizes)
metrics.addAll(await getSizesFromApk(apkPath)); metrics.addAll(await getSizesFromApk(apkPath));
break; break;
case DeviceOperatingSystem.windows:
throw Exception('Unsupported option for Windows devices');
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
throw Exception('Unsupported option for Fuchsia devices'); throw Exception('Unsupported option for Fuchsia devices');
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
...@@ -1343,6 +1347,8 @@ class CompileTest { ...@@ -1343,6 +1347,8 @@ class CompileTest {
options.insert(0, 'apk'); options.insert(0, 'apk');
options.add('--target-platform=android-arm64'); options.add('--target-platform=android-arm64');
break; break;
case DeviceOperatingSystem.windows:
throw Exception('Unsupported option for Windows devices');
case DeviceOperatingSystem.fuchsia: case DeviceOperatingSystem.fuchsia:
throw Exception('Unsupported option for Fuchsia devices'); throw Exception('Unsupported option for Fuchsia devices');
case DeviceOperatingSystem.fake: case DeviceOperatingSystem.fake:
......
...@@ -214,7 +214,7 @@ class DriveCommand extends RunCommandBase { ...@@ -214,7 +214,7 @@ class DriveCommand extends RunCommandBase {
throwToolExit(null); throwToolExit(null);
} }
if (screenshot != null && !device.supportsScreenshot) { if (screenshot != null && !device.supportsScreenshot) {
throwToolExit('Screenshot not supported for ${device.name}.'); _logger.printError('Screenshot not supported for ${device.name}.');
} }
final bool web = device is WebServerDevice || device is ChromiumDevice; final bool web = device is WebServerDevice || device is ChromiumDevice;
...@@ -359,6 +359,9 @@ class DriveCommand extends RunCommandBase { ...@@ -359,6 +359,9 @@ class DriveCommand extends RunCommandBase {
} }
Future<void> _takeScreenshot(Device device) async { Future<void> _takeScreenshot(Device device) async {
if (!device.supportsScreenshot) {
return;
}
try { try {
final Directory outputDirectory = _fileSystem.directory(screenshot) final Directory outputDirectory = _fileSystem.directory(screenshot)
..createSync(recursive: true); ..createSync(recursive: true);
......
...@@ -45,6 +45,38 @@ void main() { ...@@ -45,6 +45,38 @@ void main() {
Cache.enableLocking(); Cache.enableLocking();
}); });
testUsingContext('warns if screenshot is not supported but continues test', () async {
final DriveCommand command = DriveCommand(fileSystem: fileSystem, logger: logger, platform: platform);
fileSystem.file('lib/main.dart').createSync(recursive: true);
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
fileSystem.file('pubspec.yaml').createSync();
fileSystem.directory('drive_screenshots').createSync();
final Device screenshotDevice = ThrowingScreenshotDevice()
..supportsScreenshot = false;
fakeDeviceManager.devices = <Device>[screenshotDevice];
await expectLater(() => createTestCommandRunner(command).run(
<String>[
'drive',
'--no-pub',
'-d',
screenshotDevice.id,
'--screenshot',
'drive_screenshots',
]),
throwsToolExit(message: 'cannot start app'),
);
expect(logger.errorText, contains('Screenshot not supported for FakeDevice'));
expect(logger.statusText, isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(),
Pub: () => FakePub(),
DeviceManager: () => fakeDeviceManager,
});
testUsingContext('takes screenshot and rethrows on drive exception', () async { testUsingContext('takes screenshot and rethrows on drive exception', () async {
final DriveCommand command = DriveCommand(fileSystem: fileSystem, logger: logger, platform: platform); final DriveCommand command = DriveCommand(fileSystem: fileSystem, logger: logger, platform: platform);
fileSystem.file('lib/main.dart').createSync(recursive: true); fileSystem.file('lib/main.dart').createSync(recursive: true);
...@@ -214,7 +246,7 @@ class ScreenshotDevice extends Fake implements Device { ...@@ -214,7 +246,7 @@ class ScreenshotDevice extends Fake implements Device {
Future<TargetPlatform> get targetPlatform async => TargetPlatform.android; Future<TargetPlatform> get targetPlatform async => TargetPlatform.android;
@override @override
final bool supportsScreenshot = true; bool supportsScreenshot = true;
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
......
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