Delete and create iOS simulator before running Scenario app test (flutter/engine#50835)

Make iOS Scenario app tests create the simulator it needs before the tests. Also, delete any existing matching simulators to prevent duplicates.

Fixes https://github.com/flutter/flutter/issues/143870.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Victoria Ashworth
2024-02-22 14:17:22 -06:00
committed by GitHub
parent 1c5e66df2c
commit d6735132e4

View File

@@ -58,13 +58,34 @@ zip_and_upload_xcresult_to_luci () {
exit 1
}
readonly DEVICE_NAME="iPhone SE (3rd generation)"
readonly DEVICE=com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation
readonly OS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-17-0
readonly OS="17.0"
# Delete any existing devices named "iPhone SE (3rd generation)". Having more
# than one may cause issues when builds target the device.
echo "Deleting any existing devices names $DEVICE_NAME..."
RESULT=0
while [[ $RESULT == 0 ]]; do
xcrun simctl delete "$DEVICE_NAME" || RESULT=1
if [ $RESULT == 0 ]; then
echo "Deleted $DEVICE_NAME"
fi
done
echo ""
echo "Creating $DEVICE_NAME $DEVICE $OS_RUNTIME ..."
xcrun simctl create "$DEVICE_NAME" "$DEVICE" "$OS_RUNTIME"
echo ""
echo "Running simulator tests with Skia"
echo ""
if set -o pipefail && xcodebuild -sdk iphonesimulator \
-scheme Scenarios \
-resultBundlePath "$RESULT_BUNDLE_PATH/ios_scenario.xcresult" \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone SE (3rd generation)' \
-destination "platform=iOS Simulator,OS=$OS,name=$DEVICE_NAME" \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE"; then
echo "test success."
@@ -82,7 +103,7 @@ echo ""
if set -o pipefail && xcodebuild -sdk iphonesimulator \
-scheme Scenarios \
-resultBundlePath "$RESULT_BUNDLE_PATH/ios_scenario.xcresult" \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone SE (3rd generation)' \
-destination "platform=iOS Simulator,OS=$OS,name=$DEVICE_NAME" \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE" \
-skip-testing ScenariosUITests/MultiplePlatformViewsBackgroundForegroundTest/testPlatformView \