blob: 09865fa6253d4be272a245c9d398060b5da79416 [file] [log] [blame]
xyzzyza5b3d51a2016-06-02 19:58:001#!/bin/bash
2#
Mohamed Heikale10d9892019-08-20 18:56:203# 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.
xyzzyz7cf8148f2016-04-20 23:50:236
7# For when some other test needs the C++ main build, including protoc and
8# libprotobuf.
Andres Medinaf348ad32020-11-18 16:55:369LAST_RELEASED=3.9.0
10
xyzzyz7cf8148f2016-04-20 23:50:2311internal_build_cpp() {
xyzzyza5b3d51a2016-06-02 19:58:0012 if [ -f src/protoc ]; then
13 # Already built.
14 return
15 fi
16
Andres Medinae684cf42018-08-27 18:48:2317 # Initialize any submodules.
18 git submodule update --init --recursive
19
xyzzyz7cf8148f2016-04-20 23:50:2320 ./autogen.sh
Mohamed Heikale10d9892019-08-20 18:56:2021 ./configure CXXFLAGS="-fPIC -std=c++11" # -fPIC is needed for python cpp test.
22 # See python/setup.py for more details
23 make -j$(nproc)
xyzzyz7cf8148f2016-04-20 23:50:2324}
25
26build_cpp() {
27 internal_build_cpp
Mohamed Heikale10d9892019-08-20 18:56:2028 make check -j$(nproc) || (cat src/test-suite.log; false)
xyzzyz7cf8148f2016-04-20 23:50:2329 cd conformance && make test_cpp && cd ..
30}
31
Mohamed Heikale10d9892019-08-20 18:56:2032build_cpp_tcmalloc() {
33 internal_build_cpp
34 ./configure LIBS=-ltcmalloc && make clean && make \
35 PTHREAD_CFLAGS='-pthread -DGOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN' \
36 check
37 cd src
38 PPROF_PATH=/usr/bin/google-pprof HEAPCHECK=strict ./protobuf-test
39}
40
xyzzyz7cf8148f2016-04-20 23:50:2341build_cpp_distcheck() {
Mohamed Heikale10d9892019-08-20 18:56:2042 grep -q -- "-Og" src/Makefile.am &&
43 echo "The -Og flag is incompatible with Clang versions older than 4.0." &&
44 exit 1
45
Andres Medinae684cf42018-08-27 18:48:2346 # Initialize any submodules.
47 git submodule update --init --recursive
xyzzyz7cf8148f2016-04-20 23:50:2348 ./autogen.sh
49 ./configure
Tom Andersonac47edd2017-07-27 17:23:1450 make dist
51
52 # List all files that should be included in the distribution package.
Andres Medinae684cf42018-08-27 18:48:2353 git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\
Tommy Nyquist29527fb2022-06-29 19:29:4454 grep -v ".gitignore" | grep -v "java/lite/proguard.pgcfg" |\
Andres Medinaf348ad32020-11-18 16:55:3655 grep -v "python/compatibility_tests" | grep -v "python/docs" | grep -v "python/.repo-metadata.json" |\
56 grep -v "python/protobuf_distutils" | grep -v "csharp/compatibility_tests" > dist.lst
Tom Andersonac47edd2017-07-27 17:23:1457 # Unzip the dist tar file.
58 DIST=`ls *.tar.gz`
59 tar -xf $DIST
60 cd ${DIST//.tar.gz}
61 # Check if every file exists in the dist tar file.
62 FILES_MISSING=""
63 for FILE in $(<../dist.lst); do
Mohamed Heikale10d9892019-08-20 18:56:2064 [ -f "$FILE" ] || {
Tom Andersonac47edd2017-07-27 17:23:1465 echo "$FILE is not found!"
66 FILES_MISSING="$FILE $FILES_MISSING"
Mohamed Heikale10d9892019-08-20 18:56:2067 }
Tom Andersonac47edd2017-07-27 17:23:1468 done
69 cd ..
70 if [ ! -z "$FILES_MISSING" ]; then
71 echo "Missing files in EXTRA_DIST: $FILES_MISSING"
72 exit 1
73 fi
74
75 # Do the regular dist-check for C++.
Mohamed Heikale10d9892019-08-20 18:56:2076 make distcheck -j$(nproc)
77}
78
79build_dist_install() {
Tommy Nyquist29527fb2022-06-29 19:29:4480 # Create a symlink pointing to python2 and put it at the beginning of $PATH.
81 # This is necessary because the googletest build system involves a Python
82 # script that is not compatible with Python 3. More recent googletest
83 # versions have fixed this, but they have also removed the autotools build
84 # system support that we rely on. This is a temporary workaround to keep the
85 # googletest build working when the default python binary is Python 3.
86 mkdir tmp || true
87 pushd tmp
88 ln -s /usr/bin/python2 ./python
89 popd
90 PATH=$PWD/tmp:$PATH
91
Mohamed Heikale10d9892019-08-20 18:56:2092 # Initialize any submodules.
93 git submodule update --init --recursive
94 ./autogen.sh
95 ./configure
96 make dist
97
98 # Unzip the dist tar file and install it.
99 DIST=`ls *.tar.gz`
100 tar -xf $DIST
101 pushd ${DIST//.tar.gz}
102 ./configure && make check -j4 && make install
103
104 export LD_LIBRARY_PATH=/usr/local/lib
105
106 # Try to install Java
107 pushd java
Tommy Nyquist29527fb2022-06-29 19:29:44108 use_java jdk11
Mohamed Heikale10d9892019-08-20 18:56:20109 $MVN install
110 popd
111
112 # Try to install Python
Tommy Nyquist29527fb2022-06-29 19:29:44113 python3 -m venv venv
Mohamed Heikale10d9892019-08-20 18:56:20114 source venv/bin/activate
115 pushd python
Tommy Nyquist29527fb2022-06-29 19:29:44116 python3 setup.py clean build sdist
117 pip3 install dist/protobuf-*.tar.gz
Mohamed Heikale10d9892019-08-20 18:56:20118 popd
119 deactivate
120 rm -rf python/venv
xyzzyz7cf8148f2016-04-20 23:50:23121}
122
123build_csharp() {
Andres Medinae684cf42018-08-27 18:48:23124 # Required for conformance tests and to regenerate protos.
xyzzyz7cf8148f2016-04-20 23:50:23125 internal_build_cpp
xyzzyza5b3d51a2016-06-02 19:58:00126 NUGET=/usr/local/bin/nuget.exe
xyzzyz7cf8148f2016-04-20 23:50:23127
Mohamed Heikale10d9892019-08-20 18:56:20128 # Disable some unwanted dotnet options
129 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
130 export DOTNET_CLI_TELEMETRY_OPTOUT=true
131
132 # TODO(jtattermusch): is this still needed with "first time experience"
133 # disabled?
Tom Andersonac47edd2017-07-27 17:23:14134 # Perform "dotnet new" once to get the setup preprocessing out of the
135 # way. That spews a lot of output (including backspaces) into logs
136 # otherwise, and can cause problems. It doesn't matter if this step
137 # is performed multiple times; it's cheap after the first time anyway.
138 # (It also doesn't matter if it's unnecessary, which it will be on some
139 # systems. It's necessary on Jenkins in order to avoid unprintable
140 # characters appearing in the JUnit output.)
141 mkdir dotnettmp
142 (cd dotnettmp; dotnet new > /dev/null)
143 rm -rf dotnettmp
xyzzyz7cf8148f2016-04-20 23:50:23144
Andres Medinae684cf42018-08-27 18:48:23145 # Check that the protos haven't broken C# codegen.
146 # TODO(jonskeet): Fail if regenerating creates any changes.
147 csharp/generate_protos.sh
148
xyzzyz7cf8148f2016-04-20 23:50:23149 csharp/buildall.sh
xyzzyza5b3d51a2016-06-02 19:58:00150 cd conformance && make test_csharp && cd ..
Tom Andersonac47edd2017-07-27 17:23:14151
152 # Run csharp compatibility test between 3.0.0 and the current version.
153 csharp/compatibility_tests/v3.0.0/test.sh 3.0.0
Andres Medinaf348ad32020-11-18 16:55:36154
155 # Run csharp compatibility test between last released and the current version.
156 csharp/compatibility_tests/v3.0.0/test.sh $LAST_RELEASED
xyzzyz7cf8148f2016-04-20 23:50:23157}
158
159build_golang() {
160 # Go build needs `protoc`.
161 internal_build_cpp
162 # Add protoc to the path so that the examples build finds it.
163 export PATH="`pwd`/src:$PATH"
164
xyzzyz7cf8148f2016-04-20 23:50:23165 export GOPATH="$HOME/gocode"
Mohamed Heikale10d9892019-08-20 18:56:20166 mkdir -p "$GOPATH/src/github.com/protocolbuffers"
Andres Medinaf348ad32020-11-18 16:55:36167 mkdir -p "$GOPATH/src/github.com/golang"
Mohamed Heikale10d9892019-08-20 18:56:20168 rm -f "$GOPATH/src/github.com/protocolbuffers/protobuf"
Andres Medinaf348ad32020-11-18 16:55:36169 rm -f "$GOPATH/src/github.com/golang/protobuf"
Mohamed Heikale10d9892019-08-20 18:56:20170 ln -s "`pwd`" "$GOPATH/src/github.com/protocolbuffers/protobuf"
xyzzyz7cf8148f2016-04-20 23:50:23171 export PATH="$GOPATH/bin:$PATH"
Andres Medinaf348ad32020-11-18 16:55:36172 (cd $GOPATH/src/github.com/golang && git clone https://github.com/golang/protobuf.git && cd protobuf && git checkout v1.3.5)
173 go install github.com/golang/protobuf/protoc-gen-go
xyzzyz7cf8148f2016-04-20 23:50:23174
Andres Medinae684cf42018-08-27 18:48:23175 cd examples && PROTO_PATH="-I../src -I." make gotest && cd ..
xyzzyz7cf8148f2016-04-20 23:50:23176}
177
178use_java() {
179 version=$1
180 case "$version" in
Tommy Nyquist29527fb2022-06-29 19:29:44181 jdk11)
182 export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
183 export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
184 ;;
Andres Medinaf348ad32020-11-18 16:55:36185 jdk8)
186 export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
187 export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
188 ;;
xyzzyz7cf8148f2016-04-20 23:50:23189 jdk7)
xyzzyz7cf8148f2016-04-20 23:50:23190 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
Tom Andersonac47edd2017-07-27 17:23:14191 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
xyzzyz7cf8148f2016-04-20 23:50:23192 ;;
193 oracle7)
xyzzyz7cf8148f2016-04-20 23:50:23194 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH
Tom Andersonac47edd2017-07-27 17:23:14195 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
xyzzyz7cf8148f2016-04-20 23:50:23196 ;;
197 esac
198
Mohamed Heikale10d9892019-08-20 18:56:20199 MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
Tommy Nyquist29527fb2022-06-29 19:29:44200 MVN="$MVN -e --quiet -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY"
xyzzyza5b3d51a2016-06-02 19:58:00201
xyzzyz7cf8148f2016-04-20 23:50:23202 which java
203 java -version
Tom Andersonac47edd2017-07-27 17:23:14204 $MVN -version
xyzzyz7cf8148f2016-04-20 23:50:23205}
206
Andres Medinaf348ad32020-11-18 16:55:36207# --batch-mode suppresses download progress output that spams the logs.
xyzzyza5b3d51a2016-06-02 19:58:00208MVN="mvn --batch-mode"
209
Tommy Nyquist29527fb2022-06-29 19:29:44210internal_build_java() {
xyzzyza5b3d51a2016-06-02 19:58:00211 version=$1
212 dir=java_$version
xyzzyz7cf8148f2016-04-20 23:50:23213 # Java build needs `protoc`.
214 internal_build_cpp
xyzzyza5b3d51a2016-06-02 19:58:00215 cp -r java $dir
Tommy Nyquist29527fb2022-06-29 19:29:44216 cd $dir && $MVN clean
217 # Skip tests here - callers will decide what tests they want to run
218 $MVN install -Dmaven.test.skip=true
219}
220
221build_java() {
222 version=$1
223 internal_build_java $version
224 # Skip the Kotlin tests on Oracle 7
225 if [ "$version" == "oracle7" ]; then
226 $MVN test -pl bom,lite,core,util
227 else
228 $MVN test
229 fi
xyzzyz7cf8148f2016-04-20 23:50:23230 cd ../..
231}
232
xyzzyza5b3d51a2016-06-02 19:58:00233# The conformance tests are hard-coded to work with the $ROOT/java directory.
234# So this can't run in parallel with two different sets of tests.
xyzzyz7cf8148f2016-04-20 23:50:23235build_java_with_conformance_tests() {
236 # Java build needs `protoc`.
237 internal_build_cpp
Andres Medinaf348ad32020-11-18 16:55:36238 # This local installation avoids the problem caused by a new version not yet in Maven Central
239 cd java/bom && $MVN install
240 cd ../..
Tommy Nyquist29527fb2022-06-29 19:29:44241 cd java/core && $MVN test && $MVN install
242 cd ../lite && $MVN test && $MVN install
243 cd ../util && $MVN test && $MVN install && $MVN package assembly:single
244 if [ "$version" == "jdk8" ]; then
245 cd ../kotlin && $MVN test && $MVN install
246 cd ../kotlin-lite && $MVN test && $MVN install
247 fi
xyzzyz7cf8148f2016-04-20 23:50:23248 cd ../..
249 cd conformance && make test_java && cd ..
250}
251
xyzzyz7cf8148f2016-04-20 23:50:23252build_java_jdk7() {
253 use_java jdk7
254 build_java_with_conformance_tests
255}
256build_java_oracle7() {
257 use_java oracle7
xyzzyza5b3d51a2016-06-02 19:58:00258 build_java oracle7
xyzzyz7cf8148f2016-04-20 23:50:23259}
Andres Medinaf348ad32020-11-18 16:55:36260build_java_linkage_monitor() {
261 # Linkage Monitor checks compatibility with other Google libraries
262 # https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
263
Tommy Nyquist29527fb2022-06-29 19:29:44264 use_java jdk11
Andres Medinaf348ad32020-11-18 16:55:36265 internal_build_cpp
266
267 # Linkage Monitor uses $HOME/.m2 local repository
268 MVN="mvn -e -B -Dhttps.protocols=TLSv1.2"
269 cd java
270 # Installs the snapshot version locally
271 $MVN install -Dmaven.test.skip=true
272
273 # Linkage Monitor uses the snapshot versions installed in $HOME/.m2 to verify compatibility
274 JAR=linkage-monitor-latest-all-deps.jar
275 curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}"
276 # Fails if there's new linkage errors compared with baseline
277 java -jar $JAR com.google.cloud:libraries-bom
Peter Kasting983299c942017-07-26 06:57:31278}
Tom Andersonac47edd2017-07-27 17:23:14279
Peter Kasting983299c942017-07-26 06:57:31280build_objectivec_ios() {
Tom Andersonac47edd2017-07-27 17:23:14281 # Reused the build script that takes care of configuring and ensuring things
282 # are up to date. The OS X test runs the objc conformance test, so skip it
283 # here.
Tom Andersonac47edd2017-07-27 17:23:14284 objectivec/DevTools/full_mac_build.sh \
Mohamed Heikale10d9892019-08-20 18:56:20285 --core-only --skip-xcode-osx --skip-xcode-tvos --skip-objc-conformance "$@"
Tom Andersonac47edd2017-07-27 17:23:14286}
287
288build_objectivec_ios_debug() {
289 build_objectivec_ios --skip-xcode-release
290}
291
292build_objectivec_ios_release() {
293 build_objectivec_ios --skip-xcode-debug
xyzzyz7cf8148f2016-04-20 23:50:23294}
295
296build_objectivec_osx() {
Tom Andersonac47edd2017-07-27 17:23:14297 # Reused the build script that takes care of configuring and ensuring things
298 # are up to date.
299 objectivec/DevTools/full_mac_build.sh \
Mohamed Heikale10d9892019-08-20 18:56:20300 --core-only --skip-xcode-ios --skip-xcode-tvos
301}
302
303build_objectivec_tvos() {
304 # Reused the build script that takes care of configuring and ensuring things
305 # are up to date. The OS X test runs the objc conformance test, so skip it
306 # here.
307 objectivec/DevTools/full_mac_build.sh \
308 --core-only --skip-xcode-ios --skip-xcode-osx --skip-objc-conformance "$@"
309}
310
311build_objectivec_tvos_debug() {
312 build_objectivec_tvos --skip-xcode-release
313}
314
315build_objectivec_tvos_release() {
316 build_objectivec_tvos --skip-xcode-debug
Tom Andersonac47edd2017-07-27 17:23:14317}
318
319build_objectivec_cocoapods_integration() {
Tom Andersonac47edd2017-07-27 17:23:14320 objectivec/Tests/CocoaPods/run_tests.sh
xyzzyz7cf8148f2016-04-20 23:50:23321}
322
323build_python() {
324 internal_build_cpp
xyzzyz7cf8148f2016-04-20 23:50:23325 cd python
Tommy Nyquist29527fb2022-06-29 19:29:44326 tox --skip-missing-interpreters
xyzzyz7cf8148f2016-04-20 23:50:23327 cd ..
328}
329
Mohamed Heikale10d9892019-08-20 18:56:20330build_python_version() {
331 internal_build_cpp
332 cd python
333 envlist=$1
Tommy Nyquist29527fb2022-06-29 19:29:44334 tox -e $envlist
Mohamed Heikale10d9892019-08-20 18:56:20335 cd ..
336}
337
Mohamed Heikale10d9892019-08-20 18:56:20338build_python37() {
339 build_python_version py37-python
340}
341
Andres Medinaf348ad32020-11-18 16:55:36342build_python38() {
343 build_python_version py38-python
344}
345
Tommy Nyquist29527fb2022-06-29 19:29:44346build_python39() {
347 build_python_version py39-python
348}
349
350build_python310() {
351 build_python_version py310-python
352}
353
xyzzyz7cf8148f2016-04-20 23:50:23354build_python_cpp() {
355 internal_build_cpp
xyzzyz7cf8148f2016-04-20 23:50:23356 export LD_LIBRARY_PATH=../src/.libs # for Linux
357 export DYLD_LIBRARY_PATH=../src/.libs # for OS X
358 cd python
Tommy Nyquist29527fb2022-06-29 19:29:44359 tox --skip-missing-interpreters
xyzzyz7cf8148f2016-04-20 23:50:23360 cd ..
361}
362
Mohamed Heikale10d9892019-08-20 18:56:20363build_python_cpp_version() {
364 internal_build_cpp
365 export LD_LIBRARY_PATH=../src/.libs # for Linux
366 export DYLD_LIBRARY_PATH=../src/.libs # for OS X
367 cd python
368 envlist=$1
369 tox -e $envlist
370 cd ..
371}
372
Mohamed Heikale10d9892019-08-20 18:56:20373build_python37_cpp() {
374 build_python_cpp_version py37-cpp
375}
376
Andres Medinaf348ad32020-11-18 16:55:36377build_python38_cpp() {
378 build_python_cpp_version py38-cpp
379}
380
Tommy Nyquist29527fb2022-06-29 19:29:44381build_python39_cpp() {
382 build_python_cpp_version py39-cpp
David Benjaminf8d98ca2022-06-22 18:34:42383}
384
Tommy Nyquist29527fb2022-06-29 19:29:44385build_python310_cpp() {
386 build_python_cpp_version py310-cpp
387}
388
389
Mohamed Heikale10d9892019-08-20 18:56:20390build_ruby23() {
xyzzyz7cf8148f2016-04-20 23:50:23391 internal_build_cpp # For conformance tests.
Mohamed Heikale10d9892019-08-20 18:56:20392 cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
xyzzyz7cf8148f2016-04-20 23:50:23393}
Mohamed Heikale10d9892019-08-20 18:56:20394build_ruby24() {
xyzzyz7cf8148f2016-04-20 23:50:23395 internal_build_cpp # For conformance tests.
Mohamed Heikale10d9892019-08-20 18:56:20396 cd ruby && bash travis-test.sh ruby-2.4 && cd ..
xyzzyz7cf8148f2016-04-20 23:50:23397}
Mohamed Heikale10d9892019-08-20 18:56:20398build_ruby25() {
xyzzyz7cf8148f2016-04-20 23:50:23399 internal_build_cpp # For conformance tests.
Mohamed Heikale10d9892019-08-20 18:56:20400 cd ruby && bash travis-test.sh ruby-2.5.1 && cd ..
Tom Andersonac47edd2017-07-27 17:23:14401}
Mohamed Heikale10d9892019-08-20 18:56:20402build_ruby26() {
403 internal_build_cpp # For conformance tests.
404 cd ruby && bash travis-test.sh ruby-2.6.0 && cd ..
xyzzyz7cf8148f2016-04-20 23:50:23405}
Andres Medinaf348ad32020-11-18 16:55:36406build_ruby27() {
407 internal_build_cpp # For conformance tests.
408 cd ruby && bash travis-test.sh ruby-2.7.0 && cd ..
409}
Tommy Nyquist29527fb2022-06-29 19:29:44410build_ruby30() {
411 internal_build_cpp # For conformance tests.
412 cd ruby && bash travis-test.sh ruby-3.0.2 && cd ..
413}
414build_ruby31() {
415 internal_build_cpp # For conformance tests.
416 cd ruby && bash travis-test.sh ruby-3.1.0 && cd ..
417}
418
419build_jruby92() {
420 internal_build_cpp # For conformance tests.
421 internal_build_java jdk8 && cd .. # For Maven protobuf jar with local changes
422 cd ruby && bash travis-test.sh jruby-9.2.20.1 && cd ..
423}
424
425build_jruby93() {
426 internal_build_cpp # For conformance tests.
427 internal_build_java jdk8 && cd .. # For Maven protobuf jar with local changes
428 cd ruby && bash travis-test.sh jruby-9.3.3.0 && cd ..
429}
xyzzyz7cf8148f2016-04-20 23:50:23430
431build_javascript() {
432 internal_build_cpp
Andres Medinaf348ad32020-11-18 16:55:36433 NODE_VERSION=node-v12.16.3-darwin-x64
434 NODE_TGZ="$NODE_VERSION.tar.gz"
435 pushd /tmp
436 curl -OL https://nodejs.org/dist/v12.16.3/$NODE_TGZ
437 tar zxvf $NODE_TGZ
438 export PATH=$PATH:`pwd`/$NODE_VERSION/bin
439 popd
xyzzyz7cf8148f2016-04-20 23:50:23440 cd js && npm install && npm test && cd ..
Tom Andersonac47edd2017-07-27 17:23:14441 cd conformance && make test_nodejs && cd ..
442}
443
Tom Andersonac47edd2017-07-27 17:23:14444use_php() {
445 VERSION=$1
Mohamed Heikale10d9892019-08-20 18:56:20446 export PATH=/usr/local/php-${VERSION}/bin:$PATH
Andres Medinaf348ad32020-11-18 16:55:36447 internal_build_cpp
Tom Andersonac47edd2017-07-27 17:23:14448}
449
Tommy Nyquist29527fb2022-06-29 19:29:44450build_php() {
451 use_php $1
Tom Andersonac47edd2017-07-27 17:23:14452 pushd php
453 rm -rf vendor
Tommy Nyquist29527fb2022-06-29 19:29:44454 php -v
455 php -m
Mohamed Heikale10d9892019-08-20 18:56:20456 composer update
Andres Medinaf348ad32020-11-18 16:55:36457 composer test
Tom Andersonac47edd2017-07-27 17:23:14458 popd
Andres Medinaf348ad32020-11-18 16:55:36459 (cd conformance && make test_php)
Tom Andersonac47edd2017-07-27 17:23:14460}
461
Tommy Nyquist29527fb2022-06-29 19:29:44462test_php_c() {
Finditd8c5cddc2022-06-22 20:46:25463 pushd php
464 rm -rf vendor
Tommy Nyquist29527fb2022-06-29 19:29:44465 php -v
466 php -m
Finditd8c5cddc2022-06-22 20:46:25467 composer update
Tommy Nyquist29527fb2022-06-29 19:29:44468 composer test_c
Finditd8c5cddc2022-06-22 20:46:25469 popd
Tommy Nyquist29527fb2022-06-29 19:29:44470 (cd conformance && make test_php_c)
Finditd8c5cddc2022-06-22 20:46:25471}
472
Tommy Nyquist29527fb2022-06-29 19:29:44473build_php_c() {
474 use_php $1
475 test_php_c
Tom Andersonac47edd2017-07-27 17:23:14476}
477
478build_php7.0_mac() {
Andres Medinaf348ad32020-11-18 16:55:36479 internal_build_cpp
Tom Andersonac47edd2017-07-27 17:23:14480 # Install PHP
481 curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
Andres Medinaf348ad32020-11-18 16:55:36482 PHP_FOLDER=`find /usr/local -type d -name "php5-7.0*"` # The folder name may change upon time
483 test ! -z "$PHP_FOLDER"
Tom Andersonac47edd2017-07-27 17:23:14484 export PATH="$PHP_FOLDER/bin:$PATH"
485
Tommy Nyquist29527fb2022-06-29 19:29:44486 # Install Composer
487 wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer
488 chmod a+x /usr/local/bin/composer
489
Tom Andersonac47edd2017-07-27 17:23:14490 # Install valgrind
491 echo "#! /bin/bash" > valgrind
492 chmod ug+x valgrind
493 sudo mv valgrind /usr/local/bin/valgrind
494
495 # Test
Tommy Nyquist29527fb2022-06-29 19:29:44496 test_php_c
Andres Medinaf348ad32020-11-18 16:55:36497}
498
499build_php7.3_mac() {
500 internal_build_cpp
501 # Install PHP
502 # We can't test PHP 7.4 with these binaries yet:
503 # https://github.com/liip/php-osx/issues/276
504 curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
505 PHP_FOLDER=`find /usr/local -type d -name "php5-7.3*"` # The folder name may change upon time
506 test ! -z "$PHP_FOLDER"
507 export PATH="$PHP_FOLDER/bin:$PATH"
508
Tommy Nyquist29527fb2022-06-29 19:29:44509 # Install Composer
510 wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer
511 chmod a+x /usr/local/bin/composer
512
Andres Medinaf348ad32020-11-18 16:55:36513 # Install valgrind
514 echo "#! /bin/bash" > valgrind
515 chmod ug+x valgrind
516 sudo mv valgrind /usr/local/bin/valgrind
517
518 # Test
Tommy Nyquist29527fb2022-06-29 19:29:44519 test_php_c
Tom Andersonac47edd2017-07-27 17:23:14520}
521
522build_php_compatibility() {
523 internal_build_cpp
Andres Medinaf348ad32020-11-18 16:55:36524 php/tests/compatibility_test.sh $LAST_RELEASED
525}
526
527build_php_multirequest() {
528 use_php 7.4
529 php/tests/multirequest.sh
Tom Andersonac47edd2017-07-27 17:23:14530}
531
Andres Medinaf348ad32020-11-18 16:55:36532build_php8.0_all() {
Tommy Nyquist29527fb2022-06-29 19:29:44533 build_php 8.0
534 build_php 8.1
535 build_php_c 8.0
536 build_php_c 8.1
Andres Medinaf348ad32020-11-18 16:55:36537}
538
Tom Andersonac47edd2017-07-27 17:23:14539build_php_all_32() {
Tommy Nyquist29527fb2022-06-29 19:29:44540 build_php 7.0
541 build_php 7.1
542 build_php 7.4
543 build_php_c 7.0
544 build_php_c 7.1
545 build_php_c 7.4
546 build_php_c 7.1-zts
547 build_php_c 7.2-zts
548 build_php_c 7.5-zts
Tom Andersonac47edd2017-07-27 17:23:14549}
550
551build_php_all() {
Tommy Nyquist29527fb2022-06-29 19:29:44552 build_php_all_32
Andres Medinaf348ad32020-11-18 16:55:36553 build_php_multirequest
Tom Andersonac47edd2017-07-27 17:23:14554 build_php_compatibility
xyzzyz7cf8148f2016-04-20 23:50:23555}
556
Mohamed Heikale10d9892019-08-20 18:56:20557build_benchmark() {
558 use_php 7.2
559 cd kokoro/linux/benchmark && ./run.sh
560}
xyzzyza5b3d51a2016-06-02 19:58:00561
xyzzyz7cf8148f2016-04-20 23:50:23562# -------- main --------
563
564if [ "$#" -ne 1 ]; then
565 echo "
566Usage: $0 { cpp |
Tom Andersonac47edd2017-07-27 17:23:14567 cpp_distcheck |
xyzzyz7cf8148f2016-04-20 23:50:23568 csharp |
xyzzyz7cf8148f2016-04-20 23:50:23569 java_jdk7 |
570 java_oracle7 |
Andres Medinaf348ad32020-11-18 16:55:36571 java_linkage_monitor |
xyzzyz7cf8148f2016-04-20 23:50:23572 objectivec_ios |
Tom Andersonac47edd2017-07-27 17:23:14573 objectivec_ios_debug |
574 objectivec_ios_release |
xyzzyz7cf8148f2016-04-20 23:50:23575 objectivec_osx |
Mohamed Heikale10d9892019-08-20 18:56:20576 objectivec_tvos |
577 objectivec_tvos_debug |
578 objectivec_tvos_release |
Tom Andersonac47edd2017-07-27 17:23:14579 objectivec_cocoapods_integration |
xyzzyz7cf8148f2016-04-20 23:50:23580 python |
581 python_cpp |
Tom Andersonac47edd2017-07-27 17:23:14582 python_compatibility |
Mohamed Heikale10d9892019-08-20 18:56:20583 ruby23 |
584 ruby24 |
585 ruby25 |
586 ruby26 |
Andres Medinaf348ad32020-11-18 16:55:36587 ruby27 |
Tommy Nyquist29527fb2022-06-29 19:29:44588 ruby30 |
589 ruby31 |
590 jruby92 |
591 jruby93 |
Tom Andersonac47edd2017-07-27 17:23:14592 ruby_all |
Mohamed Heikale10d9892019-08-20 18:56:20593 php_all |
Tommy Nyquist29527fb2022-06-29 19:29:44594 php_all_32 |
595 php7.0_mac |
596 php7.3_mac |
Mohamed Heikale10d9892019-08-20 18:56:20597 dist_install |
598 benchmark)
xyzzyz7cf8148f2016-04-20 23:50:23599"
600 exit 1
601fi
602
603set -e # exit immediately on error
604set -x # display all commands
Mohamed Heikale10d9892019-08-20 18:56:20605cd $(dirname $0)
xyzzyz7cf8148f2016-04-20 23:50:23606eval "build_$1"