Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ expected_exit_code=0
includes_test_runner=false
reset_simulator=false

# Ignore shellcheck lint warning about unused variables (they can be used in the sourced script)
# shellcheck disable=SC2034
while [[ $# -gt 0 ]]; do
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
Expand Down Expand Up @@ -122,6 +124,7 @@ fi

# First we need to revive env variables since they were erased by launchctl
# This file already has the expressions in the `export name=value` format
# shellcheck disable=SC1091
. ./envvars

output_directory=$HELIX_WORKITEM_UPLOAD_ROOT
Expand Down Expand Up @@ -151,10 +154,19 @@ function report_infrastructure_failure() {
echo "$1" > "$HELIX_WORKITEM_ROOT/.reboot"
}

# Used to grep sys logs later in case of crashes
start_time="$(date '+%Y-%m-%d %H:%M:%S')"

# Act out the actual commands (and time constrain them to create buffer for the end of this script)
source command.sh & PID=$! ; (sleep $command_timeout && kill $PID 2> /dev/null & ) ; wait $PID
# shellcheck disable=SC1091
source command.sh & PID=$! ; (sleep "$command_timeout" && kill $PID 2> /dev/null & ) ; wait $PID
exit_code=$?

# In case of issues, include the syslog (last 2 MB from the time this work item has been running)
if [ $exit_code -ne 0 ]; then
sudo log show --style syslog --start "$start_time" --end "$(date '+%Y-%m-%d %H:%M:%S')" | tail -c 2097152 > "$output_directory/system.log"
fi

# Exit code values - https://github.com/dotnet/xharness/blob/main/src/Microsoft.DotNet.XHarness.Common/CLI/ExitCode.cs

# Kill the simulator just in case when we fail to launch the app
Expand Down