Unverified Commit 815976a8 authored by chunhtai's avatar chunhtai Committed by GitHub

change stack size test to test arm device (#75814)

parent a3dd5aea
......@@ -45,12 +45,12 @@ const int kExitCodeSuccess = 0;
final GetStackPointerCallback getStackPointer = () {
// Makes sure we are running on an Android arm64 device.
if (!io.Platform.isAndroid)
throw 'This benchmark test can only be run on Android arm64 devices.';
throw 'This benchmark test can only be run on Android arm devices.';
final io.ProcessResult result = io.Process.runSync('getprop', <String>['ro.product.cpu.abi']);
if (result.exitCode != 0)
throw 'Failed to retrieve CPU information.';
if (!result.stdout.toString().contains('arm64'))
throw 'This benchmark test can only be run on Android arm64 devices.';
if (!result.stdout.toString().contains('armeabi'))
throw 'This benchmark test can only be run on Android arm devices.';
// Creates a block of memory to store the assembly code.
final ffi.Pointer<ffi.Void> region = mmap(ffi.nullptr, kMemorySize, kProtRead | kProtWrite,
......@@ -64,10 +64,10 @@ final GetStackPointerCallback getStackPointer = () {
region.cast<ffi.Uint8>().asTypedList(kMemorySize).setAll(
kMemoryStartingIndex,
<int>[
// "mov x0, sp" in machine code: E0030091.
0xe0, 0x03, 0x00, 0x91,
// "ret" in machine code: C0035FD6.
0xc0, 0x03, 0x5f, 0xd6
// "mov r0, sp" in machine code: 0D00A0E1.
0x0d, 0x00, 0xa0, 0xe1,
// "bx lr" in machine code: 1EFF2FE1.
0x1e, 0xff, 0x2f, 0xe1
]
);
......
......@@ -7,6 +7,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.androidArm64;
deviceOperatingSystem = DeviceOperatingSystem.androidArm;
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, androidArm, androidArm64 ,ios, fuchsia, fake }
/// Device OS to test on.
DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android;
......@@ -63,6 +63,8 @@ abstract class DeviceDiscovery {
switch (deviceOperatingSystem) {
case DeviceOperatingSystem.android:
return AndroidDeviceDiscovery();
case DeviceOperatingSystem.androidArm:
return AndroidDeviceDiscovery(cpu: _AndroidCPU.arm);
case DeviceOperatingSystem.androidArm64:
return AndroidDeviceDiscovery(cpu: _AndroidCPU.arm64);
case DeviceOperatingSystem.ios:
......@@ -158,6 +160,7 @@ abstract class Device {
}
enum _AndroidCPU {
arm,
arm64,
}
......@@ -199,6 +202,8 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
switch (cpu) {
case _AndroidCPU.arm64:
return device.isArm64();
case _AndroidCPU.arm:
return device.isArm();
}
return true;
}
......@@ -486,6 +491,11 @@ class AndroidDevice extends Device {
return cpuInfo.contains('arm64');
}
Future<bool> isArm() async {
final String cpuInfo = await shellEval('getprop', const <String>['ro.product.cpu.abi']);
return cpuInfo.contains('armeabi');
}
Future<void> _updateDeviceInfo() async {
String info;
try {
......
......@@ -503,6 +503,15 @@ class StartupTest {
]);
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
break;
case DeviceOperatingSystem.androidArm:
await flutter('build', options: <String>[
'apk',
'-v',
'--profile',
'--target-platform=android-arm',
]);
applicationBinaryPath = '$testDirectory/build/app/outputs/flutter-apk/app-profile.apk';
break;
case DeviceOperatingSystem.androidArm64:
await flutter('build', options: <String>[
'apk',
......@@ -1031,6 +1040,7 @@ class CompileTest {
metrics.addAll(await getSizesFromIosApp(appPath));
break;
case DeviceOperatingSystem.android:
case DeviceOperatingSystem.androidArm:
options.insert(0, 'apk');
options.add('--target-platform=android-arm');
options.add('--tree-shake-icons');
......@@ -1081,6 +1091,7 @@ class CompileTest {
options.insert(0, 'ios');
break;
case DeviceOperatingSystem.android:
case DeviceOperatingSystem.androidArm:
options.insert(0, 'apk');
options.add('--target-platform=android-arm');
break;
......
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