From fbb91aa137bb1bda500853eee26604ca4e68d8c3 Mon Sep 17 00:00:00 2001 From: Premek Vysoky Date: Fri, 4 Jun 2021 12:32:15 +0200 Subject: [PATCH 1/3] Reboot Apple queues when device not found --- .../Sdk/tools/xharness-runner/xharness-runner.apple.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh index 09e2d117e7d..2bd28583c4e 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh @@ -168,6 +168,14 @@ if [ $exit_code -eq 83 ] && [[ "$targets" =~ "simulator" ]]; then touch './.reboot' fi +# If fail to find a real device, it is unexpected as device queues should have one +# It can often be fixed with a reboot +# 81 - device not found +if [ $exit_code -eq 81 ] && [[ "$targets" =~ "device" ]]; then + touch './.retry' + touch './.reboot' +fi + # The simulator logs comming from the sudo-spawned Simulator.app are not readable by the helix uploader chmod 0644 "$output_directory"/*.log From 869f4c5e1fb3e2e70a1d3a851cdc9053764fc262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emek=20Vysok=C3=BD?= Date: Mon, 7 Jun 2021 14:48:56 +0200 Subject: [PATCH 2/3] Update src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh --- .../Sdk/tools/xharness-runner/xharness-runner.apple.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh index 2bd28583c4e..fb7714003da 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh @@ -168,7 +168,7 @@ if [ $exit_code -eq 83 ] && [[ "$targets" =~ "simulator" ]]; then touch './.reboot' fi -# If fail to find a real device, it is unexpected as device queues should have one +# If we fail to find a real device, it is unexpected as device queues should have one # It can often be fixed with a reboot # 81 - device not found if [ $exit_code -eq 81 ] && [[ "$targets" =~ "device" ]]; then From 7ca9077778c69a10ba11b9c4c1641ee8994dab73 Mon Sep 17 00:00:00 2001 From: Premek Vysoky Date: Mon, 7 Jun 2021 14:51:56 +0200 Subject: [PATCH 3/3] Use the targets variable --- .../Sdk/tools/xharness-runner/xharness-runner.apple.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh index fb7714003da..6e67f9ef4a2 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh @@ -131,7 +131,7 @@ if [ "$target" == 'ios-device' ] || [ "$target" == 'tvos-device' ]; then # Sign the app /usr/bin/codesign -v --force --sign "Apple Development" --keychain "$keychain_name" --entitlements entitlements.plist "$app" -elif [[ "$targets" =~ "simulator" ]]; then +elif [[ "$target" =~ "simulator" ]]; then # Start the simulator if it is not running already simulator_app="$xcode_path/Contents/Developer/Applications/Simulator.app" open -a "$simulator_app" @@ -155,7 +155,7 @@ fi # If we fail to find a simulator and we are not targeting a specific version (e.g. `ios-simulator_13.5`), it is probably an issue because Xcode should always have at least one runtime version inside # 81 - simulator/device not found -if [ $exit_code -eq 81 ] && [[ "$targets" =~ "simulator" ]] && [[ ! "$targets" =~ "_" ]]; then +if [ $exit_code -eq 81 ] && [[ "$target" =~ "simulator" ]] && [[ ! "$target" =~ "_" ]]; then touch './.retry' touch './.reboot' fi @@ -163,7 +163,7 @@ fi # If we have a launch failure AND we are on simulators, we need to signal that we want a reboot+retry # The script that is running this one will notice and request Helix to do it # 83 - app launch failure -if [ $exit_code -eq 83 ] && [[ "$targets" =~ "simulator" ]]; then +if [ $exit_code -eq 83 ] && [[ "$target" =~ "simulator" ]]; then touch './.retry' touch './.reboot' fi @@ -171,7 +171,7 @@ fi # If we fail to find a real device, it is unexpected as device queues should have one # It can often be fixed with a reboot # 81 - device not found -if [ $exit_code -eq 81 ] && [[ "$targets" =~ "device" ]]; then +if [ $exit_code -eq 81 ] && [[ "$target" =~ "device" ]]; then touch './.retry' touch './.reboot' fi