Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 812b311

Browse files
committed
Run iOS drive tests on Apple Silicon
1 parent 044f5ce commit 812b311

File tree

4 files changed

+86
-3
lines changed

4 files changed

+86
-3
lines changed

.cirrus.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,35 @@ task:
314314
CHANNEL: "master"
315315
CHANNEL: "stable"
316316
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
317+
- name: ios-platform_tests
318+
env:
319+
PATH: $PATH:/usr/local/bin
320+
# TODO(jmagman): Run on stable when --enable-software-rendering
321+
# is available https://github.com/flutter/flutter/pull/105161.
322+
CHANNEL: "master"
323+
matrix:
324+
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
325+
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
326+
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4"
327+
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4"
328+
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
329+
create_simulator_script:
330+
- xcrun simctl list
331+
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-15-0 | xargs xcrun simctl boot
332+
build_script:
333+
- ./script/tool_runner.sh build-examples --ios
334+
xcode_analyze_script:
335+
- ./script/tool_runner.sh xcode-analyze --ios
336+
xcode_analyze_deprecation_script:
337+
# Ensure we don't accidentally introduce deprecated code.
338+
- ./script/tool_runner.sh xcode-analyze --ios --ios-min-version=13.0
339+
native_test_script:
340+
- ./script/tool_runner.sh native-test --ios --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
341+
drive_script:
342+
# `drive-examples` contains integration tests, which changes the UI of the application.
343+
# This UI change sometimes affects `xctest`.
344+
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
345+
- ./script/tool_runner.sh drive-examples --ios --exclude=script/configs/exclude_integration_ios.yaml --enable-software-rendering
317346
### macOS desktop tasks ###
318347
- name: macos-platform_tests
319348
env:
@@ -353,14 +382,12 @@ task:
353382
- name: ios-platform_tests
354383
env:
355384
PATH: $PATH:/usr/local/bin
385+
CHANNEL: "stable"
356386
matrix:
357387
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
358388
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
359389
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4"
360390
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4"
361-
matrix:
362-
CHANNEL: "master"
363-
CHANNEL: "stable"
364391
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
365392
create_simulator_script:
366393
- xcrun simctl list

script/tool/lib/src/common/core.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const String platformWindows = 'windows';
3030
/// Key for enable experiment.
3131
const String kEnableExperiment = 'enable-experiment';
3232

33+
/// Key for enable software rendering.
34+
const String kEnableSoftwareRendering = 'enable-software-rendering';
35+
3336
/// Target platforms supported by Flutter.
3437
// ignore: public_member_api_docs
3538
enum FlutterPlatform { android, ios, linux, macos, web, windows }

script/tool/lib/src/drive_examples_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
4343
help:
4444
'Runs the driver tests in Dart VM with the given experiments enabled.',
4545
);
46+
argParser.addFlag(
47+
kEnableSoftwareRendering,
48+
help: 'Renders the driver tests using the Skia software backend.',
49+
);
4650
}
4751

4852
@override
@@ -337,6 +341,8 @@ class DriveExamplesCommand extends PackageLoopingCommand {
337341
...deviceFlags,
338342
if (enableExperiment.isNotEmpty)
339343
'--enable-experiment=$enableExperiment',
344+
if (getBoolArg(kEnableSoftwareRendering))
345+
'--enable-software-rendering',
340346
'--driver',
341347
getRelativePosixPath(driver, from: example.directory),
342348
'--target',

script/tool/test/drive_examples_command_test.dart

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,53 @@ void main() {
898898
]));
899899
});
900900

901+
test('enable-software-rendering flag', () async {
902+
final RepositoryPackage plugin = createFakePlugin(
903+
'plugin',
904+
packagesDir,
905+
extraFiles: <String>[
906+
'example/test_driver/plugin_test.dart',
907+
'example/test_driver/plugin.dart',
908+
'example/ios/ios.m',
909+
],
910+
platformSupport: <String, PlatformDetails>{
911+
platformIOS: const PlatformDetails(PlatformSupport.inline),
912+
},
913+
);
914+
915+
final Directory pluginExampleDirectory = getExampleDir(plugin);
916+
917+
setMockFlutterDevicesOutput();
918+
await runCapturingPrint(runner, <String>[
919+
'drive-examples',
920+
'--ios',
921+
'--enable-software-rendering',
922+
]);
923+
924+
expect(
925+
processRunner.recordedCalls,
926+
orderedEquals(
927+
<ProcessCall>[
928+
ProcessCall(getFlutterCommand(mockPlatform), const <String>['devices', '--machine'], null),
929+
ProcessCall(
930+
getFlutterCommand(mockPlatform),
931+
const <String>[
932+
'drive',
933+
'-d',
934+
_fakeIOSDevice,
935+
'--enable-software-rendering',
936+
'--driver',
937+
'test_driver/plugin_test.dart',
938+
'--target',
939+
'test_driver/plugin.dart'
940+
],
941+
pluginExampleDirectory.path,
942+
),
943+
],
944+
),
945+
);
946+
});
947+
901948
test('fails when no example is present', () async {
902949
createFakePlugin(
903950
'plugin',

0 commit comments

Comments
 (0)