This reverts commit 9d9109aa6f.
This commit is contained in:
@@ -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/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/adb.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.androidArm64;
|
||||
await task(createStackSizeTest());
|
||||
}
|
||||
@@ -52,7 +52,7 @@ String _findMatchId(List<String> idList, String idPattern) {
|
||||
DeviceDiscovery get devices => DeviceDiscovery();
|
||||
|
||||
/// Device operating system the test is configured to test.
|
||||
enum DeviceOperatingSystem { android, androidArm64 ,ios, fuchsia, fake }
|
||||
enum DeviceOperatingSystem { android, ios, fuchsia, fake }
|
||||
|
||||
/// Device OS to test on.
|
||||
DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android;
|
||||
@@ -63,8 +63,6 @@ abstract class DeviceDiscovery {
|
||||
switch (deviceOperatingSystem) {
|
||||
case DeviceOperatingSystem.android:
|
||||
return AndroidDeviceDiscovery();
|
||||
case DeviceOperatingSystem.androidArm64:
|
||||
return AndroidDeviceDiscovery(cpu: _AndroidCPU.arm64);
|
||||
case DeviceOperatingSystem.ios:
|
||||
return IosDeviceDiscovery();
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
@@ -157,18 +155,12 @@ abstract class Device {
|
||||
}
|
||||
}
|
||||
|
||||
enum _AndroidCPU {
|
||||
arm64,
|
||||
}
|
||||
|
||||
class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
factory AndroidDeviceDiscovery({_AndroidCPU cpu}) {
|
||||
return _instance ??= AndroidDeviceDiscovery._(cpu);
|
||||
factory AndroidDeviceDiscovery() {
|
||||
return _instance ??= AndroidDeviceDiscovery._();
|
||||
}
|
||||
|
||||
AndroidDeviceDiscovery._(this.cpu);
|
||||
|
||||
final _AndroidCPU cpu;
|
||||
AndroidDeviceDiscovery._();
|
||||
|
||||
// Parses information about a device. Example:
|
||||
//
|
||||
@@ -193,16 +185,6 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
return _workingDevice;
|
||||
}
|
||||
|
||||
Future<bool> _matchesCPURequirement(AndroidDevice device) async {
|
||||
if (cpu == null)
|
||||
return true;
|
||||
switch (cpu) {
|
||||
case _AndroidCPU.arm64:
|
||||
return device.isArm64();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Picks a random Android device out of connected devices and sets it as
|
||||
/// [workingDevice].
|
||||
@override
|
||||
@@ -214,22 +196,8 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
if (allDevices.isEmpty)
|
||||
throw const DeviceException('No Android devices detected');
|
||||
|
||||
if (cpu != null) {
|
||||
for (final AndroidDevice device in allDevices) {
|
||||
if (await _matchesCPURequirement(device)) {
|
||||
_workingDevice = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// TODO(yjbanov): filter out and warn about those with low battery level
|
||||
_workingDevice = allDevices[math.Random().nextInt(allDevices.length)];
|
||||
}
|
||||
|
||||
if (_workingDevice == null)
|
||||
throw const DeviceException('Cannot find a suitable Android device');
|
||||
|
||||
// TODO(yjbanov): filter out and warn about those with low battery level
|
||||
_workingDevice = allDevices[math.Random().nextInt(allDevices.length)];
|
||||
print('Device chosen: $_workingDevice');
|
||||
}
|
||||
|
||||
@@ -238,11 +206,6 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
final String matchedId = _findMatchId(await discoverDevices(), deviceId);
|
||||
if (matchedId != null) {
|
||||
_workingDevice = AndroidDevice(deviceId: matchedId);
|
||||
if (cpu != null) {
|
||||
if (!await _matchesCPURequirement(_workingDevice)) {
|
||||
throw DeviceException('The selected device $matchedId does not match the cpu requirement');
|
||||
}
|
||||
}
|
||||
print('Choose device by ID: $matchedId');
|
||||
return;
|
||||
}
|
||||
@@ -481,11 +444,6 @@ class AndroidDevice extends Device {
|
||||
return wakefulness;
|
||||
}
|
||||
|
||||
Future<bool> isArm64() async {
|
||||
final String cpuInfo = await shellEval('getprop', const <String>['ro.product.cpu.abi']);
|
||||
return cpuInfo.contains('arm64');
|
||||
}
|
||||
|
||||
Future<void> _updateDeviceInfo() async {
|
||||
String info;
|
||||
try {
|
||||
|
||||
@@ -271,43 +271,6 @@ TaskFunction createTextfieldPerfE2ETest() {
|
||||
).run;
|
||||
}
|
||||
|
||||
TaskFunction createStackSizeTest() {
|
||||
final String testDirectory =
|
||||
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks';
|
||||
const String testTarget = 'test_driver/run_app.dart';
|
||||
const String testDriver = 'test_driver/stack_size_perf_test.dart';
|
||||
return () {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
final String deviceId = device.deviceId;
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'--verbose-system-logs',
|
||||
'--profile',
|
||||
'-t', testTarget,
|
||||
'--driver', testDriver,
|
||||
'-d',
|
||||
deviceId,
|
||||
]);
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('$testDirectory/build/stack_size.json').readAsStringSync(),
|
||||
) as Map<String, dynamic>;
|
||||
|
||||
final Map<String, dynamic> result = <String, dynamic>{
|
||||
'stack_size_per_nesting_level': data['stack_size'],
|
||||
};
|
||||
return TaskResult.success(
|
||||
result,
|
||||
benchmarkScoreKeys: result.keys.toList(),
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
TaskFunction createFullscreenTextfieldPerfTest() {
|
||||
return PerfTest(
|
||||
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
|
||||
@@ -503,15 +466,6 @@ class StartupTest {
|
||||
]);
|
||||
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
|
||||
break;
|
||||
case DeviceOperatingSystem.androidArm64:
|
||||
await flutter('build', options: <String>[
|
||||
'apk',
|
||||
'-v',
|
||||
'--profile',
|
||||
'--target-platform=android-arm64',
|
||||
]);
|
||||
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
|
||||
break;
|
||||
case DeviceOperatingSystem.ios:
|
||||
await flutter('build', options: <String>[
|
||||
'ios',
|
||||
@@ -1044,20 +998,6 @@ class CompileTest {
|
||||
if (reportPackageContentSizes)
|
||||
metrics.addAll(await getSizesFromApk(apkPath));
|
||||
break;
|
||||
case DeviceOperatingSystem.androidArm64:
|
||||
options.insert(0, 'apk');
|
||||
options.add('--target-platform=android-arm64');
|
||||
options.add('--tree-shake-icons');
|
||||
options.add('--split-debug-info=infos/');
|
||||
watch.start();
|
||||
await flutter('build', options: options);
|
||||
watch.stop();
|
||||
final String apkPath = '$cwd/build/app/outputs/flutter-apk/app-release.apk';
|
||||
final File apk = file(apkPath);
|
||||
releaseSizeInBytes = apk.lengthSync();
|
||||
if (reportPackageContentSizes)
|
||||
metrics.addAll(await getSizesFromApk(apkPath));
|
||||
break;
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
throw Exception('Unsupported option for Fuchsia devices');
|
||||
case DeviceOperatingSystem.fake:
|
||||
@@ -1084,10 +1024,6 @@ class CompileTest {
|
||||
options.insert(0, 'apk');
|
||||
options.add('--target-platform=android-arm');
|
||||
break;
|
||||
case DeviceOperatingSystem.androidArm64:
|
||||
options.insert(0, 'apk');
|
||||
options.add('--target-platform=android-arm64');
|
||||
break;
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
throw Exception('Unsupported option for Fuchsia devices');
|
||||
case DeviceOperatingSystem.fake:
|
||||
|
||||
@@ -22,18 +22,6 @@ void main() {
|
||||
tearDown(() {
|
||||
});
|
||||
|
||||
group('cpu check', () {
|
||||
test('arm64', () async {
|
||||
FakeDevice.pretendArm64();
|
||||
final AndroidDevice androidDevice = device as AndroidDevice;
|
||||
expect(await androidDevice.isArm64(), isTrue);
|
||||
expectLog(<CommandArgs>[
|
||||
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
|
||||
cmd(command: 'getprop', arguments: <String>['ro.product.cpu.abi'], environment: null),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
group('isAwake/isAsleep', () {
|
||||
test('reads Awake', () async {
|
||||
FakeDevice.pretendAwake();
|
||||
@@ -199,12 +187,6 @@ class FakeDevice extends AndroidDevice {
|
||||
''';
|
||||
}
|
||||
|
||||
static void pretendArm64() {
|
||||
output = '''
|
||||
arm64
|
||||
''';
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> shellEval(String command, List<String> arguments, { Map<String, String> environment, bool silent = false }) async {
|
||||
commandLog.add(CommandArgs(
|
||||
|
||||
Reference in New Issue
Block a user