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 # The benchmark code depends on cmake, so test if it is installed before |
41 cd benchmarks && make && ./generate-datasets && cd .. | 42 # trying to do the build. |
| 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 |
42 } | 56 } |
43 | 57 |
44 build_cpp_distcheck() { | 58 build_cpp_distcheck() { |
45 ./autogen.sh | 59 ./autogen.sh |
46 ./configure | 60 ./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++. |
47 make distcheck -j2 | 85 make distcheck -j2 |
48 } | 86 } |
49 | 87 |
50 build_csharp() { | 88 build_csharp() { |
51 # Just for the conformance tests. We don't currently | 89 # Just for the conformance tests. We don't currently |
52 # need to really build protoc, but it's simplest to keep with the | 90 # need to really build protoc, but it's simplest to keep with the |
53 # conventions of the other builds. | 91 # conventions of the other builds. |
54 internal_build_cpp | 92 internal_build_cpp |
55 NUGET=/usr/local/bin/nuget.exe | 93 NUGET=/usr/local/bin/nuget.exe |
56 | 94 |
57 if [ "$TRAVIS" == "true" ]; then | 95 if [ "$TRAVIS" == "true" ]; then |
58 # Install latest version of Mono | 96 # Install latest version of Mono |
59 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BF
F6A14DA29AA6A19B38D3D831EF | 97 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 |
60 echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo t
ee /etc/apt/sources.list.d/mono-xamarin.list | 99 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 | 100 sudo apt-get update -qq |
63 sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit | 101 sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit |
64 wget www.nuget.org/NuGet.exe -O nuget.exe | 102 |
65 NUGET=../../nuget.exe | 103 # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. |
| 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 |
66 fi | 108 fi |
67 | 109 |
68 (cd csharp/src; mono $NUGET restore) | 110 # Perform "dotnet new" once to get the setup preprocessing out of the |
| 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) |
69 csharp/buildall.sh | 119 csharp/buildall.sh |
70 cd conformance && make test_csharp && cd .. | 120 cd conformance && make test_csharp && cd .. |
71 } | 121 } |
72 | 122 |
73 build_golang() { | 123 build_golang() { |
74 # Go build needs `protoc`. | 124 # Go build needs `protoc`. |
75 internal_build_cpp | 125 internal_build_cpp |
76 # Add protoc to the path so that the examples build finds it. | 126 # Add protoc to the path so that the examples build finds it. |
77 export PATH="`pwd`/src:$PATH" | 127 export PATH="`pwd`/src:$PATH" |
78 | 128 |
79 # Install Go and the Go protobuf compiler plugin. | 129 # Install Go and the Go protobuf compiler plugin. |
80 sudo apt-get update -qq | 130 on_travis sudo apt-get update -qq |
81 sudo apt-get install -qq golang | 131 on_travis sudo apt-get install -qq golang |
| 132 |
82 export GOPATH="$HOME/gocode" | 133 export GOPATH="$HOME/gocode" |
83 mkdir -p "$GOPATH/src/github.com/google" | 134 mkdir -p "$GOPATH/src/github.com/google" |
| 135 rm -f "$GOPATH/src/github.com/google/protobuf" |
84 ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" | 136 ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" |
85 export PATH="$GOPATH/bin:$PATH" | 137 export PATH="$GOPATH/bin:$PATH" |
86 go get github.com/golang/protobuf/protoc-gen-go | 138 go get github.com/golang/protobuf/protoc-gen-go |
87 | 139 |
88 cd examples && make gotest && cd .. | 140 cd examples && make gotest && cd .. |
89 } | 141 } |
90 | 142 |
91 use_java() { | 143 use_java() { |
92 version=$1 | 144 version=$1 |
93 case "$version" in | 145 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) | 146 jdk7) |
99 on_travis sudo apt-get install openjdk-7-jdk | 147 on_travis sudo apt-get install openjdk-7-jdk |
100 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH | 148 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH |
| 149 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
101 ;; | 150 ;; |
102 oracle7) | 151 oracle7) |
103 if [ "$TRAVIS" == "true" ]; then | 152 if [ "$TRAVIS" == "true" ]; then |
104 sudo apt-get install python-software-properties # for apt-add-repository | 153 sudo apt-get install python-software-properties # for apt-add-repository |
105 echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select
true" | \ | 154 echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select
true" | \ |
106 sudo debconf-set-selections | 155 sudo debconf-set-selections |
107 yes | sudo apt-add-repository ppa:webupd8team/java | 156 yes | sudo apt-add-repository ppa:webupd8team/java |
108 yes | sudo apt-get install oracle-java7-installer | 157 yes | sudo apt-get install oracle-java7-installer |
109 fi; | 158 fi; |
110 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH | 159 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH |
| 160 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
111 ;; | 161 ;; |
112 esac | 162 esac |
113 | 163 |
114 if [ "$TRAVIS" != "true" ]; then | 164 if [ "$TRAVIS" != "true" ]; then |
115 MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository | 165 MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository |
116 MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" | 166 MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" |
117 fi; | 167 fi; |
118 | 168 |
119 which java | 169 which java |
120 java -version | 170 java -version |
| 171 $MVN -version |
121 } | 172 } |
122 | 173 |
123 # --batch-mode supresses download progress output that spams the logs. | 174 # --batch-mode supresses download progress output that spams the logs. |
124 MVN="mvn --batch-mode" | 175 MVN="mvn --batch-mode" |
125 | 176 |
126 build_java() { | 177 build_java() { |
127 version=$1 | 178 version=$1 |
128 dir=java_$version | 179 dir=java_$version |
129 # Java build needs `protoc`. | 180 # Java build needs `protoc`. |
130 internal_build_cpp | 181 internal_build_cpp |
(...skipping 12 matching lines...) Expand all Loading... |
143 cd ../.. | 194 cd ../.. |
144 cd conformance && make test_java && cd .. | 195 cd conformance && make test_java && cd .. |
145 } | 196 } |
146 | 197 |
147 build_javanano() { | 198 build_javanano() { |
148 # Java build needs `protoc`. | 199 # Java build needs `protoc`. |
149 internal_build_cpp | 200 internal_build_cpp |
150 cd javanano && $MVN test && cd .. | 201 cd javanano && $MVN test && cd .. |
151 } | 202 } |
152 | 203 |
153 build_java_jdk6() { | |
154 use_java jdk6 | |
155 build_java jdk6 | |
156 } | |
157 build_java_jdk7() { | 204 build_java_jdk7() { |
158 use_java jdk7 | 205 use_java jdk7 |
159 build_java_with_conformance_tests | 206 build_java_with_conformance_tests |
160 } | 207 } |
161 build_java_oracle7() { | 208 build_java_oracle7() { |
162 use_java oracle7 | 209 use_java oracle7 |
163 build_java oracle7 | 210 build_java oracle7 |
164 } | 211 } |
| 212 build_java_compatibility() { |
| 213 use_java jdk7 |
| 214 internal_build_cpp |
| 215 # Use the unit-tests extraced from 2.5.0 to test the compatibilty between |
| 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 } |
165 | 220 |
166 build_javanano_jdk6() { | |
167 use_java jdk6 | |
168 build_javanano | |
169 } | |
170 build_javanano_jdk7() { | 221 build_javanano_jdk7() { |
171 use_java jdk7 | 222 use_java jdk7 |
172 build_javanano | 223 build_javanano |
173 } | 224 } |
174 build_javanano_oracle7() { | 225 build_javanano_oracle7() { |
175 use_java oracle7 | 226 use_java oracle7 |
176 build_javanano | 227 build_javanano |
177 } | 228 } |
178 | 229 |
179 internal_install_python_deps() { | 230 internal_install_python_deps() { |
(...skipping 10 matching lines...) Expand all Loading... |
190 if [ $(uname -s) == "Linux" ]; then | 241 if [ $(uname -s) == "Linux" ]; then |
191 sudo apt-get install -y python-software-properties # for apt-add-repository | 242 sudo apt-get install -y python-software-properties # for apt-add-repository |
192 sudo apt-add-repository -y ppa:fkrull/deadsnakes | 243 sudo apt-add-repository -y ppa:fkrull/deadsnakes |
193 sudo apt-get update -qq | 244 sudo apt-get update -qq |
194 sudo apt-get install -y python2.6 python2.6-dev | 245 sudo apt-get install -y python2.6 python2.6-dev |
195 sudo apt-get install -y python3.3 python3.3-dev | 246 sudo apt-get install -y python3.3 python3.3-dev |
196 sudo apt-get install -y python3.4 python3.4-dev | 247 sudo apt-get install -y python3.4 python3.4-dev |
197 fi | 248 fi |
198 } | 249 } |
199 | 250 |
200 internal_objectivec_common () { | 251 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 | 252 # 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. | 253 # are up to date. The OS X test runs the objc conformance test, so skip it |
| 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). |
208 objectivec/DevTools/full_mac_build.sh \ | 258 objectivec/DevTools/full_mac_build.sh \ |
209 --core-only --skip-xcode --skip-objc-conformance | 259 --core-only --skip-xcode-osx --skip-objc-conformance "$@" |
210 } | 260 } |
211 | 261 |
212 internal_xctool_debug_and_release() { | 262 build_objectivec_ios_debug() { |
213 # Always use -reporter plain to avoid escape codes in output (makes travis | 263 build_objectivec_ios --skip-xcode-release |
214 # logs easier to read). | |
215 xctool -reporter plain -configuration Debug "$@" | |
216 xctool -reporter plain -configuration Release "$@" | |
217 } | 264 } |
218 | 265 |
219 build_objectivec_ios() { | 266 build_objectivec_ios_release() { |
220 internal_objectivec_common | 267 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 } | 268 } |
244 | 269 |
245 build_objectivec_osx() { | 270 build_objectivec_osx() { |
246 internal_objectivec_common | 271 # Reused the build script that takes care of configuring and ensuring things |
247 internal_xctool_debug_and_release \ | 272 # are up to date. |
248 -project objectivec/ProtocolBuffers_OSX.xcodeproj \ | 273 objectivec/DevTools/full_mac_build.sh \ |
249 -scheme ProtocolBuffers \ | 274 --core-only --skip-xcode-ios |
250 -destination "platform=OS X,arch=x86_64" \ | 275 } |
251 test | 276 |
252 cd conformance && make test_objc && cd .. | 277 build_objectivec_cocoapods_integration() { |
| 278 # Update pod to the latest version. |
| 279 gem install cocoapods --no-ri --no-rdoc |
| 280 objectivec/Tests/CocoaPods/run_tests.sh |
253 } | 281 } |
254 | 282 |
255 build_python() { | 283 build_python() { |
256 internal_build_cpp | 284 internal_build_cpp |
257 internal_install_python_deps | 285 internal_install_python_deps |
258 cd python | 286 cd python |
259 # Only test Python 2.6/3.x on Linux | 287 # Only test Python 2.6/3.x on Linux |
260 if [ $(uname -s) == "Linux" ]; then | 288 if [ $(uname -s) == "Linux" ]; then |
261 envlist=py\{26,27,33,34\}-python | 289 envlist=py\{26,27,33,34\}-python |
262 else | 290 else |
(...skipping 13 matching lines...) Expand all Loading... |
276 if [ $(uname -s) == "Linux" ]; then | 304 if [ $(uname -s) == "Linux" ]; then |
277 # py26 is currently disabled due to json_format | 305 # py26 is currently disabled due to json_format |
278 envlist=py\{27,33,34\}-cpp | 306 envlist=py\{27,33,34\}-cpp |
279 else | 307 else |
280 envlist=py27-cpp | 308 envlist=py27-cpp |
281 fi | 309 fi |
282 tox -e $envlist | 310 tox -e $envlist |
283 cd .. | 311 cd .. |
284 } | 312 } |
285 | 313 |
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() { | 314 build_ruby21() { |
295 internal_build_cpp # For conformance tests. | 315 internal_build_cpp # For conformance tests. |
296 cd ruby && bash travis-test.sh ruby-2.1 && cd .. | 316 cd ruby && bash travis-test.sh ruby-2.1 && cd .. |
297 } | 317 } |
298 build_ruby22() { | 318 build_ruby22() { |
299 internal_build_cpp # For conformance tests. | 319 internal_build_cpp # For conformance tests. |
300 cd ruby && bash travis-test.sh ruby-2.2 && cd .. | 320 cd ruby && bash travis-test.sh ruby-2.2 && cd .. |
301 } | 321 } |
302 build_jruby() { | 322 build_jruby() { |
303 internal_build_cpp # For conformance tests. | 323 internal_build_cpp # For conformance tests. |
304 cd ruby && bash travis-test.sh jruby && cd .. | 324 # TODO(xiaofeng): Upgrade to jruby-9.x. There are some broken jests to be |
| 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 |
305 } | 334 } |
306 | 335 |
307 build_javascript() { | 336 build_javascript() { |
308 internal_build_cpp | 337 internal_build_cpp |
309 cd js && npm install && npm test && cd .. | 338 cd js && npm install && npm test && cd .. |
310 } | 339 } |
311 | 340 |
| 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 |
312 # Note: travis currently does not support testing more than one language so the | 489 # 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 | 490 # .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 | 491 # support, this should probably get updated to install steps and/or |
315 # rvm/gemfile/jdk/etc. entries rather than manually doing the work. | 492 # rvm/gemfile/jdk/etc. entries rather than manually doing the work. |
316 | 493 |
317 # .travis.yml uses matrix.exclude to block the cases where app-get can't be | 494 # .travis.yml uses matrix.exclude to block the cases where app-get can't be |
318 # use to install things. | 495 # use to install things. |
319 | 496 |
320 # -------- main -------- | 497 # -------- main -------- |
321 | 498 |
322 if [ "$#" -ne 1 ]; then | 499 if [ "$#" -ne 1 ]; then |
323 echo " | 500 echo " |
324 Usage: $0 { cpp | | 501 Usage: $0 { cpp | |
| 502 cpp_distcheck | |
325 csharp | | 503 csharp | |
326 java_jdk6 | | |
327 java_jdk7 | | 504 java_jdk7 | |
328 java_oracle7 | | 505 java_oracle7 | |
329 javanano_jdk6 | | 506 java_compatibility | |
330 javanano_jdk7 | | 507 javanano_jdk7 | |
331 javanano_oracle7 | | 508 javanano_oracle7 | |
332 objectivec_ios | | 509 objectivec_ios | |
| 510 objectivec_ios_debug | |
| 511 objectivec_ios_release | |
333 objectivec_osx | | 512 objectivec_osx | |
| 513 objectivec_cocoapods_integration | |
334 python | | 514 python | |
335 python_cpp | | 515 python_cpp | |
336 ruby19 | | |
337 ruby20 | | |
338 ruby21 | | 516 ruby21 | |
339 ruby22 | | 517 ruby22 | |
340 jruby } | 518 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) |
341 " | 527 " |
342 exit 1 | 528 exit 1 |
343 fi | 529 fi |
344 | 530 |
345 set -e # exit immediately on error | 531 set -e # exit immediately on error |
346 set -x # display all commands | 532 set -x # display all commands |
347 eval "build_$1" | 533 eval "build_$1" |
OLD | NEW |