Skip to content

Commit 98f0f37

Browse files
thomasvlTeBoring
authored andcommitted
Automated testing tweaks for ObjC
- Move the ObjC tests into the list and exclude them on linux, this will change where in the order they start, since they are longer, it will have other things run in parallel instead of them ending up last and taking the longest. - Switch to the Xcode 7.3 image. - Drop the use of xctool and stream line things through the full_mac_build.sh script. This means we end up with only one build script instead of two. - Tweaks to the mac build script: - Make iOS Xcode version support explicit - Support Debug/Release only building - Change the OS X min parallel count to 2 to better deal with VMs. - Split the travis ios tests into the two Xcode Configurations as the logs are choking travis.
1 parent 72df844 commit 98f0f37

File tree

3 files changed

+84
-79
lines changed

3 files changed

+84
-79
lines changed

.travis.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ os:
88
- linux
99
- osx
1010
# The Objective C build needs Xcode 7.0 or later.
11-
osx_image: xcode7.2
11+
osx_image: xcode7.3
1212
script:
1313
- ./tests.sh $CONFIG
1414
env:
@@ -23,6 +23,11 @@ env:
2323
- CONFIG=javanano_jdk7
2424
- CONFIG=javanano_oracle7
2525
- CONFIG=javascript
26+
# iOS build log was starting to choke travis UI, so split to cover the
27+
# Xcode Debug and Release Configurations independently.
28+
- CONFIG=objectivec_ios_debug
29+
- CONFIG=objectivec_ios_release
30+
- CONFIG=objectivec_osx
2631
- CONFIG=python
2732
- CONFIG=python_cpp
2833
- CONFIG=ruby19
@@ -54,12 +59,13 @@ matrix:
5459
# which doesn't work on OS X.
5560
- os: osx
5661
env: CONFIG=golang
57-
# Add into the matrix OS X tests of Objective C (needs Xcode, so it won't
58-
# work on other platforms). These are split so it doesn't take as long to run.
59-
include:
60-
- os: osx
61-
env: CONFIG=objectivec_ios
62-
- os: osx
62+
# OS X/iOS tests of Objective C (needs Xcode, so it won't work on other
63+
# platforms).
64+
- os: linux
65+
env: CONFIG=objectivec_ios_debug
66+
- os: linux
67+
env: CONFIG=objectivec_ios_release
68+
- os: linux
6369
env: CONFIG=objectivec_osx
6470
allow_failures:
6571
# These currently do not work on OS X but are being worked on by @haberman.
@@ -71,14 +77,11 @@ matrix:
7177
# we moved to an OS X image that is 10.11.
7278
- os: osx
7379
env: CONFIG=python_cpp
74-
# xctool 0.2.8 seems to have a bug where it randomly kills tests saying
75-
# they failed.
76-
# https://github.com/facebook/xctool/issues/619
77-
# https://github.com/google/protobuf/issues/1232
78-
# travis updated their images to include 0.2.8:
79-
# https://blog.travis-ci.com/2016-03-23-xcode-image-updates
80-
# Mark the iOS test as flakey so these failures don't turn things red.
80+
# Mark the iOS test as flakey as xcodebuild some times fails to start the
81+
# iOS Simulator.
82+
- os: osx
83+
env: CONFIG=objectivec_ios_debug
8184
- os: osx
82-
env: CONFIG=objectivec_ios
85+
env: CONFIG=objectivec_ios_release
8386
notifications:
8487
email: false

objectivec/DevTools/full_mac_build.sh

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ OPTIONS:
3737
Skip the invoke of Xcode to test the runtime on both iOS and OS X.
3838
--skip-xcode-ios
3939
Skip the invoke of Xcode to test the runtime on iOS.
40+
--skip-xcode-debug
41+
Skip the Xcode Debug configuration.
42+
--skip-xcode-release
43+
Skip the Xcode Release configuration.
4044
--skip-xcode-osx
4145
Skip the invoke of Xcode to test the runtime on OS X.
4246
--skip-objc-conformance
@@ -66,8 +70,8 @@ wrapped_make() {
6670
}
6771

6872
NUM_MAKE_JOBS=$(/usr/sbin/sysctl -n hw.ncpu)
69-
if [[ "${NUM_MAKE_JOBS}" -lt 4 ]] ; then
70-
NUM_MAKE_JOBS=4
73+
if [[ "${NUM_MAKE_JOBS}" -lt 2 ]] ; then
74+
NUM_MAKE_JOBS=2
7175
fi
7276

