| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Build and runs tests for the protobuf project. The tests as written here are | 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 | 4 # used by both Jenkins and Travis, though some specialized logic is required to |
| 5 # handle the differences between them. | 5 # handle the differences between them. |
| 6 | 6 |
| 7 on_travis() { | 7 on_travis() { |
| 8 if [ "$TRAVIS" == "true" ]; then | 8 if [ "$TRAVIS" == "true" ]; then |
| 9 "$@" | 9 "$@" |
| 10 fi | 10 fi |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 if [[ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]]; then | 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 | 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. | 23 # decent C++ 11 support in order to compile conformance tests. |
| 24 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | 24 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y |
| 25 sudo apt-get update -qq | 25 sudo apt-get update -qq |
| 26 sudo apt-get install -qq g++-4.8 | 26 sudo apt-get install -qq g++-4.8 |
| 27 export CXX="g++-4.8" CC="gcc-4.8" | 27 export CXX="g++-4.8" CC="gcc-4.8" |
| 28 fi | 28 fi |
| 29 | 29 |
| 30 ./autogen.sh | 30 ./autogen.sh |
| 31 ./configure CXXFLAGS="-fPIC" # -fPIC is needed for python cpp test. | 31 ./configure |
| 32 # See python/setup.py for more details | |
| 33 make -j2 | 32 make -j2 |
| 34 } | 33 } |
| 35 | 34 |
| 36 build_cpp() { | 35 build_cpp() { |
| 37 internal_build_cpp | 36 internal_build_cpp |
| 38 make check -j2 | 37 make check -j2 |
| 39 cd conformance && make test_cpp && cd .. | 38 cd conformance && make test_cpp && cd .. |
| 40 | 39 |
| 41 # The benchmark code depends on cmake, so test if it is installed before | 40 # Verify benchmarking code can build successfully. |
| 42 # trying to do the build. | 41 cd benchmarks && make && ./generate-datasets && cd .. |
| 43 # NOTE: The travis macOS images say they have cmake, but the xcode8.1 image | |
| 44 # appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996 | |
| 45 if [[ $(type cmake 2>/dev/null) ]]; then | |
| 46 # Verify benchmarking code can build successfully. | |
| 47 git submodule init | |
| 48 git submodule update | |
| 49 cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd .
./.. | |
| 50 cd benchmarks && make && ./generate-datasets && cd .. | |
| 51 else | |
| 52 echo "" | |
| 53 echo "WARNING: Skipping validation of the bench marking code, cmake isn't in
stalled." | |
| 54 echo "" | |
| 55 fi | |
| 56 } | 42 } |
| 57 | 43 |
| 58 build_cpp_distcheck() { | 44 build_cpp_distcheck() { |
| 59 ./autogen.sh | 45 ./autogen.sh |
| 60 ./configure | 46 ./configure |
| 61 make dist | |
| 62 | |
| 63 # List all files that should be included in the distribution package. | |
| 64 git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake
\|examples\)" |\ | |
| 65 grep -v ".gitignore" | grep -v "java/compatibility_tests" > dist.lst | |
| 66 # Unzip the dist tar file. | |
| 67 DIST=`ls *.tar.gz` | |
| 68 tar -xf $DIST | |
| 69 cd ${DIST//.tar.gz} | |
| 70 # Check if every file exists in the dist tar file. | |
| 71 FILES_MISSING="" | |
| 72 for FILE in $(<../dist.lst); do | |
| 73 if ! file $FILE &>/dev/null; then | |
| 74 echo "$FILE is not found!" | |
| 75 FILES_MISSING="$FILE $FILES_MISSING" | |
| 76 fi | |
| 77 done | |
| 78 cd .. | |
| 79 if [ ! -z "$FILES_MISSING" ]; then | |
| 80 echo "Missing files in EXTRA_DIST: $FILES_MISSING" | |
| 81 exit 1 | |
| 82 fi | |
| 83 | |
| 84 # Do the regular dist-check for C++. | |
| 85 make distcheck -j2 | 47 make distcheck -j2 |
| 86 } | 48 } |
| 87 | 49 |
| 88 build_csharp() { | 50 build_csharp() { |
| 89 # Just for the conformance tests. We don't currently | 51 # Just for the conformance tests. We don't currently |
| 90 # need to really build protoc, but it's simplest to keep with the | 52 # need to really build protoc, but it's simplest to keep with the |
| 91 # conventions of the other builds. | 53 # conventions of the other builds. |
| 92 internal_build_cpp | 54 internal_build_cpp |
| 93 NUGET=/usr/local/bin/nuget.exe | 55 NUGET=/usr/local/bin/nuget.exe |
| 94 | 56 |
| 95 if [ "$TRAVIS" == "true" ]; then | 57 if [ "$TRAVIS" == "true" ]; then |
| 96 # Install latest version of Mono | 58 # Install latest version of Mono |
| 97 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BF
F6A14DA29AA6A19B38D3D831EF | 59 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BF
F6A14DA29AA6A19B38D3D831EF |
| 98 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB5
51 | |
| 99 echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo t
ee /etc/apt/sources.list.d/mono-xamarin.list | 60 echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo t
ee /etc/apt/sources.list.d/mono-xamarin.list |
| 61 echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat
main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list |
| 100 sudo apt-get update -qq | 62 sudo apt-get update -qq |
| 101 sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit | 63 sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit |
| 102 | 64 wget www.nuget.org/NuGet.exe -O nuget.exe |
| 103 # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. | 65 NUGET=../../nuget.exe |
| 104 sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/d
otnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' | |
| 105 sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 | |
| 106 sudo apt-get update -qq | |
| 107 sudo apt-get install -qq dotnet-dev-1.0.0-preview2-003121 | |
| 108 fi | 66 fi |
| 109 | 67 |
| 110 # Perform "dotnet new" once to get the setup preprocessing out of the | 68 (cd csharp/src; mono $NUGET restore) |
| 111 # way. That spews a lot of output (including backspaces) into logs | |
| 112 # otherwise, and can cause problems. It doesn't matter if this step | |
| 113 # is performed multiple times; it's cheap after the first time anyway. | |
| 114 mkdir dotnettmp | |
| 115 (cd dotnettmp; dotnet new > /dev/null) | |
| 116 rm -rf dotnettmp | |
| 117 | |
| 118 (cd csharp/src; dotnet restore) | |
| 119 csharp/buildall.sh | 69 csharp/buildall.sh |
| 120 cd conformance && make test_csharp && cd .. | 70 cd conformance && make test_csharp && cd .. |
| 121 } | 71 } |
| 122 | 72 |
| 123 build_golang() { | 73 build_golang() { |
| 124 # Go build needs `protoc`. | 74 # Go build needs `protoc`. |
| 125 internal_build_cpp | 75 internal_build_cpp |
| 126 # Add protoc to the path so that the examples build finds it. | 76 # Add protoc to the path so that the examples build finds it. |
| 127 export PATH="`pwd`/src:$PATH" | 77 export PATH="`pwd`/src:$PATH" |
| 128 | 78 |
| 129 # Install Go and the Go protobuf compiler plugin. | 79 # Install Go and the Go protobuf compiler plugin. |
| 130 on_travis sudo apt-get update -qq | 80 sudo apt-get update -qq |
| 131 on_travis sudo apt-get install -qq golang | 81 sudo apt-get install -qq golang |
| 132 | |
| 133 export GOPATH="$HOME/gocode" | 82 export GOPATH="$HOME/gocode" |
| 134 mkdir -p "$GOPATH/src/github.com/google" | 83 mkdir -p "$GOPATH/src/github.com/google" |
| 135 rm -f "$GOPATH/src/github.com/google/protobuf" | |
| 136 ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" | 84 ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" |
| 137 export PATH="$GOPATH/bin:$PATH" | 85 export PATH="$GOPATH/bin:$PATH" |
| 138 go get github.com/golang/protobuf/protoc-gen-go | 86 go get github.com/golang/protobuf/protoc-gen-go |
| 139 | 87 |
| 140 cd examples && make gotest && cd .. | 88 cd examples && make gotest && cd .. |
| 141 } | 89 } |
| 142 | 90 |
| 143 use_java() { | 91 use_java() { |
| 144 version=$1 | 92 version=$1 |
| 145 case "$version" in | 93 case "$version" in |
| 94 jdk6) |
| 95 on_travis sudo apt-get install openjdk-6-jdk |
| 96 export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin:$PATH |
| 97 ;; |
| 146 jdk7) | 98 jdk7) |
| 147 on_travis sudo apt-get install openjdk-7-jdk | 99 on_travis sudo apt-get install openjdk-7-jdk |
| 148 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH | 100 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH |
| 149 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 | |
| 150 ;; | 101 ;; |
| 151 oracle7) | 102 oracle7) |
| 152 if [ "$TRAVIS" == "true" ]; then | 103 if [ "$TRAVIS" == "true" ]; then |
| 153 sudo apt-get install python-software-properties # for apt-add-repository | 104 sudo apt-get install python-software-properties # for apt-add-repository |
| 154 echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select
true" | \ | 105 echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select
true" | \ |
| 155 sudo debconf-set-selections | 106 sudo debconf-set-selections |
| 156 yes | sudo apt-add-repository ppa:webupd8team/java | 107 yes | sudo apt-add-repository ppa:webupd8team/java |
| 157 yes | sudo apt-get install oracle-java7-installer | 108 yes | sudo apt-get install oracle-java7-installer |
| 158 fi; | 109 fi; |
| 159 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH | 110 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH |
| 160 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 | |
| 161 ;; | 111 ;; |
| 162 esac | 112 esac |
| 163 | 113 |
| 164 if [ "$TRAVIS" != "true" ]; then | 114 if [ "$TRAVIS" != "true" ]; then |
| 165 MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository | 115 MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository |
| 166 MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" | 116 MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" |
| 167 fi; | 117 fi; |
| 168 | 118 |
| 169 which java | 119 which java |
| 170 java -version | 120 java -version |
| 171 $MVN -version | |
| 172 } | 121 } |
| 173 | 122 |
| 174 # --batch-mode supresses download progress output that spams the logs. | 123 # --batch-mode supresses download progress output that spams the logs. |
| 175 MVN="mvn --batch-mode" | 124 MVN="mvn --batch-mode" |
| 176 | 125 |
| 177 build_java() { | 126 build_java() { |
| 178 version=$1 | 127 version=$1 |
| 179 dir=java_$version | 128 dir=java_$version |
| 180 # Java build needs `protoc`. | 129 # Java build needs `protoc`. |
| 181 internal_build_cpp | 130 internal_build_cpp |
| (...skipping 12 matching lines...) Expand all Loading... |
| 194 cd ../.. | 143 cd ../.. |
| 195 cd conformance && make test_java && cd .. | 144 cd conformance && make test_java && cd .. |
| 196 } | 145 } |
| 197 | 146 |
| 198 build_javanano() { | 147 build_javanano() { |
| 199 # Java build needs `protoc`. | 148 # Java build needs `protoc`. |
| 200 internal_build_cpp | 149 internal_build_cpp |
| 201 cd javanano && $MVN test && cd .. | 150 cd javanano && $MVN test && cd .. |
| 202 } | 151 } |
| 203 | 152 |
| 153 build_java_jdk6() { |
| 154 use_java jdk6 |
| 155 build_java jdk6 |
| 156 } |
| 204 build_java_jdk7() { | 157 build_java_jdk7() { |
| 205 use_java jdk7 | 158 use_java jdk7 |
| 206 build_java_with_conformance_tests | 159 build_java_with_conformance_tests |
| 207 } | 160 } |
| 208 build_java_oracle7() { | 161 build_java_oracle7() { |
| 209 use_java oracle7 | 162 use_java oracle7 |
| 210 build_java oracle7 | 163 build_java oracle7 |
| 211 } | 164 } |
| 212 build_java_compatibility() { | 165 |
| 213 use_java jdk7 | 166 build_javanano_jdk6() { |
| 214 internal_build_cpp | 167 use_java jdk6 |
| 215 # Use the unit-tests extraced from 2.5.0 to test the compatibilty between | 168 build_javanano |
| 216 # 3.0.0-beta-4 and the current version. | |
| 217 cd java/compatibility_tests/v2.5.0 | |
| 218 ./test.sh 3.0.0-beta-4 | |
| 219 } | 169 } |
| 220 | |
| 221 build_javanano_jdk7() { | 170 build_javanano_jdk7() { |
| 222 use_java jdk7 | 171 use_java jdk7 |
| 223 build_javanano | 172 build_javanano |
| 224 } | 173 } |
| 225 build_javanano_oracle7() { | 174 build_javanano_oracle7() { |
| 226 use_java oracle7 | 175 use_java oracle7 |
| 227 build_javanano | 176 build_javanano |
| 228 } | 177 } |
| 229 | 178 |
| 230 internal_install_python_deps() { | 179 internal_install_python_deps() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 241 if [ $(uname -s) == "Linux" ]; then | 190 if [ $(uname -s) == "Linux" ]; then |
| 242 sudo apt-get install -y python-software-properties # for apt-add-repository | 191 sudo apt-get install -y python-software-properties # for apt-add-repository |
| 243 sudo apt-add-repository -y ppa:fkrull/deadsnakes | 192 sudo apt-add-repository -y ppa:fkrull/deadsnakes |
| 244 sudo apt-get update -qq | 193 sudo apt-get update -qq |
| 245 sudo apt-get install -y python2.6 python2.6-dev | 194 sudo apt-get install -y python2.6 python2.6-dev |
| 246 sudo apt-get install -y python3.3 python3.3-dev | 195 sudo apt-get install -y python3.3 python3.3-dev |
| 247 sudo apt-get install -y python3.4 python3.4-dev | 196 sudo apt-get install -y python3.4 python3.4-dev |
| 248 fi | 197 fi |
| 249 } | 198 } |
| 250 | 199 |
| 251 build_objectivec_ios() { | 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 |
| 252 # Reused the build script that takes care of configuring and ensuring things | 206 # Reused the build script that takes care of configuring and ensuring things |
| 253 # are up to date. The OS X test runs the objc conformance test, so skip it | 207 # are up to date. Xcode and conformance tests will be directly invoked. |
| 254 # here. | |
| 255 # Note: travis has xctool installed, and we've looked at using it in the past | |
| 256 # but it has ended up proving unreliable (bugs), an they are removing build | |
| 257 # support in favor of xcbuild (or just xcodebuild). | |
| 258 objectivec/DevTools/full_mac_build.sh \ | 208 objectivec/DevTools/full_mac_build.sh \ |
| 259 --core-only --skip-xcode-osx --skip-objc-conformance "$@" | 209 --core-only --skip-xcode --skip-objc-conformance |
| 260 } | 210 } |
| 261 | 211 |
| 262 build_objectivec_ios_debug() { | 212 internal_xctool_debug_and_release() { |
| 263 build_objectivec_ios --skip-xcode-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 "$@" |
| 264 } | 217 } |
| 265 | 218 |
| 266 build_objectivec_ios_release() { | 219 build_objectivec_ios() { |
| 267 build_objectivec_ios --skip-xcode-debug | 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 |
| 268 } | 243 } |
| 269 | 244 |
| 270 build_objectivec_osx() { | 245 build_objectivec_osx() { |
| 271 # Reused the build script that takes care of configuring and ensuring things | 246 internal_objectivec_common |
| 272 # are up to date. | 247 internal_xctool_debug_and_release \ |
| 273 objectivec/DevTools/full_mac_build.sh \ | 248 -project objectivec/ProtocolBuffers_OSX.xcodeproj \ |
| 274 --core-only --skip-xcode-ios | 249 -scheme ProtocolBuffers \ |
| 275 } | 250 -destination "platform=OS X,arch=x86_64" \ |
| 276 | 251 test |
| 277 build_objectivec_cocoapods_integration() { | 252 cd conformance && make test_objc && cd .. |
| 278 # Update pod to the latest version. | |
| 279 gem install cocoapods --no-ri --no-rdoc | |
| 280 objectivec/Tests/CocoaPods/run_tests.sh | |
| 281 } | 253 } |
| 282 | 254 |
| 283 build_python() { | 255 build_python() { |
| 284 internal_build_cpp | 256 internal_build_cpp |
| 285 internal_install_python_deps | 257 internal_install_python_deps |
| 286 cd python | 258 cd python |
| 287 # Only test Python 2.6/3.x on Linux | 259 # Only test Python 2.6/3.x on Linux |
| 288 if [ $(uname -s) == "Linux" ]; then | 260 if [ $(uname -s) == "Linux" ]; then |
| 289 envlist=py\{26,27,33,34\}-python | 261 envlist=py\{26,27,33,34\}-python |
| 290 else | 262 else |
| (...skipping 13 matching lines...) Expand all Loading... |
| 304 if [ $(uname -s) == "Linux" ]; then | 276 if [ $(uname -s) == "Linux" ]; then |
| 305 # py26 is currently disabled due to json_format | 277 # py26 is currently disabled due to json_format |
| 306 envlist=py\{27,33,34\}-cpp | 278 envlist=py\{27,33,34\}-cpp |
| 307 else | 279 else |
| 308 envlist=py27-cpp | 280 envlist=py27-cpp |
| 309 fi | 281 fi |
| 310 tox -e $envlist | 282 tox -e $envlist |
| 311 cd .. | 283 cd .. |
| 312 } | 284 } |
| 313 | 285 |
| 286 build_ruby19() { |
| 287 internal_build_cpp # For conformance tests. |
| 288 cd ruby && bash travis-test.sh ruby-1.9 && cd .. |
| 289 } |
| 290 build_ruby20() { |
| 291 internal_build_cpp # For conformance tests. |
| 292 cd ruby && bash travis-test.sh ruby-2.0 && cd .. |
| 293 } |
| 314 build_ruby21() { | 294 build_ruby21() { |
| 315 internal_build_cpp # For conformance tests. | 295 internal_build_cpp # For conformance tests. |
| 316 cd ruby && bash travis-test.sh ruby-2.1 && cd .. | 296 cd ruby && bash travis-test.sh ruby-2.1 && cd .. |
| 317 } | 297 } |
| 318 build_ruby22() { | 298 build_ruby22() { |
| 319 internal_build_cpp # For conformance tests. | 299 internal_build_cpp # For conformance tests. |
| 320 cd ruby && bash travis-test.sh ruby-2.2 && cd .. | 300 cd ruby && bash travis-test.sh ruby-2.2 && cd .. |
| 321 } | 301 } |
| 322 build_jruby() { | 302 build_jruby() { |
| 323 internal_build_cpp # For conformance tests. | 303 internal_build_cpp # For conformance tests. |
| 324 # TODO(xiaofeng): Upgrade to jruby-9.x. There are some broken jests to be | 304 cd ruby && bash travis-test.sh jruby && cd .. |
| 325 # fixed. | |
| 326 cd ruby && bash travis-test.sh jruby-1.7 && cd .. | |
| 327 } | |
| 328 build_ruby_all() { | |
| 329 build_ruby21 | |
| 330 build_ruby22 | |
| 331 # TODO(teboring): Disable jruby test temperarily for it randomly fails. | |
| 332 # https://grpc-testing.appspot.com/job/protobuf_pull_request/735/consoleFull. | |
| 333 # build_jruby | |
| 334 } | 305 } |
| 335 | 306 |
| 336 build_javascript() { | 307 build_javascript() { |
| 337 internal_build_cpp | 308 internal_build_cpp |
| 338 cd js && npm install && npm test && cd .. | 309 cd js && npm install && npm test && cd .. |
| 339 } | 310 } |
| 340 | 311 |
| 341 generate_php_test_proto() { | |
| 342 internal_build_cpp | |
| 343 pushd php/tests | |
| 344 # Generate test file | |
| 345 rm -rf generated | |
| 346 mkdir generated | |
| 347 ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto
proto/test_no_namespace.proto | |
| 348 pushd ../../src | |
| 349 ./protoc --php_out=../php/tests/generated google/protobuf/empty.proto | |
| 350 popd | |
| 351 popd | |
| 352 } | |
| 353 | |
| 354 use_php() { | |
| 355 VERSION=$1 | |
| 356 PHP=`which php` | |
| 357 PHP_CONFIG=`which php-config` | |
| 358 PHPIZE=`which phpize` | |
| 359 rm $PHP | |
| 360 rm $PHP_CONFIG | |
| 361 rm $PHPIZE | |
| 362 cp "/usr/bin/php$VERSION" $PHP | |
| 363 cp "/usr/bin/php-config$VERSION" $PHP_CONFIG | |
| 364 cp "/usr/bin/phpize$VERSION" $PHPIZE | |
| 365 generate_php_test_proto | |
| 366 } | |
| 367 | |
| 368 use_php_zts() { | |
| 369 VERSION=$1 | |
| 370 PHP=`which php` | |
| 371 PHP_CONFIG=`which php-config` | |
| 372 PHPIZE=`which phpize` | |
| 373 ln -sfn "/usr/local/php-${VERSION}-zts/bin/php" $PHP | |
| 374 ln -sfn "/usr/local/php-${VERSION}-zts/bin/php-config" $PHP_CONFIG | |
| 375 ln -sfn "/usr/local/php-${VERSION}-zts/bin/phpize" $PHPIZE | |
| 376 generate_php_test_proto | |
| 377 } | |
| 378 | |
| 379 use_php_bc() { | |
| 380 VERSION=$1 | |
| 381 PHP=`which php` | |
| 382 PHP_CONFIG=`which php-config` | |
| 383 PHPIZE=`which phpize` | |
| 384 ln -sfn "/usr/local/php-${VERSION}-bc/bin/php" $PHP | |
| 385 ln -sfn "/usr/local/php-${VERSION}-bc/bin/php-config" $PHP_CONFIG | |
| 386 ln -sfn "/usr/local/php-${VERSION}-bc/bin/phpize" $PHPIZE | |
| 387 generate_php_test_proto | |
| 388 } | |
| 389 | |
| 390 build_php5.5() { | |
| 391 use_php 5.5 | |
| 392 pushd php | |
| 393 rm -rf vendor | |
| 394 cp -r /usr/local/vendor-5.5 vendor | |
| 395 ./vendor/bin/phpunit | |
| 396 popd | |
| 397 } | |
| 398 | |
| 399 build_php5.5_c() { | |
| 400 use_php 5.5 | |
| 401 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 402 } | |
| 403 | |
| 404 build_php5.5_zts_c() { | |
| 405 use_php_zts 5.5 | |
| 406 wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit | |
| 407 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 408 } | |
| 409 | |
| 410 build_php5.5_32() { | |
| 411 use_php_bc 5.5 | |
| 412 pushd php | |
| 413 rm -rf vendor | |
| 414 cp -r /usr/local/vendor-5.5 vendor | |
| 415 ./vendor/bin/phpunit | |
| 416 popd | |
| 417 } | |
| 418 | |
| 419 build_php5.5_c_32() { | |
| 420 use_php_bc 5.5 | |
| 421 wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit | |
| 422 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 423 } | |
| 424 | |
| 425 build_php5.6() { | |
| 426 use_php 5.6 | |
| 427 pushd php | |
| 428 rm -rf vendor | |
| 429 cp -r /usr/local/vendor-5.6 vendor | |
| 430 ./vendor/bin/phpunit | |
| 431 popd | |
| 432 } | |
| 433 | |
| 434 build_php5.6_c() { | |
| 435 use_php 5.6 | |
| 436 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 437 } | |
| 438 | |
| 439 build_php5.6_mac() { | |
| 440 generate_php_test_proto | |
| 441 # Install PHP | |
| 442 curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6 | |
| 443 PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"` # The folder name may
change upon time | |
| 444 export PATH="$PHP_FOLDER/bin:$PATH" | |
| 445 | |
| 446 # Install phpunit | |
| 447 curl https://phar.phpunit.de/phpunit.phar -L -o phpunit.phar | |
| 448 chmod +x phpunit.phar | |
| 449 sudo mv phpunit.phar /usr/local/bin/phpunit | |
| 450 | |
| 451 # Install valgrind | |
| 452 echo "#! /bin/bash" > valgrind | |
| 453 chmod ug+x valgrind | |
| 454 sudo mv valgrind /usr/local/bin/valgrind | |
| 455 | |
| 456 # Test | |
| 457 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 458 } | |
| 459 | |
| 460 build_php7.0() { | |
| 461 use_php 7.0 | |
| 462 pushd php | |
| 463 rm -rf vendor | |
| 464 cp -r /usr/local/vendor-7.0 vendor | |
| 465 ./vendor/bin/phpunit | |
| 466 popd | |
| 467 } | |
| 468 | |
| 469 build_php7.0_c() { | |
| 470 use_php 7.0 | |
| 471 cd php/tests && /bin/bash ./test.sh && cd ../.. | |
| 472 } | |
| 473 | |
| 474 build_php_all() { | |
| 475 build_php5.5 | |
| 476 build_php5.6 | |
| 477 build_php7.0 | |
| 478 build_php5.5_c | |
| 479 build_php5.6_c | |
| 480 # build_php7.0_c | |
| 481 build_php5.5_zts_c | |
| 482 } | |
| 483 | |
| 484 build_php_all_32() { | |
| 485 build_php5.5_32 | |
| 486 build_php5.5_c_32 | |
| 487 } | |
| 488 | |
| 489 # Note: travis currently does not support testing more than one language so the | 312 # Note: travis currently does not support testing more than one language so the |
| 490 # .travis.yml cheats and claims to only be cpp. If they add multiple language | 313 # .travis.yml cheats and claims to only be cpp. If they add multiple language |
| 491 # support, this should probably get updated to install steps and/or | 314 # support, this should probably get updated to install steps and/or |
| 492 # rvm/gemfile/jdk/etc. entries rather than manually doing the work. | 315 # rvm/gemfile/jdk/etc. entries rather than manually doing the work. |
| 493 | 316 |
| 494 # .travis.yml uses matrix.exclude to block the cases where app-get can't be | 317 # .travis.yml uses matrix.exclude to block the cases where app-get can't be |
| 495 # use to install things. | 318 # use to install things. |
| 496 | 319 |
| 497 # -------- main -------- | 320 # -------- main -------- |
| 498 | 321 |
| 499 if [ "$#" -ne 1 ]; then | 322 if [ "$#" -ne 1 ]; then |
| 500 echo " | 323 echo " |
| 501 Usage: $0 { cpp | | 324 Usage: $0 { cpp | |
| 502 cpp_distcheck | | |
| 503 csharp | | 325 csharp | |
| 326 java_jdk6 | |
| 504 java_jdk7 | | 327 java_jdk7 | |
| 505 java_oracle7 | | 328 java_oracle7 | |
| 506 java_compatibility | | 329 javanano_jdk6 | |
| 507 javanano_jdk7 | | 330 javanano_jdk7 | |
| 508 javanano_oracle7 | | 331 javanano_oracle7 | |
| 509 objectivec_ios | | 332 objectivec_ios | |
| 510 objectivec_ios_debug | | |
| 511 objectivec_ios_release | | |
| 512 objectivec_osx | | 333 objectivec_osx | |
| 513 objectivec_cocoapods_integration | | |
| 514 python | | 334 python | |
| 515 python_cpp | | 335 python_cpp | |
| 336 ruby19 | |
| 337 ruby20 | |
| 516 ruby21 | | 338 ruby21 | |
| 517 ruby22 | | 339 ruby22 | |
| 518 jruby | | 340 jruby } |
| 519 ruby_all | | |
| 520 php5.5 | | |
| 521 php5.5_c | | |
| 522 php5.6 | | |
| 523 php5.6_c | | |
| 524 php7.0 | | |
| 525 php7.0_c | | |
| 526 php_all) | |
| 527 " | 341 " |
| 528 exit 1 | 342 exit 1 |
| 529 fi | 343 fi |
| 530 | 344 |
| 531 set -e # exit immediately on error | 345 set -e # exit immediately on error |
| 532 set -x # display all commands | 346 set -x # display all commands |
| 533 eval "build_$1" | 347 eval "build_$1" |
| OLD | NEW |