Skip to content

Commit

Permalink
[Infra] Add check for unexpected test failures in build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard committed Nov 18, 2024
1 parent d84d5ef commit fd7d12e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ source scripts/check_secrets.sh
function RunXcodebuild() {
echo xcodebuild "$@"

xcbeautify_cmd=(xcbeautify --renderer github-actions)
xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)

result=0
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$?
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
&& CheckUnexpectedFailures xcodebuild.log \
|| result=$?

if [[ $result == 65 ]]; then
ExportLogs "$@"
Expand All @@ -122,7 +124,9 @@ function RunXcodebuild() {
sleep 5

result=0
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$?
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
&& CheckUnexpectedFailures xcodebuild.log \
|| result=$?
fi

if [[ $result != 0 ]]; then
Expand All @@ -138,6 +142,15 @@ function ExportLogs() {
python "${scripts_dir}/xcresult_logs.py" "$@"
}

function CheckUnexpectedFailures() {
local log_file=$1

if grep -Eq "[1-9]\d* failures \([1-9]\d* unexpected\)" "$log_file"; then
echo "xcodebuild failed with unexpected failures." 1>&2
return 65
fi
}

if [[ "$xcode_major" -lt 15 ]]; then
ios_flags=(
-sdk 'iphonesimulator'
Expand Down

0 comments on commit fd7d12e

Please sign in to comment.