1
1
#! /bin/bash
2
2
#
3
- # Build and runs tests for the protobuf project. The tests as written here are
4
- # used by both Jenkins and Travis, though some specialized logic is required to
5
- # handle the differences between them.
6
-
7
- on_travis () {
8
- if [ " $TRAVIS " == " true" ]; then
9
- " $@ "
10
- fi
11
- }
3
+ # Build and runs tests for the protobuf project. We use this script to run
4
+ # tests on kokoro (Ubuntu and MacOS). It can run locally as well but you
5
+ # will need to make sure the required compilers/tools are available.
12
6
13
7
# For when some other test needs the C++ main build, including protoc and
14
8
# libprotobuf.
@@ -18,15 +12,6 @@ internal_build_cpp() {
18
12
return
19
13
fi
20
14
21
- if [[ $( uname -s) == " Linux" && " $TRAVIS " == " true" ]]; then
22
- # Install GCC 4.8 to replace the default GCC 4.6. We need 4.8 for more
23
- # decent C++ 11 support in order to compile conformance tests.
24
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
25
- sudo apt-get update -qq
26
- sudo apt-get install -qq g++-4.8
27
- export CXX=" g++-4.8" CC=" gcc-4.8"
28
- fi
29
-
30
15
# Initialize any submodules.
31
16
git submodule update --init --recursive
32
17
@@ -43,8 +28,6 @@ build_cpp() {
43
28
44
29
# The benchmark code depends on cmake, so test if it is installed before
45
30
# trying to do the build.
46
- # NOTE: The travis macOS images say they have cmake, but the xcode8.1 image
47
- # appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996
48
31
if [[ $( type cmake 2> /dev/null) ]]; then
49
32
# Verify benchmarking code can build successfully.
50
33
cd benchmarks && make cpp-benchmark && cd ..
@@ -121,10 +104,6 @@ build_golang() {
121
104
# Add protoc to the path so that the examples build finds it.
122
105
export PATH=" ` pwd` /src:$PATH "
123
106
124
- # Install Go and the Go protobuf compiler plugin.
125
- on_travis sudo apt-get update -qq
126
- on_travis sudo apt-get install -qq golang
127
-
128
107
export GOPATH=" $HOME /gocode"
129
108
mkdir -p " $GOPATH /src/github.com/google"
130
109
rm -f " $GOPATH /src/github.com/google/protobuf"
@@ -139,27 +118,17 @@ use_java() {
139
118
version=$1
140
119
case " $version " in
141
120
jdk7)
142
- on_travis sudo apt-get install openjdk-7-jdk
143
121
export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
144
122
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
145
123
;;
146
124
oracle7)
147
- if [ " $TRAVIS " == " true" ]; then
148
- sudo apt-get install python-software-properties # for apt-add-repository
149
- echo " oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | \
150
- sudo debconf-set-selections
151
- yes | sudo apt-add-repository ppa:webupd8team/java
152
- yes | sudo apt-get install oracle-java7-installer
153
- fi ;
154
125
export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH
155
126
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
156
127
;;
157
128
esac
158
129
159
- if [ " $TRAVIS " != " true" ]; then
160
- MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
161
- MVN=" $MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY "
162
- fi ;
130
+ MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
131
+ MVN=" $MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY "
163
132
164
133
which java
165
134
java -version
@@ -190,12 +159,6 @@ build_java_with_conformance_tests() {
190
159
cd conformance && make test_java && cd ..
191
160
}
192
161
193
- build_javanano () {
194
- # Java build needs `protoc`.
195
- internal_build_cpp
196
- cd javanano && $MVN test && cd ..
197
- }
198
-
199
162
build_java_jdk7 () {
200
163
use_java jdk7
201
164
build_java_with_conformance_tests
@@ -213,38 +176,6 @@ build_java_compatibility() {
213
176
./test.sh 3.0.0-beta-4
214
177
}
215
178
216
- build_javanano_jdk7 () {
217
- use_java jdk7
218
- build_javanano
219
- }
220
- build_javanano_oracle7 () {
221
- use_java oracle7
222
- build_javanano
223
- }
224
-
225
- internal_install_python_deps () {
226
- if [ " $TRAVIS " != " true" ]; then
227
- return ;
228
- fi
229
- # Install tox (OS X doesn't have pip).
230
- if [ $( uname -s) == " Darwin" ]; then
231
- brew upgrade python
232
- python3 -m pip install tox
233
- else
234
- sudo pip install tox
235
- fi
236
- # Only install Python2.6/3.x on Linux.
237
- if [ $( uname -s) == " Linux" ]; then
238
- sudo apt-get install -y python-software-properties # for apt-add-repository
239
- sudo apt-add-repository -y ppa:fkrull/deadsnakes
240
- sudo apt-get update -qq
241
- sudo apt-get install -y python3.3 python3.3-dev
242
- sudo apt-get install -y python3.4 python3.4-dev
243
- sudo apt-get install -y python3.5 python3.5-dev
244
- sudo apt-get install -y python3.6 python3.6-dev
245
- fi
246
- }
247
-
248
179
build_objectivec_ios () {
249
180
# Reused the build script that takes care of configuring and ensuring things
250
181
# are up to date. The OS X test runs the objc conformance test, so skip it
@@ -279,9 +210,7 @@ build_objectivec_cocoapods_integration() {
279
210
280
211
build_python () {
281
212
internal_build_cpp
282
- internal_install_python_deps
283
213
cd python
284
- # Only test Python 2.6/3.x on Linux
285
214
if [ $( uname -s) == " Linux" ]; then
286
215
envlist=py\{ 27,33,34,35,36\} -python
287
216
else
@@ -293,11 +222,9 @@ build_python() {
293
222
294
223
build_python_cpp () {
295
224
internal_build_cpp
296
- internal_install_python_deps
297
225
export LD_LIBRARY_PATH=../src/.libs # for Linux
298
226
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
299
227
cd python
300
- # Only test Python 3.x on Linux
301
228
if [ $( uname -s) == " Linux" ]; then
302
229
envlist=py\{ 27,33,34,35,36\} -cpp
303
230
else
@@ -337,21 +264,12 @@ build_ruby25() {
337
264
internal_build_cpp # For conformance tests.
338
265
cd ruby && bash travis-test.sh ruby-2.5.0 && cd ..
339
266
}
340
- build_jruby () {
341
- internal_build_cpp # For conformance tests.
342
- # TODO(xiaofeng): Upgrade to jruby-9.x. There are some broken jests to be
343
- # fixed.
344
- cd ruby && bash travis-test.sh jruby-1.7 && cd ..
345
- }
346
267
build_ruby_all () {
347
268
build_ruby21
348
269
build_ruby22
349
270
build_ruby23
350
271
build_ruby24
351
272
build_ruby25
352
- # TODO(teboring): Disable jruby test temperarily for it randomly fails.
353
- # https://grpc-testing.appspot.com/job/protobuf_pull_request/735/consoleFull.
354
- # build_jruby
355
273
}
356
274
357
275
build_javascript () {
@@ -632,14 +550,6 @@ build_php_all() {
632
550
build_php_compatibility
633
551
}
634
552
635
- # Note: travis currently does not support testing more than one language so the
636
- # .travis.yml cheats and claims to only be cpp. If they add multiple language
637
- # support, this should probably get updated to install steps and/or
638
- # rvm/gemfile/jdk/etc. entries rather than manually doing the work.
639
-
640
- # .travis.yml uses matrix.exclude to block the cases where app-get can't be
641
- # use to install things.
642
-
643
553
# -------- main --------
644
554
645
555
if [ " $# " -ne 1 ]; then
@@ -650,8 +560,6 @@ Usage: $0 { cpp |
650
560
java_jdk7 |
651
561
java_oracle7 |
652
562
java_compatibility |
653
- javanano_jdk7 |
654
- javanano_oracle7 |
655
563
objectivec_ios |
656
564
objectivec_ios_debug |
657
565
objectivec_ios_release |
680
588
681
589
set -e # exit immediately on error
682
590
set -x # display all commands
591
+ cd $( dirname $0 )
683
592
eval " build_$1 "
0 commit comments