Merge pull request #680 from realm/larkost/639-report-xctest-errors

better report errors in test/build
This commit is contained in:
Ari Lazier 2016-11-21 17:17:27 -08:00 committed by GitHub
commit 537e3824be
1 changed files with 13 additions and 5 deletions

View File

@ -83,13 +83,21 @@ start_packager() {
xctest() { xctest() {
local dest="$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')" local dest="$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')"
if [ -n "$XCPRETTY" ]; then if [ -n "$XCPRETTY" ]; then
mkdir -p build LOGTEMP=`mktemp build.log.XXXXXX`
xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$dest" build test | tee build/build.log | "$XCPRETTY" -c --no-utf --report junit --output build/reports/junit.xml || { trap "rm $LOGTEMP" EXIT
echo "The raw xcodebuild output is available in build/build.log" xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$dest" build test 2>&1 | tee "$LOGTEMP" | "$XCPRETTY" -c --no-utf --report junit --output build/reports/junit.xml || {
exit 1 EXITCODE=$?
printf "*** Xcode Failure (exit code $EXITCODE). The full xcode log follows: ***\n\n"
cat "$LOGTEMP"
printf "\n\n*** End Xcode Failure ***\n"
exit $EXITCODE
} }
else else
xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$dest" build test xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$dest" build test || {
EXITCODE=$?
echo "*** Failure (exit code $EXITCODE). ***"
exit $EXITCODE
}
fi fi
} }