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