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

Commit

Permalink
Run iOS drive tests on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman committed Jun 7, 2022
1 parent 044f5ce commit 812b311
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
33 changes: 30 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,35 @@ task:
CHANNEL: "master"
CHANNEL: "stable"
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
- name: ios-platform_tests
env:
PATH: $PATH:/usr/local/bin
# TODO(jmagman): Run on stable when --enable-software-rendering
# is available https:/flutter/flutter/pull/105161.
CHANNEL: "master"
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4"
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
create_simulator_script:
- xcrun simctl list
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-15-0 | xargs xcrun simctl boot
build_script:
- ./script/tool_runner.sh build-examples --ios
xcode_analyze_script:
- ./script/tool_runner.sh xcode-analyze --ios
xcode_analyze_deprecation_script:
# Ensure we don't accidentally introduce deprecated code.
- ./script/tool_runner.sh xcode-analyze --ios --ios-min-version=13.0
native_test_script:
- ./script/tool_runner.sh native-test --ios --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
drive_script:
# `drive-examples` contains integration tests, which changes the UI of the application.
# This UI change sometimes affects `xctest`.
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
- ./script/tool_runner.sh drive-examples --ios --exclude=script/configs/exclude_integration_ios.yaml --enable-software-rendering
### macOS desktop tasks ###
- name: macos-platform_tests
env:
Expand Down Expand Up @@ -353,14 +382,12 @@ task:
- name: ios-platform_tests
env:
PATH: $PATH:/usr/local/bin
CHANNEL: "stable"
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
create_simulator_script:
- xcrun simctl list
Expand Down
3 changes: 3 additions & 0 deletions script/tool/lib/src/common/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const String platformWindows = 'windows';
/// Key for enable experiment.
const String kEnableExperiment = 'enable-experiment';

/// Key for enable software rendering.
const String kEnableSoftwareRendering = 'enable-software-rendering';

/// Target platforms supported by Flutter.
// ignore: public_member_api_docs
enum FlutterPlatform { android, ios, linux, macos, web, windows }
Expand Down
6 changes: 6 additions & 0 deletions script/tool/lib/src/drive_examples_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
help:
'Runs the driver tests in Dart VM with the given experiments enabled.',
);
argParser.addFlag(
kEnableSoftwareRendering,
help: 'Renders the driver tests using the Skia software backend.',
);
}

@override
Expand Down Expand Up @@ -337,6 +341,8 @@ class DriveExamplesCommand extends PackageLoopingCommand {
...deviceFlags,
if (enableExperiment.isNotEmpty)
'--enable-experiment=$enableExperiment',
if (getBoolArg(kEnableSoftwareRendering))
'--enable-software-rendering',
'--driver',
getRelativePosixPath(driver, from: example.directory),
'--target',
Expand Down
47 changes: 47 additions & 0 deletions script/tool/test/drive_examples_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,53 @@ void main() {
]));
});

test('enable-software-rendering flag', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin',
packagesDir,
extraFiles: <String>[
'example/test_driver/plugin_test.dart',
'example/test_driver/plugin.dart',
'example/ios/ios.m',
],
platformSupport: <String, PlatformDetails>{
platformIOS: const PlatformDetails(PlatformSupport.inline),
},
);

final Directory pluginExampleDirectory = getExampleDir(plugin);

setMockFlutterDevicesOutput();
await runCapturingPrint(runner, <String>[
'drive-examples',
'--ios',
'--enable-software-rendering',
]);

expect(
processRunner.recordedCalls,
orderedEquals(
<ProcessCall>[
ProcessCall(getFlutterCommand(mockPlatform), const <String>['devices', '--machine'], null),
ProcessCall(
getFlutterCommand(mockPlatform),
const <String>[
'drive',
'-d',
_fakeIOSDevice,
'--enable-software-rendering',
'--driver',
'test_driver/plugin_test.dart',
'--target',
'test_driver/plugin.dart'
],
pluginExampleDirectory.path,
),
],
),
);
});

test('fails when no example is present', () async {
createFakePlugin(
'plugin',
Expand Down

0 comments on commit 812b311

Please sign in to comment.