Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 2 | # |
Feng Xiao | 9de4e64 | 2018-07-13 16:55:32 -0700 | [diff] [blame] | 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. |
Josh Haberman | 0f8c25d | 2016-02-19 09:11:38 -0800 | [diff] [blame] | 6 | |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 7 | # For when some other test needs the C++ main build, including protoc and |
| 8 | # libprotobuf. |
Jie Luo | d1eeb85 | 2019-07-31 17:49:26 -0700 | [diff] [blame] | 9 | LAST_RELEASED=3.9.0 |
| 10 | |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 11 | internal_build_cpp() { |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 12 | if [ -f src/protoc ]; then |
| 13 | # Already built. |
| 14 | return |
| 15 | fi |
| 16 | |
Carlos O'Ryan | 3c5442a | 2018-03-26 16:54:32 -0400 | [diff] [blame] | 17 | # Initialize any submodules. |
| 18 | git submodule update --init --recursive |
| 19 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 20 | ./autogen.sh |
Ben Wolsieffer | 56b40a8 | 2018-10-04 20:25:10 -0400 | [diff] [blame] | 21 | ./configure CXXFLAGS="-fPIC -std=c++11" # -fPIC is needed for python cpp test. |
| 22 | # See python/setup.py for more details |
Joshua Haberman | f5e8ee4 | 2019-03-06 12:04:17 -0800 | [diff] [blame] | 23 | make -j$(nproc) |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | build_cpp() { |
| 27 | internal_build_cpp |
Joshua Haberman | f5e8ee4 | 2019-03-06 12:04:17 -0800 | [diff] [blame] | 28 | make check -j$(nproc) || (cat src/test-suite.log; false) |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 29 | cd conformance && make test_cpp && cd .. |
Josh Haberman | cb36bde | 2016-04-29 09:52:20 -0700 | [diff] [blame] | 30 | |
Thomas Van Lenten | bc9d077 | 2016-12-08 16:19:58 -0500 | [diff] [blame] | 31 | # The benchmark code depends on cmake, so test if it is installed before |
| 32 | # trying to do the build. |
Thomas Van Lenten | bc9d077 | 2016-12-08 16:19:58 -0500 | [diff] [blame] | 33 | if [[ $(type cmake 2>/dev/null) ]]; then |
| 34 | # Verify benchmarking code can build successfully. |
Yilun Chong | 34843ed | 2017-12-13 14:34:52 -0800 | [diff] [blame] | 35 | cd benchmarks && make cpp-benchmark && cd .. |
Thomas Van Lenten | bc9d077 | 2016-12-08 16:19:58 -0500 | [diff] [blame] | 36 | else |
| 37 | echo "" |
| 38 | echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed." |
| 39 | echo "" |
| 40 | fi |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 41 | } |
| 42 | |
Hao Nguyen | 4f8a635 | 2019-01-23 10:02:51 -0800 | [diff] [blame] | 43 | build_cpp_tcmalloc() { |
| 44 | internal_build_cpp |
| 45 | ./configure LIBS=-ltcmalloc && make clean && make \ |
| 46 | PTHREAD_CFLAGS='-pthread -DGOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN' \ |
| 47 | check |
| 48 | cd src |
Adam Cozzette | d135f07 | 2019-01-25 10:28:52 -0800 | [diff] [blame] | 49 | PPROF_PATH=/usr/bin/google-pprof HEAPCHECK=strict ./protobuf-test |
Hao Nguyen | 4f8a635 | 2019-01-23 10:02:51 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 52 | build_cpp_distcheck() { |
Adam Cozzette | 45aba80 | 2019-03-11 14:39:49 -0700 | [diff] [blame] | 53 | grep -q -- "-Og" src/Makefile.am && |
| 54 | echo "The -Og flag is incompatible with Clang versions older than 4.0." && |
| 55 | exit 1 |
| 56 | |
Carlos O'Ryan | 3c5442a | 2018-03-26 16:54:32 -0400 | [diff] [blame] | 57 | # Initialize any submodules. |
| 58 | git submodule update --init --recursive |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 59 | ./autogen.sh |
| 60 | ./configure |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 61 | make dist |
| 62 | |
| 63 | # List all files that should be included in the distribution package. |
Jisi Liu | 55fdbe5 | 2017-08-23 11:35:48 -0700 | [diff] [blame] | 64 | git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\ |
Jie Luo | ea51149 | 2017-01-23 15:11:00 -0800 | [diff] [blame] | 65 | grep -v ".gitignore" | grep -v "java/compatibility_tests" |\ |
Jie Luo | 7288689 | 2017-02-09 16:49:52 -0800 | [diff] [blame] | 66 | grep -v "python/compatibility_tests" | grep -v "csharp/compatibility_tests" > dist.lst |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 67 | # Unzip the dist tar file. |
| 68 | DIST=`ls *.tar.gz` |
| 69 | tar -xf $DIST |
| 70 | cd ${DIST//.tar.gz} |
| 71 | # Check if every file exists in the dist tar file. |
| 72 | FILES_MISSING="" |
| 73 | for FILE in $(<../dist.lst); do |
Feng Xiao | acd5b05 | 2018-08-09 21:21:01 -0700 | [diff] [blame] | 74 | [ -f "$FILE" ] || { |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 75 | echo "$FILE is not found!" |
| 76 | FILES_MISSING="$FILE $FILES_MISSING" |
Feng Xiao | acd5b05 | 2018-08-09 21:21:01 -0700 | [diff] [blame] | 77 | } |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 78 | done |
| 79 | cd .. |
| 80 | if [ ! -z "$FILES_MISSING" ]; then |
| 81 | echo "Missing files in EXTRA_DIST: $FILES_MISSING" |
| 82 | exit 1 |
| 83 | fi |
| 84 | |
| 85 | # Do the regular dist-check for C++. |
Joshua Haberman | f5e8ee4 | 2019-03-06 12:04:17 -0800 | [diff] [blame] | 86 | make distcheck -j$(nproc) |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 87 | } |
| 88 | |
Hao Nguyen | f85c823 | 2019-03-07 14:34:28 -0800 | [diff] [blame] | 89 | build_dist_install() { |
| 90 | # Initialize any submodules. |
| 91 | git submodule update --init --recursive |
| 92 | ./autogen.sh |
| 93 | ./configure |
| 94 | make dist |
| 95 | |
| 96 | # Unzip the dist tar file and install it. |
| 97 | DIST=`ls *.tar.gz` |
| 98 | tar -xf $DIST |
| 99 | pushd ${DIST//.tar.gz} |
| 100 | ./configure && make check -j4 && make install |
| 101 | |
| 102 | export LD_LIBRARY_PATH=/usr/local/lib |
| 103 | |
| 104 | # Try to install Java |
| 105 | pushd java |
| 106 | use_java jdk7 |
| 107 | $MVN install |
| 108 | popd |
| 109 | |
| 110 | # Try to install Python |
| 111 | virtualenv --no-site-packages venv |
| 112 | source venv/bin/activate |
| 113 | pushd python |
| 114 | python setup.py clean build sdist |
| 115 | pip install dist/protobuf-*.tar.gz |
| 116 | popd |
| 117 | deactivate |
| 118 | rm -rf python/venv |
| 119 | } |
| 120 | |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 121 | build_csharp() { |
Jon Skeet | 9a9a66e | 2017-10-25 08:03:50 +0100 | [diff] [blame] | 122 | # Required for conformance tests and to regenerate protos. |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 123 | internal_build_cpp |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 124 | NUGET=/usr/local/bin/nuget.exe |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 125 | |
Jan Tattermusch | 67fee07 | 2019-03-12 04:48:10 -0400 | [diff] [blame] | 126 | # Disable some unwanted dotnet options |
| 127 | export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true |
| 128 | export DOTNET_CLI_TELEMETRY_OPTOUT=true |
| 129 | |
| 130 | # TODO(jtattermusch): is this still needed with "first time experience" |
| 131 | # disabled? |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 132 | # Perform "dotnet new" once to get the setup preprocessing out of the |
| 133 | # way. That spews a lot of output (including backspaces) into logs |
| 134 | # otherwise, and can cause problems. It doesn't matter if this step |
| 135 | # is performed multiple times; it's cheap after the first time anyway. |
Jon Skeet | f26e8c2 | 2017-05-04 08:51:46 +0100 | [diff] [blame] | 136 | # (It also doesn't matter if it's unnecessary, which it will be on some |
| 137 | # systems. It's necessary on Jenkins in order to avoid unprintable |
| 138 | # characters appearing in the JUnit output.) |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 139 | mkdir dotnettmp |
| 140 | (cd dotnettmp; dotnet new > /dev/null) |
| 141 | rm -rf dotnettmp |
| 142 | |
Jon Skeet | 9a9a66e | 2017-10-25 08:03:50 +0100 | [diff] [blame] | 143 | # Check that the protos haven't broken C# codegen. |
| 144 | # TODO(jonskeet): Fail if regenerating creates any changes. |
| 145 | csharp/generate_protos.sh |
Brent Shaffer | 6737954 | 2018-05-23 16:43:30 -0700 | [diff] [blame] | 146 | |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 147 | csharp/buildall.sh |
Josh Haberman | e891c29 | 2015-12-30 16:03:49 -0800 | [diff] [blame] | 148 | cd conformance && make test_csharp && cd .. |
Jie Luo | 7288689 | 2017-02-09 16:49:52 -0800 | [diff] [blame] | 149 | |
| 150 | # Run csharp compatibility test between 3.0.0 and the current version. |
| 151 | csharp/compatibility_tests/v3.0.0/test.sh 3.0.0 |
Jie Luo | e399308 | 2019-07-25 14:31:00 -0700 | [diff] [blame] | 152 | |
Jie Luo | e399308 | 2019-07-25 14:31:00 -0700 | [diff] [blame] | 153 | # Run csharp compatibility test between last released and the current version. |
| 154 | csharp/compatibility_tests/v3.0.0/test.sh $LAST_RELEASED |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 157 | build_golang() { |
| 158 | # Go build needs `protoc`. |
| 159 | internal_build_cpp |
| 160 | # Add protoc to the path so that the examples build finds it. |
| 161 | export PATH="`pwd`/src:$PATH" |
| 162 | |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 163 | export GOPATH="$HOME/gocode" |
Feng Xiao | a0a17e2 | 2018-08-23 15:35:52 -0700 | [diff] [blame] | 164 | mkdir -p "$GOPATH/src/github.com/protocolbuffers" |
Feng Xiao | afe98de | 2018-08-22 11:55:30 -0700 | [diff] [blame] | 165 | rm -f "$GOPATH/src/github.com/protocolbuffers/protobuf" |
| 166 | ln -s "`pwd`" "$GOPATH/src/github.com/protocolbuffers/protobuf" |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 167 | export PATH="$GOPATH/bin:$PATH" |
| 168 | go get github.com/golang/protobuf/protoc-gen-go |
| 169 | |
Feng Xiao | 8136ccb | 2017-09-12 12:00:20 -0700 | [diff] [blame] | 170 | cd examples && PROTO_PATH="-I../src -I." make gotest && cd .. |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 171 | } |
| 172 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 173 | use_java() { |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 174 | version=$1 |
| 175 | case "$version" in |
Tomo Suzuki | 7051725 | 2019-06-26 15:28:49 -0400 | [diff] [blame] | 176 | jdk8) |
| 177 | export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH |
| 178 | export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 |
| 179 | ;; |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 180 | jdk7) |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 181 | export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame] | 182 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 183 | ;; |
| 184 | oracle7) |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 185 | export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame] | 186 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 187 | ;; |
| 188 | esac |
| 189 | |
Feng Xiao | 9de4e64 | 2018-07-13 16:55:32 -0700 | [diff] [blame] | 190 | MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository |
Yilun Chong | 2b7ee38 | 2018-09-23 17:07:02 -0700 | [diff] [blame] | 191 | MVN="$MVN -e -X -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" |
Josh Haberman | 1ee0fda | 2016-03-03 16:02:55 -0800 | [diff] [blame] | 192 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 193 | which java |
| 194 | java -version |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame] | 195 | $MVN -version |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 198 | # --batch-mode supresses download progress output that spams the logs. |
Josh Haberman | b28b3f6 | 2016-02-20 12:17:10 -0800 | [diff] [blame] | 199 | MVN="mvn --batch-mode" |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 200 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 201 | build_java() { |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 202 | version=$1 |
| 203 | dir=java_$version |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 204 | # Java build needs `protoc`. |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 205 | internal_build_cpp |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 206 | cp -r java $dir |
| 207 | cd $dir && $MVN clean && $MVN test |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 208 | cd ../.. |
| 209 | } |
| 210 | |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 211 | # The conformance tests are hard-coded to work with the $ROOT/java directory. |
| 212 | # So this can't run in parallel with two different sets of tests. |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 213 | build_java_with_conformance_tests() { |
| 214 | # Java build needs `protoc`. |
| 215 | internal_build_cpp |
Tomo Suzuki | ca25bad | 2019-10-22 13:42:35 -0400 | [diff] [blame^] | 216 | # This local installation avoids the problem caused by a new version not yet in Maven Central |
| 217 | cd java/bom && $MVN install |
| 218 | cd ../.. |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 219 | cd java && $MVN test && $MVN install |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 220 | cd util && $MVN package assembly:single |
Feng Xiao | af81dcf | 2015-12-21 03:25:59 -0800 | [diff] [blame] | 221 | cd ../.. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 222 | cd conformance && make test_java && cd .. |
| 223 | } |
| 224 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 225 | build_java_jdk7() { |
| 226 | use_java jdk7 |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 227 | build_java_with_conformance_tests |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 228 | } |
| 229 | build_java_oracle7() { |
| 230 | use_java oracle7 |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 231 | build_java oracle7 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 232 | } |
Feng Xiao | baa4023 | 2016-07-29 14:11:21 -0700 | [diff] [blame] | 233 | build_java_compatibility() { |
| 234 | use_java jdk7 |
| 235 | internal_build_cpp |
| 236 | # Use the unit-tests extraced from 2.5.0 to test the compatibilty between |
| 237 | # 3.0.0-beta-4 and the current version. |
| 238 | cd java/compatibility_tests/v2.5.0 |
| 239 | ./test.sh 3.0.0-beta-4 |
Jie Luo | d1eeb85 | 2019-07-31 17:49:26 -0700 | [diff] [blame] | 240 | |
| 241 | # Test the last released and current version. |
| 242 | ./test.sh $LAST_RELEASED |
Feng Xiao | baa4023 | 2016-07-29 14:11:21 -0700 | [diff] [blame] | 243 | } |
Tomo Suzuki | 7051725 | 2019-06-26 15:28:49 -0400 | [diff] [blame] | 244 | build_java_linkage_monitor() { |
Tomo Suzuki | bedef1e | 2019-07-01 17:03:04 -0400 | [diff] [blame] | 245 | # Linkage Monitor checks compatibility with other Google libraries |
| 246 | # https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor |
| 247 | |
Tomo Suzuki | 7051725 | 2019-06-26 15:28:49 -0400 | [diff] [blame] | 248 | use_java jdk8 |
Tomo Suzuki | bedef1e | 2019-07-01 17:03:04 -0400 | [diff] [blame] | 249 | internal_build_cpp |
| 250 | |
| 251 | # Linkage Monitor uses $HOME/.m2 local repository |
| 252 | MVN="mvn -e -B -Dhttps.protocols=TLSv1.2" |
| 253 | cd java |
| 254 | # Sets java artifact version with SNAPSHOT, as Linkage Monitor looks for SNAPSHOT versions. |
| 255 | # Example: "3.9.0" (without 'rc') |
| 256 | VERSION=`grep '<version>' pom.xml |head -1 |perl -nle 'print $1 if m/<version>(\d+\.\d+.\d+)/'` |
| 257 | cd bom |
Tomo Suzuki | f460c17 | 2019-09-06 09:53:44 -0400 | [diff] [blame] | 258 | # This local installation avoids the problem caused by a new version not yet in Maven Central |
| 259 | # https://github.com/protocolbuffers/protobuf/issues/6627 |
Tomo Suzuki | c1a0465 | 2019-09-06 09:56:55 -0400 | [diff] [blame] | 260 | $MVN install |
Tomo Suzuki | bedef1e | 2019-07-01 17:03:04 -0400 | [diff] [blame] | 261 | $MVN versions:set -DnewVersion=${VERSION}-SNAPSHOT |
| 262 | cd .. |
| 263 | $MVN versions:set -DnewVersion=${VERSION}-SNAPSHOT |
| 264 | # Installs the snapshot version locally |
| 265 | $MVN install -Dmaven.test.skip=true |
| 266 | |
| 267 | # Linkage Monitor uses the snapshot versions installed in $HOME/.m2 to verify compatibility |
| 268 | JAR=linkage-monitor-latest-all-deps.jar |
| 269 | curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}" |
| 270 | # Fails if there's new linkage errors compared with baseline |
| 271 | java -jar $JAR com.google.cloud:libraries-bom |
Tomo Suzuki | 7051725 | 2019-06-26 15:28:49 -0400 | [diff] [blame] | 272 | } |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 273 | |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 274 | build_objectivec_ios() { |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 275 | # Reused the build script that takes care of configuring and ensuring things |
| 276 | # are up to date. The OS X test runs the objc conformance test, so skip it |
| 277 | # here. |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 278 | objectivec/DevTools/full_mac_build.sh \ |
Thomas Van Lenten | bd00671 | 2019-01-07 16:42:22 -0500 | [diff] [blame] | 279 | --core-only --skip-xcode-osx --skip-xcode-tvos --skip-objc-conformance "$@" |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | build_objectivec_ios_debug() { |
| 283 | build_objectivec_ios --skip-xcode-release |
| 284 | } |
| 285 | |
| 286 | build_objectivec_ios_release() { |
| 287 | build_objectivec_ios --skip-xcode-debug |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | build_objectivec_osx() { |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 291 | # Reused the build script that takes care of configuring and ensuring things |
| 292 | # are up to date. |
| 293 | objectivec/DevTools/full_mac_build.sh \ |
Thomas Van Lenten | bd00671 | 2019-01-07 16:42:22 -0500 | [diff] [blame] | 294 | --core-only --skip-xcode-ios --skip-xcode-tvos |
| 295 | } |
| 296 | |
| 297 | build_objectivec_tvos() { |
| 298 | # Reused the build script that takes care of configuring and ensuring things |
| 299 | # are up to date. The OS X test runs the objc conformance test, so skip it |
| 300 | # here. |
| 301 | objectivec/DevTools/full_mac_build.sh \ |
| 302 | --core-only --skip-xcode-ios --skip-xcode-osx --skip-objc-conformance "$@" |
| 303 | } |
| 304 | |
| 305 | build_objectivec_tvos_debug() { |
| 306 | build_objectivec_tvos --skip-xcode-release |
| 307 | } |
| 308 | |
| 309 | build_objectivec_tvos_release() { |
| 310 | build_objectivec_tvos --skip-xcode-debug |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 311 | } |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 312 | |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 313 | build_objectivec_cocoapods_integration() { |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 314 | # Update pod to the latest version. |
Yilun Chong | 89b914f | 2019-02-26 12:52:06 -0800 | [diff] [blame] | 315 | gem install cocoapods --no_document |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 316 | objectivec/Tests/CocoaPods/run_tests.sh |
| 317 | } |
| 318 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 319 | build_python() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 320 | internal_build_cpp |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 321 | cd python |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 322 | if [ $(uname -s) == "Linux" ]; then |
Jie Luo | 610e433 | 2017-08-22 16:23:21 -0700 | [diff] [blame] | 323 | envlist=py\{27,33,34,35,36\}-python |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 324 | else |
| 325 | envlist=py27-python |
| 326 | fi |
| 327 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 328 | cd .. |
| 329 | } |
| 330 | |
Paul Yang | 4dec4f9 | 2018-12-18 18:07:24 -0800 | [diff] [blame] | 331 | build_python_version() { |
| 332 | internal_build_cpp |
| 333 | cd python |
| 334 | envlist=$1 |
| 335 | tox -e $envlist |
| 336 | cd .. |
| 337 | } |
| 338 | |
| 339 | build_python27() { |
| 340 | build_python_version py27-python |
| 341 | } |
| 342 | |
| 343 | build_python33() { |
| 344 | build_python_version py33-python |
| 345 | } |
| 346 | |
| 347 | build_python34() { |
| 348 | build_python_version py34-python |
| 349 | } |
| 350 | |
| 351 | build_python35() { |
| 352 | build_python_version py35-python |
| 353 | } |
| 354 | |
| 355 | build_python36() { |
| 356 | build_python_version py36-python |
| 357 | } |
| 358 | |
| 359 | build_python37() { |
| 360 | build_python_version py37-python |
| 361 | } |
| 362 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 363 | build_python_cpp() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 364 | internal_build_cpp |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 365 | export LD_LIBRARY_PATH=../src/.libs # for Linux |
| 366 | export DYLD_LIBRARY_PATH=../src/.libs # for OS X |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 367 | cd python |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 368 | if [ $(uname -s) == "Linux" ]; then |
Jie Luo | 610e433 | 2017-08-22 16:23:21 -0700 | [diff] [blame] | 369 | envlist=py\{27,33,34,35,36\}-cpp |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 370 | else |
| 371 | envlist=py27-cpp |
| 372 | fi |
| 373 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 374 | cd .. |
| 375 | } |
| 376 | |
Paul Yang | 4dec4f9 | 2018-12-18 18:07:24 -0800 | [diff] [blame] | 377 | build_python_cpp_version() { |
| 378 | internal_build_cpp |
| 379 | export LD_LIBRARY_PATH=../src/.libs # for Linux |
| 380 | export DYLD_LIBRARY_PATH=../src/.libs # for OS X |
| 381 | cd python |
| 382 | envlist=$1 |
| 383 | tox -e $envlist |
| 384 | cd .. |
| 385 | } |
| 386 | |
| 387 | build_python27_cpp() { |
| 388 | build_python_cpp_version py27-cpp |
| 389 | } |
| 390 | |
| 391 | build_python33_cpp() { |
| 392 | build_python_cpp_version py33-cpp |
| 393 | } |
| 394 | |
| 395 | build_python34_cpp() { |
| 396 | build_python_cpp_version py34-cpp |
| 397 | } |
| 398 | |
| 399 | build_python35_cpp() { |
| 400 | build_python_cpp_version py35-cpp |
| 401 | } |
| 402 | |
| 403 | build_python36_cpp() { |
| 404 | build_python_cpp_version py36-cpp |
| 405 | } |
| 406 | |
| 407 | build_python37_cpp() { |
| 408 | build_python_cpp_version py37-cpp |
| 409 | } |
| 410 | |
Jie Luo | ea51149 | 2017-01-23 15:11:00 -0800 | [diff] [blame] | 411 | build_python_compatibility() { |
| 412 | internal_build_cpp |
| 413 | # Use the unit-tests extraced from 2.5.0 to test the compatibilty. |
| 414 | cd python/compatibility_tests/v2.5.0 |
| 415 | # Test between 2.5.0 and the current version. |
| 416 | ./test.sh 2.5.0 |
| 417 | # Test between 3.0.0-beta-1 and the current version. |
| 418 | ./test.sh 3.0.0-beta-1 |
Jie Luo | d1eeb85 | 2019-07-31 17:49:26 -0700 | [diff] [blame] | 419 | |
| 420 | # Test between last released and current version. |
| 421 | ./test.sh $LAST_RELEASED |
Jie Luo | ea51149 | 2017-01-23 15:11:00 -0800 | [diff] [blame] | 422 | } |
| 423 | |
Paul Yang | 78ba021 | 2018-07-02 15:11:36 -0700 | [diff] [blame] | 424 | build_ruby23() { |
| 425 | internal_build_cpp # For conformance tests. |
Paul Yang | 333b3ce | 2018-10-18 11:16:55 -0700 | [diff] [blame] | 426 | cd ruby && bash travis-test.sh ruby-2.3.8 && cd .. |
Paul Yang | 78ba021 | 2018-07-02 15:11:36 -0700 | [diff] [blame] | 427 | } |
| 428 | build_ruby24() { |
| 429 | internal_build_cpp # For conformance tests. |
| 430 | cd ruby && bash travis-test.sh ruby-2.4 && cd .. |
| 431 | } |
| 432 | build_ruby25() { |
| 433 | internal_build_cpp # For conformance tests. |
Paul Yang | 333b3ce | 2018-10-18 11:16:55 -0700 | [diff] [blame] | 434 | cd ruby && bash travis-test.sh ruby-2.5.1 && cd .. |
Paul Yang | 78ba021 | 2018-07-02 15:11:36 -0700 | [diff] [blame] | 435 | } |
Paul Yang | de9e1a0 | 2019-01-03 14:25:50 -0800 | [diff] [blame] | 436 | build_ruby26() { |
| 437 | internal_build_cpp # For conformance tests. |
| 438 | cd ruby && bash travis-test.sh ruby-2.6.0 && cd .. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 439 | } |
| 440 | |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 441 | build_javascript() { |
| 442 | internal_build_cpp |
Josh Haberman | 0d2d8bc | 2015-12-28 06:43:42 -0800 | [diff] [blame] | 443 | cd js && npm install && npm test && cd .. |
Josh Haberman | f873d32 | 2016-06-08 12:38:15 -0700 | [diff] [blame] | 444 | cd conformance && make test_nodejs && cd .. |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 445 | } |
| 446 | |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 447 | generate_php_test_proto() { |
| 448 | internal_build_cpp |
| 449 | pushd php/tests |
| 450 | # Generate test file |
| 451 | rm -rf generated |
| 452 | mkdir generated |
Bo Yang | f46a01d | 2017-09-12 15:04:34 -0700 | [diff] [blame] | 453 | ../../src/protoc --php_out=generated \ |
michaelbausor | 6a51c03 | 2018-10-07 16:56:41 -0700 | [diff] [blame] | 454 | -I../../src -I. \ |
Brent Shaffer | 6737954 | 2018-05-23 16:43:30 -0700 | [diff] [blame] | 455 | proto/empty/echo.proto \ |
Bo Yang | f46a01d | 2017-09-12 15:04:34 -0700 | [diff] [blame] | 456 | proto/test.proto \ |
| 457 | proto/test_include.proto \ |
| 458 | proto/test_no_namespace.proto \ |
| 459 | proto/test_prefix.proto \ |
| 460 | proto/test_php_namespace.proto \ |
| 461 | proto/test_empty_php_namespace.proto \ |
| 462 | proto/test_reserved_enum_lower.proto \ |
| 463 | proto/test_reserved_enum_upper.proto \ |
| 464 | proto/test_reserved_enum_value_lower.proto \ |
| 465 | proto/test_reserved_enum_value_upper.proto \ |
| 466 | proto/test_reserved_message_lower.proto \ |
| 467 | proto/test_reserved_message_upper.proto \ |
| 468 | proto/test_service.proto \ |
| 469 | proto/test_service_namespace.proto \ |
michaelbausor | 6a51c03 | 2018-10-07 16:56:41 -0700 | [diff] [blame] | 470 | proto/test_wrapper_type_setters.proto \ |
Paul Yang | c15a326 | 2017-08-02 07:42:27 -0700 | [diff] [blame] | 471 | proto/test_descriptors.proto |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 472 | pushd ../../src |
Paul Yang | bcda919 | 2017-11-03 12:30:09 -0700 | [diff] [blame] | 473 | ./protoc --php_out=../php/tests/generated -I../php/tests -I. \ |
| 474 | ../php/tests/proto/test_import_descriptor_proto.proto |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 475 | popd |
| 476 | popd |
| 477 | } |
| 478 | |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 479 | use_php() { |
| 480 | VERSION=$1 |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 481 | export PATH=/usr/local/php-${VERSION}/bin:$PATH |
| 482 | export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$CPLUS_INCLUDE_PATH |
| 483 | export C_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$C_INCLUDE_PATH |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 484 | generate_php_test_proto |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 485 | } |
| 486 | |
Bo Yang | c96dd66 | 2016-10-04 17:32:08 +0000 | [diff] [blame] | 487 | use_php_zts() { |
| 488 | VERSION=$1 |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 489 | export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH |
| 490 | export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}-zts/include/php/main:/usr/local/php-${VERSION}-zts/include/php/:$CPLUS_INCLUDE_PATH |
| 491 | export C_INCLUDE_PATH=/usr/local/php-${VERSION}-zts/include/php/main:/usr/local/php-${VERSION}-zts/include/php/:$C_INCLUDE_PATH |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 492 | generate_php_test_proto |
Bo Yang | c96dd66 | 2016-10-04 17:32:08 +0000 | [diff] [blame] | 493 | } |
| 494 | |
Paul Yang | 51c5ff8 | 2016-10-25 17:27:05 -0700 | [diff] [blame] | 495 | use_php_bc() { |
| 496 | VERSION=$1 |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 497 | export PATH=/usr/local/php-${VERSION}-bc/bin:$PATH |
| 498 | export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}-bc/include/php/main:/usr/local/php-${VERSION}-bc/include/php/:$CPLUS_INCLUDE_PATH |
| 499 | export C_INCLUDE_PATH=/usr/local/php-${VERSION}-bc/include/php/main:/usr/local/php-${VERSION}-bc/include/php/:$C_INCLUDE_PATH |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 500 | generate_php_test_proto |
Paul Yang | 51c5ff8 | 2016-10-25 17:27:05 -0700 | [diff] [blame] | 501 | } |
| 502 | |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 503 | build_php5.5() { |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 504 | use_php 5.5 |
Paul Yang | dd8d5f5 | 2017-03-08 14:31:34 -0800 | [diff] [blame] | 505 | |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 506 | pushd php |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 507 | rm -rf vendor |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 508 | composer update |
| 509 | ./vendor/bin/phpunit |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 510 | popd |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 511 | pushd conformance |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 512 | make test_php |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 513 | popd |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 514 | } |
| 515 | |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 516 | build_php5.5_c() { |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 517 | use_php 5.5 |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 518 | pushd php/tests |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 519 | /bin/bash ./test.sh 5.5 |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 520 | popd |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 521 | # TODO(teboring): Add it back |
| 522 | # pushd conformance |
| 523 | # make test_php_c |
| 524 | # popd |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 525 | } |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 526 | |
David Supplee | 93533f7 | 2019-03-12 21:30:06 -0700 | [diff] [blame] | 527 | build_php5.5_mixed() { |
| 528 | use_php 5.5 |
| 529 | pushd php |
| 530 | rm -rf vendor |
| 531 | composer update |
| 532 | /bin/bash ./tests/compile_extension.sh ./ext/google/protobuf |
| 533 | php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit |
| 534 | popd |
| 535 | } |
| 536 | |
Bo Yang | c96dd66 | 2016-10-04 17:32:08 +0000 | [diff] [blame] | 537 | build_php5.5_zts_c() { |
| 538 | use_php_zts 5.5 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 539 | cd php/tests && /bin/bash ./test.sh 5.5-zts && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 540 | # TODO(teboring): Add it back |
| 541 | # pushd conformance |
| 542 | # make test_php_zts_c |
| 543 | # popd |
Paul Yang | df83907 | 2016-11-10 11:20:50 -0800 | [diff] [blame] | 544 | } |
| 545 | |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 546 | build_php5.6() { |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 547 | use_php 5.6 |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 548 | pushd php |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 549 | rm -rf vendor |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 550 | composer update |
| 551 | ./vendor/bin/phpunit |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 552 | popd |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 553 | pushd conformance |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 554 | make test_php |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 555 | popd |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 556 | } |
| 557 | |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 558 | build_php5.6_c() { |
| 559 | use_php 5.6 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 560 | cd php/tests && /bin/bash ./test.sh 5.6 && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 561 | # TODO(teboring): Add it back |
| 562 | # pushd conformance |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 563 | # make test_php_c |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 564 | # popd |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 565 | } |
| 566 | |
David Supplee | 93533f7 | 2019-03-12 21:30:06 -0700 | [diff] [blame] | 567 | build_php5.6_mixed() { |
| 568 | use_php 5.6 |
| 569 | pushd php |
| 570 | rm -rf vendor |
| 571 | composer update |
| 572 | /bin/bash ./tests/compile_extension.sh ./ext/google/protobuf |
| 573 | php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit |
| 574 | popd |
| 575 | } |
| 576 | |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 577 | build_php5.6_zts_c() { |
| 578 | use_php_zts 5.6 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 579 | cd php/tests && /bin/bash ./test.sh 5.6-zts && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 580 | # TODO(teboring): Add it back |
| 581 | # pushd conformance |
| 582 | # make test_php_zts_c |
| 583 | # popd |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 584 | } |
| 585 | |
Bo Yang | 63448e6 | 2016-10-05 18:28:13 -0700 | [diff] [blame] | 586 | build_php5.6_mac() { |
Paul Yang | 46ae90d | 2016-12-08 11:16:49 -0800 | [diff] [blame] | 587 | generate_php_test_proto |
Bo Yang | 63448e6 | 2016-10-05 18:28:13 -0700 | [diff] [blame] | 588 | # Install PHP |
| 589 | curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6 |
Paul Yang | 1f2dbc8 | 2016-11-08 11:38:34 -0800 | [diff] [blame] | 590 | PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"` # The folder name may change upon time |
| 591 | export PATH="$PHP_FOLDER/bin:$PATH" |
Bo Yang | 63448e6 | 2016-10-05 18:28:13 -0700 | [diff] [blame] | 592 | |
| 593 | # Install phpunit |
Bo Yang | 8400e29 | 2019-01-28 20:58:58 +0000 | [diff] [blame] | 594 | curl https://phar.phpunit.de/phpunit-5.6.8.phar -L -o phpunit.phar |
Bo Yang | 63448e6 | 2016-10-05 18:28:13 -0700 | [diff] [blame] | 595 | chmod +x phpunit.phar |
| 596 | sudo mv phpunit.phar /usr/local/bin/phpunit |
| 597 | |
| 598 | # Install valgrind |
| 599 | echo "#! /bin/bash" > valgrind |
| 600 | chmod ug+x valgrind |
| 601 | sudo mv valgrind /usr/local/bin/valgrind |
| 602 | |
| 603 | # Test |
| 604 | cd php/tests && /bin/bash ./test.sh && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 605 | # TODO(teboring): Add it back |
| 606 | # pushd conformance |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 607 | # make test_php_c |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 608 | # popd |
Bo Yang | 63448e6 | 2016-10-05 18:28:13 -0700 | [diff] [blame] | 609 | } |
| 610 | |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 611 | build_php7.0() { |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 612 | use_php 7.0 |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 613 | pushd php |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 614 | rm -rf vendor |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 615 | composer update |
| 616 | ./vendor/bin/phpunit |
Paul Yang | e3e38b8 | 2016-12-08 14:39:20 -0800 | [diff] [blame] | 617 | popd |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 618 | pushd conformance |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 619 | make test_php |
Paul Yang | 3975664 | 2017-02-01 12:47:58 -0800 | [diff] [blame] | 620 | popd |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 621 | } |
| 622 | |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 623 | build_php7.0_c() { |
| 624 | use_php 7.0 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 625 | cd php/tests && /bin/bash ./test.sh 7.0 && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 626 | # TODO(teboring): Add it back |
| 627 | # pushd conformance |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 628 | # make test_php_c |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 629 | # popd |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 630 | } |
| 631 | |
David Supplee | 93533f7 | 2019-03-12 21:30:06 -0700 | [diff] [blame] | 632 | build_php7.0_mixed() { |
| 633 | use_php 7.0 |
| 634 | pushd php |
| 635 | rm -rf vendor |
| 636 | composer update |
| 637 | /bin/bash ./tests/compile_extension.sh ./ext/google/protobuf |
| 638 | php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit |
| 639 | popd |
| 640 | } |
| 641 | |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 642 | build_php7.0_zts_c() { |
| 643 | use_php_zts 7.0 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 644 | cd php/tests && /bin/bash ./test.sh 7.0-zts && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 645 | # TODO(teboring): Add it back. |
| 646 | # pushd conformance |
| 647 | # make test_php_zts_c |
| 648 | # popd |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 649 | } |
| 650 | |
| 651 | build_php7.0_mac() { |
| 652 | generate_php_test_proto |
| 653 | # Install PHP |
| 654 | curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0 |
| 655 | PHP_FOLDER=`find /usr/local -type d -name "php7-7.0*"` # The folder name may change upon time |
| 656 | export PATH="$PHP_FOLDER/bin:$PATH" |
| 657 | |
| 658 | # Install phpunit |
| 659 | curl https://phar.phpunit.de/phpunit-5.6.0.phar -L -o phpunit.phar |
| 660 | chmod +x phpunit.phar |
| 661 | sudo mv phpunit.phar /usr/local/bin/phpunit |
| 662 | |
| 663 | # Install valgrind |
| 664 | echo "#! /bin/bash" > valgrind |
| 665 | chmod ug+x valgrind |
| 666 | sudo mv valgrind /usr/local/bin/valgrind |
| 667 | |
| 668 | # Test |
| 669 | cd php/tests && /bin/bash ./test.sh && cd ../.. |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 670 | # TODO(teboring): Add it back |
| 671 | # pushd conformance |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 672 | # make test_php_c |
Paul Yang | ecca6ea | 2017-06-30 12:14:09 -0700 | [diff] [blame] | 673 | # popd |
Bo Yang | 34cdaf4 | 2016-10-03 21:59:58 +0000 | [diff] [blame] | 674 | } |
| 675 | |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 676 | build_php_compatibility() { |
| 677 | internal_build_cpp |
Jie Luo | d1eeb85 | 2019-07-31 17:49:26 -0700 | [diff] [blame] | 678 | php/tests/compatibility_test.sh $LAST_RELEASED |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 679 | } |
| 680 | |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 681 | build_php7.1() { |
| 682 | use_php 7.1 |
| 683 | pushd php |
| 684 | rm -rf vendor |
Paul Yang | d7c4409 | 2018-12-18 10:57:03 -0800 | [diff] [blame] | 685 | composer update |
| 686 | ./vendor/bin/phpunit |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 687 | popd |
| 688 | pushd conformance |
Paul Yang | bdcbcab | 2018-07-26 13:52:22 -0700 | [diff] [blame] | 689 | make test_php |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 690 | popd |
| 691 | } |
| 692 | |
| 693 | build_php7.1_c() { |
Paul Yang | bdcbcab | 2018-07-26 13:52:22 -0700 | [diff] [blame] | 694 | ENABLE_CONFORMANCE_TEST=$1 |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 695 | use_php 7.1 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 696 | cd php/tests && /bin/bash ./test.sh 7.1 && cd ../.. |
Paul Yang | bdcbcab | 2018-07-26 13:52:22 -0700 | [diff] [blame] | 697 | if [ "$ENABLE_CONFORMANCE_TEST" = "true" ] |
| 698 | then |
| 699 | pushd conformance |
| 700 | make test_php_c |
| 701 | popd |
| 702 | fi |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 703 | } |
| 704 | |
David Supplee | 93533f7 | 2019-03-12 21:30:06 -0700 | [diff] [blame] | 705 | build_php7.1_mixed() { |
| 706 | use_php 7.1 |
| 707 | pushd php |
| 708 | rm -rf vendor |
| 709 | composer update |
| 710 | /bin/bash ./tests/compile_extension.sh ./ext/google/protobuf |
| 711 | php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit |
| 712 | popd |
| 713 | } |
| 714 | |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 715 | build_php7.1_zts_c() { |
| 716 | use_php_zts 7.1 |
Paul Yang | 51293f3 | 2018-01-25 11:31:05 -0800 | [diff] [blame] | 717 | cd php/tests && /bin/bash ./test.sh 7.1-zts && cd ../.. |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 718 | pushd conformance |
| 719 | # make test_php_c |
| 720 | popd |
| 721 | } |
| 722 | |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 723 | build_php_all_32() { |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 724 | build_php5.5 |
| 725 | build_php5.6 |
| 726 | build_php7.0 |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 727 | build_php7.1 |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 728 | build_php5.5_c |
| 729 | build_php5.6_c |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 730 | build_php7.0_c |
Paul Yang | bdcbcab | 2018-07-26 13:52:22 -0700 | [diff] [blame] | 731 | build_php7.1_c $1 |
David Supplee | 93533f7 | 2019-03-12 21:30:06 -0700 | [diff] [blame] | 732 | build_php5.5_mixed |
| 733 | build_php5.6_mixed |
| 734 | build_php7.0_mixed |
| 735 | build_php7.1_mixed |
Bo Yang | c96dd66 | 2016-10-04 17:32:08 +0000 | [diff] [blame] | 736 | build_php5.5_zts_c |
Paul Yang | 190b527 | 2017-04-19 16:23:51 -0700 | [diff] [blame] | 737 | build_php5.6_zts_c |
| 738 | build_php7.0_zts_c |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 739 | build_php7.1_zts_c |
Paul Yang | 51c5ff8 | 2016-10-25 17:27:05 -0700 | [diff] [blame] | 740 | } |
| 741 | |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 742 | build_php_all() { |
Paul Yang | bdcbcab | 2018-07-26 13:52:22 -0700 | [diff] [blame] | 743 | build_php_all_32 true |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 744 | build_php_compatibility |
| 745 | } |
| 746 | |
Yilun Chong | 6adc3d7 | 2018-12-18 16:20:23 -0800 | [diff] [blame] | 747 | build_benchmark() { |
Yilun Chong | 152c830 | 2018-12-20 17:15:51 -0800 | [diff] [blame] | 748 | use_php 7.2 |
Yilun Chong | 6adc3d7 | 2018-12-18 16:20:23 -0800 | [diff] [blame] | 749 | cd kokoro/linux/benchmark && ./run.sh |
| 750 | } |
| 751 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 752 | # -------- main -------- |
| 753 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 754 | if [ "$#" -ne 1 ]; then |
| 755 | echo " |
| 756 | Usage: $0 { cpp | |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 757 | cpp_distcheck | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 758 | csharp | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 759 | java_jdk7 | |
| 760 | java_oracle7 | |
Feng Xiao | baa4023 | 2016-07-29 14:11:21 -0700 | [diff] [blame] | 761 | java_compatibility | |
Tomo Suzuki | 7051725 | 2019-06-26 15:28:49 -0400 | [diff] [blame] | 762 | java_linkage_monitor | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 763 | objectivec_ios | |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 764 | objectivec_ios_debug | |
| 765 | objectivec_ios_release | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 766 | objectivec_osx | |
Thomas Van Lenten | bd00671 | 2019-01-07 16:42:22 -0500 | [diff] [blame] | 767 | objectivec_tvos | |
| 768 | objectivec_tvos_debug | |
| 769 | objectivec_tvos_release | |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 770 | objectivec_cocoapods_integration | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 771 | python | |
| 772 | python_cpp | |
Jie Luo | ea51149 | 2017-01-23 15:11:00 -0800 | [diff] [blame] | 773 | python_compatibility | |
Paul Yang | 39df66e | 2018-10-12 12:36:33 -0700 | [diff] [blame] | 774 | ruby23 | |
| 775 | ruby24 | |
| 776 | ruby25 | |
Paul Yang | de9e1a0 | 2019-01-03 14:25:50 -0800 | [diff] [blame] | 777 | ruby26 | |
Feng Xiao | 20fbb35 | 2016-07-21 18:04:56 -0700 | [diff] [blame] | 778 | jruby | |
Bo Yang | fd332d1 | 2016-09-30 00:07:47 +0000 | [diff] [blame] | 779 | ruby_all | |
| 780 | php5.5 | |
| 781 | php5.5_c | |
| 782 | php5.6 | |
| 783 | php5.6_c | |
| 784 | php7.0 | |
Bo Yang | c8bd36e | 2016-09-30 19:07:33 +0000 | [diff] [blame] | 785 | php7.0_c | |
Paul Yang | 25abd7b | 2017-05-05 11:14:11 -0700 | [diff] [blame] | 786 | php_compatibility | |
Paul Yang | 2231931 | 2017-05-10 15:59:59 -0700 | [diff] [blame] | 787 | php7.1 | |
| 788 | php7.1_c | |
Yilun Chong | 6adc3d7 | 2018-12-18 16:20:23 -0800 | [diff] [blame] | 789 | php_all | |
Hao Nguyen | f85c823 | 2019-03-07 14:34:28 -0800 | [diff] [blame] | 790 | dist_install | |
Yilun Chong | 152c830 | 2018-12-20 17:15:51 -0800 | [diff] [blame] | 791 | benchmark) |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 792 | " |
| 793 | exit 1 |
| 794 | fi |
| 795 | |
| 796 | set -e # exit immediately on error |
| 797 | set -x # display all commands |
Feng Xiao | 9de4e64 | 2018-07-13 16:55:32 -0700 | [diff] [blame] | 798 | cd $(dirname $0) |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 799 | eval "build_$1" |