7377
DO_AUTOGEN=no
@@ -76,6 +80,8 @@ REGEN_DESCRIPTORS=no
7680
CORE_ONLY=no
7781
DO_XCODE_IOS_TESTS=yes
7882
DO_XCODE_OSX_TESTS=yes
83+
DO_XCODE_DEBUG=yes
84+
DO_XCODE_RELEASE=yes
7985
DO_OBJC_CONFORMANCE_TESTS=yes
8086
while [[ $# != 0 ]]; do
8187
case "${1}" in
@@ -109,6 +115,12 @@ while [[ $# != 0 ]]; do
109115
--skip-xcode-osx )
110116
DO_XCODE_OSX_TESTS=no
111117
;;
118+
--skip-xcode-debug )
119+
DO_XCODE_DEBUG=no
120+
;;
121+
--skip-xcode-release )
122+
DO_XCODE_RELEASE=no
123+
;;
112124
--skip-objc-conformance )
113125
DO_OBJC_CONFORMANCE_TESTS=no
114126
;;
@@ -151,17 +163,25 @@ if [[ "${DO_CLEAN}" == "yes" ]] ; then
151163
-project objectivec/ProtocolBuffers_iOS.xcodeproj
152164
-scheme ProtocolBuffers
153165
)
154-
"${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Debug clean
155-
"${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Release clean
166+
if [[ "${DO_XCODE_DEBUG}" == "yes" ]] ; then
167+
"${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Debug clean
168+
fi
169+
if [[ "${DO_XCODE_RELEASE}" == "yes" ]] ; then
170+
"${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Release clean
171+
fi
156172
fi
157173
if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
158174
XCODEBUILD_CLEAN_BASE_OSX=(
159175
xcodebuild
160176
-project objectivec/ProtocolBuffers_OSX.xcodeproj
161177
-scheme ProtocolBuffers
162178
)
163-
"${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Debug clean
164-
"${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Release clean
179+
if [[ "${DO_XCODE_DEBUG}" == "yes" ]] ; then
180+
"${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Debug clean
181+
fi
182+
if [[ "${DO_XCODE_RELEASE}" == "yes" ]] ; then
183+
"${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Release clean
184+
fi
165185
fi
166186
fi
167187

@@ -222,31 +242,35 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
222242
-destination "platform=iOS Simulator,name=iPad Air,OS=9.0" # 64bit
223243
)
224244
;;
225-
7.3* )
245+
7.2* )
226246
XCODEBUILD_TEST_BASE_IOS+=(
227247
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
228-
-destination "platform=iOS Simulator,name=iPhone 6,OS=9.3" # 64bit
248+
-destination "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit
229249
-destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
230-
-destination "platform=iOS Simulator,name=iPad Air,OS=9.3" # 64bit
250+
-destination "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit
231251
)
232252
;;
233-
7.* )
253+
7.3* )
234254
XCODEBUILD_TEST_BASE_IOS+=(
235255
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
236-
-destination "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit
256+
-destination "platform=iOS Simulator,name=iPhone 6,OS=9.3" # 64bit
237257
-destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
238-
-destination "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit
258+
-destination "platform=iOS Simulator,name=iPad Air,OS=9.3" # 64bit
239259
)
240260
;;
241261
* )
242262
echo "Time to update the simulator targets for Xcode ${XCODE_VERSION}"
243263
exit 2
244264
;;
245265
esac
246-
header "Doing Xcode iOS build/tests - Debug"
247-
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
248-
header "Doing Xcode iOS build/tests - Release"
249-
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Release test
266+
if [[ "${DO_XCODE_DEBUG}" == "yes" ]] ; then
267+
header "Doing Xcode iOS build/tests - Debug"
268+
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
269+
fi
270+
if [[ "${DO_XCODE_RELEASE}" == "yes" ]] ; then
271+
header "Doing Xcode iOS build/tests - Release"
272+
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Release test
273+
fi
250274
# Don't leave the simulator in the developer's face.
251275
killall "${IOS_SIMULATOR_NAME}"
252276
fi
@@ -258,13 +282,18 @@ if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
258282
# Since the ObjC 2.0 Runtime is required, 32bit OS X isn't supported.
259283
-destination "platform=OS X,arch=x86_64" # 64bit
260284
)
261-
header "Doing Xcode OS X build/tests - Debug"
262-
"${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Debug test
263-
header "Doing Xcode OS X build/tests - Release"
264-
"${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Release test
285+
if [[ "${DO_XCODE_DEBUG}" == "yes" ]] ; then
286+
header "Doing Xcode OS X build/tests - Debug"
287+
"${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Debug test
288+
fi
289+
if [[ "${DO_XCODE_RELEASE}" == "yes" ]] ; then
290+
header "Doing Xcode OS X build/tests - Release"
291+
"${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Release test
292+
fi
265293
fi
266294

