Separate build and test steps in xcode to reduce chance of hitting "Early unexpected exit"

This commit is contained in:
Thomas Goyne 2017-09-18 22:32:41 -07:00
parent d04a45b8d1
commit f3f51ece76
1 changed files with 10 additions and 5 deletions

View File

@ -122,12 +122,17 @@ xctest() {
echo " done" echo " done"
# - Run the build and test # - Run the build and test
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$IOS_SIM_DEVICE" build || {
EXITCODE=$?
echo "*** Failure (exit code $EXITCODE). ***"
exit $EXITCODE
}
if [ -n "$XCPRETTY" ]; then if [ -n "$XCPRETTY" ]; then
log_temp=$(mktemp build.log.XXXXXX) log_temp=$(mktemp build.log.XXXXXX)
if [ -e "$log_temp" ]; then if [ -e "$log_temp" ]; then
rm "$log_temp" rm "$log_temp"
fi fi
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination name="iPhone 5s" build test 2>&1 | tee "$log_temp" | "$XCPRETTY" -c --no-utf --report junit --output build/reports/junit.xml || { xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination name="iPhone 5s" test 2>&1 | tee "$log_temp" | "$XCPRETTY" -c --no-utf --report junit --output build/reports/junit.xml || {
EXITCODE=$? EXITCODE=$?
printf "*** Xcode Failure (exit code %s). The full xcode log follows: ***\n\n" "$EXITCODE" printf "*** Xcode Failure (exit code %s). The full xcode log follows: ***\n\n" "$EXITCODE"
cat "$log_temp" cat "$log_temp"
@ -136,7 +141,7 @@ xctest() {
} }
rm "$log_temp" rm "$log_temp"
else else
xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$IOS_SIM_DEVICE" build test || { xcrun xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$IOS_SIM_DEVICE" test || {
EXITCODE=$? EXITCODE=$?
echo "*** Failure (exit code $EXITCODE). ***" echo "*** Failure (exit code $EXITCODE). ***"
exit $EXITCODE exit $EXITCODE