Skip to content

Commit 32ff2e3

Browse files
authored
Detect new XHarness exit codes and retry/reboot upon them (#8103)
1 parent 73c31ff commit 32ff2e3

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-runner.apple.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ function report_infrastructure_failure() {
151151
echo "Infrastructural problem reported by the user, requesting retry+reboot: $1"
152152

153153
echo "$1" > "$HELIX_WORKITEM_ROOT/.retry"
154-
echo "$1" > "$HELIX_WORKITEM_ROOT/.reboot"
154+
155+
if [[ "$2" -ne "--no-reboot" ]]; then
156+
echo "$1" > "$HELIX_WORKITEM_ROOT/.reboot"
157+
fi
155158
}
156159

157160
# Used to grep sys logs later in case of crashes
@@ -186,7 +189,7 @@ fi
186189
# it is probably an issue because Xcode should always have at least one runtime version inside
187190
# 81 - simulator/device not found
188191
if [ $exit_code -eq 81 ] && [[ "$target" =~ "simulator" ]] && [[ ! "$target" =~ "_" ]]; then
189-
report_infrastructure_failure "No simulator runtime found"
192+
report_infrastructure_failure "No simulator runtime found" --no-reboot
190193
fi
191194

192195
# If we fail to find a real device, it is unexpected as device queues should have one
@@ -203,6 +206,19 @@ if [ $exit_code -eq 86 ]; then
203206
report_infrastructure_failure "Installation timed out"
204207
fi
205208

209+
# Simulators are known to slow/break down and a reboot usually helps
210+
# This manifest by us not being able to launch the simulator
211+
# 88 - simulator failure
212+
if [ $exit_code -eq 88 ]; then
213+
report_infrastructure_failure "Failed to launch simulator"
214+
fi
215+
216+
# Devices can be locked or in a corrupted state, in this case we only retry the work item
217+
# 89 - device failure
218+
if [ $exit_code -eq 89 ]; then
219+
report_infrastructure_failure "Problem with the mobile device" --no-reboot
220+
fi
221+
206222
# The simulator logs comming from the sudo-spawned Simulator.app are not readable/deletable by the helix uploader
207223
sudo chown -R helix-runner "$output_directory"
208224
chmod -R 0766 "$output_directory"

0 commit comments

Comments
 (0)