Skip to content
This repository was archived by the owner on Aug 4, 2022. It is now read-only.

Commit 3f4c27c

Browse files
jverkoeyajsecord
authored andcommitted
Improved support for unit test runs (#7)
* Output test errors to the console. * More failure handling. * Always output. * Don't fail. * Simplier. * Cleanup.
1 parent 0f07d8f commit 3f4c27c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

bazel.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ min_xcode_version="$(version_as_number $3)"
5252

5353
# Dependencies
5454

55-
if [ -z "$KOKORO_BUILD_NUMBER" ]; then
56-
: # Local run - nothing to do.
57-
else
55+
if [ -n "$KOKORO_BUILD_NUMBER" ]; then
5856
# Move into our cloned repo
5957
cd github/repo
6058
fi
@@ -66,9 +64,7 @@ ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
6664
| grep string \
6765
| cut -d'>' -f2 \
6866
| cut -d'<' -f1)
69-
if [ -z "$min_xcode_version" ]; then
70-
:
71-
else
67+
if [ -n "$min_xcode_version" ]; then
7268
xcode_version_as_number="$(version_as_number $xcode_version)"
7369

7470
# TODO: This doesn't work yet.
@@ -77,14 +73,23 @@ ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
7773
fi
7874
fi
7975

80-
set +x
76+
extra_args=""
8177
if [ "$action" == "build" ]; then
8278
echo "🏗️ $target with Xcode $xcode_version..."
8379
elif [ "$action" == "test" ]; then
8480
echo "🛠️ $target with Xcode $xcode_version..."
81+
extra_args="--test_output=errors"
82+
83+
if [ -n "$KOKORO_BUILD_NUMBER" ]; then
84+
sudo xcode-select --switch /Applications/$xcode_path/Contents/Developer
85+
xcodebuild -version
86+
87+
# Resolves the following crash when switching Xcode versions:
88+
# "Failed to locate a valid instance of CoreSimulatorService in the bootstrap"
89+
launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true
90+
fi
8591
fi
86-
set -x
8792

8893
bazel clean
89-
bazel $action $target --xcode_version $xcode_version
94+
bazel $action $target --xcode_version $xcode_version $extra_args
9095
done

0 commit comments

Comments
 (0)