267295
if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
296+
header "Running ObjC Conformance Tests"
268297
cd conformance
269298
wrapped_make -j "${NUM_MAKE_JOBS}" test_objc
270299
cd ..

tests.sh

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -197,59 +197,30 @@ internal_install_python_deps() {
197197
fi
198198
}
199199

200-
internal_objectivec_common () {
201-
# Make sure xctool is up to date. Adapted from
202-
# http://docs.travis-ci.com/user/osx-ci-environment/
203-
# We don't use a before_install because we test multiple OSes.
204-
brew update
205-
brew outdated xctool || brew upgrade xctool
200+
build_objectivec_ios() {
206201
# Reused the build script that takes care of configuring and ensuring things
207-
# are up to date. Xcode and conformance tests will be directly invoked.
202+
# are up to date. The OS X test runs the objc conformance test, so skip it
203+
# here.
204+
# Note: travis has xctool installed, and we've looked at using it in the past
205+
# but it has ended up proving unreliable (bugs), an they are removing build
206+
# support in favor of xcbuild (or just xcodebuild).
208207
objectivec/DevTools/full_mac_build.sh \
209-
--core-only --skip-xcode --skip-objc-conformance
208+
--core-only --skip-xcode-osx --skip-objc-conformance "$@"
210209
}
211210

212-
internal_xctool_debug_and_release() {
213-
# Always use -reporter plain to avoid escape codes in output (makes travis
214-
# logs easier to read).
215-
xctool -reporter plain -configuration Debug "$@"
216-
xctool -reporter plain -configuration Release "$@"
211+
build_objectivec_ios_debug() {
212+
build_objectivec_ios --skip-xcode-release
217213
}
218214

219-
build_objectivec_ios() {
220-
internal_objectivec_common
221-
# https://github.com/facebook/xctool/issues/509 - unlike xcodebuild, xctool
222-
# doesn't support >1 destination, so we have to build first and then run the
223-
# tests one destination at a time.
224-
internal_xctool_debug_and_release \
225-
-project objectivec/ProtocolBuffers_iOS.xcodeproj \
226-
-scheme ProtocolBuffers \
227-
-sdk iphonesimulator \
228-
build-tests
229-
IOS_DESTINATIONS=(
230-
"platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
231-
"platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit
232-
"platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
233-
"platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit
234-
)
235-
for i in "${IOS_DESTINATIONS[@]}" ; do
236-
internal_xctool_debug_and_release \
237-
-project objectivec/ProtocolBuffers_iOS.xcodeproj \
238-
-scheme ProtocolBuffers \
239-
-sdk iphonesimulator \
240-
-destination "${i}" \
241-
run-tests
242-
done
215+
build_objectivec_ios_release() {
216+
build_objectivec_ios --skip-xcode-debug
243217
}
244218

245219
build_objectivec_osx() {
246-
internal_objectivec_common
247-
internal_xctool_debug_and_release \
248-
-project objectivec/ProtocolBuffers_OSX.xcodeproj \
249-
-scheme ProtocolBuffers \
250-
-destination "platform=OS X,arch=x86_64" \
251-
test
252-
cd conformance && make test_objc && cd ..
220+
# Reused the build script that takes care of configuring and ensuring things
221+
# are up to date.
222+
objectivec/DevTools/full_mac_build.sh \
223+
--core-only --skip-xcode-ios
253224
}
254225

255226
build_python() {
@@ -330,6 +301,8 @@ Usage: $0 { cpp |
330301
javanano_jdk7 |
331302
javanano_oracle7 |
332303
objectivec_ios |
304+
objectivec_ios_debug |
305+
objectivec_ios_release |
333306
objectivec_osx |
334307
python |
335308
python_cpp |

0 commit comments

Comments
 (0)