2016-02-19 04:10:23 +00:00
|
|
|
#!/bin/bash
|
2016-03-04 22:21:18 +00:00
|
|
|
#
|
|
|
|
# Build and runs tests for the protobuf project. The tests as written here are
|
|
|
|
# used by both Jenkins and Travis, though some specialized logic is required to
|
|
|
|
# handle the differences between them.
|
2015-06-09 17:35:41 +00:00
|
|
|
|
2016-02-19 17:11:38 +00:00
|
|
|
on_travis() {
|
|
|
|
if [ "$TRAVIS" == "true" ]; then
|
|
|
|
"$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-07-15 18:05:10 +00:00
|
|
|
# For when some other test needs the C++ main build, including protoc and
|
|
|
|
# libprotobuf.
|
|
|
|
internal_build_cpp() {
|
2016-02-19 04:10:23 +00:00
|
|
|
if [ -f src/protoc ]; then
|
|
|
|
# Already built.
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2016-02-19 03:13:07 +00:00
|
|
|
if [[ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]]; then
|
2015-12-21 11:34:28 +00:00
|
|
|
# Install GCC 4.8 to replace the default GCC 4.6. We need 4.8 for more
|
|
|
|
# decent C++ 11 support in order to compile conformance tests.
|
|
|
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq g++-4.8
|
|
|
|
export CXX="g++-4.8" CC="gcc-4.8"
|
|
|
|
fi
|
2015-12-18 23:16:07 +00:00
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
./autogen.sh
|
2016-10-07 23:09:26 +00:00
|
|
|
./configure CXXFLAGS="-fPIC" # -fPIC is needed for python cpp test.
|
|
|
|
# See python/setup.py for more details
|
2016-03-04 22:21:18 +00:00
|
|
|
make -j2
|
2015-07-15 18:05:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_cpp() {
|
|
|
|
internal_build_cpp
|
2016-03-04 22:21:18 +00:00
|
|
|
make check -j2
|
2016-09-30 00:07:47 +00:00
|
|
|
cd conformance && make test_cpp && cd ..
|
2016-04-29 16:52:20 +00:00
|
|
|
|
2016-12-08 21:19:58 +00:00
|
|
|
# The benchmark code depends on cmake, so test if it is installed before
|
|
|
|
# trying to do the build.
|
|
|
|
# NOTE: The travis macOS images say they have cmake, but the xcode8.1 image
|
|
|
|
# appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996
|
|
|
|
if [[ $(type cmake 2>/dev/null) ]]; then
|
|
|
|
# Verify benchmarking code can build successfully.
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
|
|
|
|
cd benchmarks && make && ./generate-datasets && cd ..
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed."
|
|
|
|
echo ""
|
|
|
|
fi
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_cpp_distcheck() {
|
|
|
|
./autogen.sh
|
|
|
|
./configure
|
2016-07-20 00:20:31 +00:00
|
|
|
make dist
|
|
|
|
|
|
|
|
# List all files that should be included in the distribution package.
|
2016-11-18 23:36:28 +00:00
|
|
|
git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\)" |\
|
2017-01-23 23:11:00 +00:00
|
|
|
grep -v ".gitignore" | grep -v "java/compatibility_tests" |\
|
2017-07-23 17:34:24 +00:00
|
|
|
grep -v "cmake/protobuf.*\.pc\.cmake" |\
|
2017-02-10 00:49:52 +00:00
|
|
|
grep -v "python/compatibility_tests" | grep -v "csharp/compatibility_tests" > dist.lst
|
2016-07-20 00:20:31 +00:00
|
|
|
# Unzip the dist tar file.
|
|
|
|
DIST=`ls *.tar.gz`
|
|
|
|
tar -xf $DIST
|
|
|
|
cd ${DIST//.tar.gz}
|
|
|
|
# Check if every file exists in the dist tar file.
|
|
|
|
FILES_MISSING=""
|
|
|
|
for FILE in $(<../dist.lst); do
|
|
|
|
if ! file $FILE &>/dev/null; then
|
|
|
|
echo "$FILE is not found!"
|
|
|
|
FILES_MISSING="$FILE $FILES_MISSING"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
if [ ! -z "$FILES_MISSING" ]; then
|
|
|
|
echo "Missing files in EXTRA_DIST: $FILES_MISSING"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Do the regular dist-check for C++.
|
2016-03-04 22:21:18 +00:00
|
|
|
make distcheck -j2
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
|
2015-05-19 00:34:02 +00:00
|
|
|
build_csharp() {
|
2015-08-04 09:01:40 +00:00
|
|
|
# Just for the conformance tests. We don't currently
|
|
|
|
# need to really build protoc, but it's simplest to keep with the
|
|
|
|
# conventions of the other builds.
|
|
|
|
internal_build_cpp
|
2016-02-22 23:39:29 +00:00
|
|
|
NUGET=/usr/local/bin/nuget.exe
|
2015-08-04 09:01:40 +00:00
|
|
|
|
2016-07-14 21:01:47 +00:00
|
|
|
# Perform "dotnet new" once to get the setup preprocessing out of the
|
|
|
|
# way. That spews a lot of output (including backspaces) into logs
|
|
|
|
# otherwise, and can cause problems. It doesn't matter if this step
|
|
|
|
# is performed multiple times; it's cheap after the first time anyway.
|
2017-05-04 07:51:46 +00:00
|
|
|
# (It also doesn't matter if it's unnecessary, which it will be on some
|
|
|
|
# systems. It's necessary on Jenkins in order to avoid unprintable
|
|
|
|
# characters appearing in the JUnit output.)
|
2016-07-14 21:01:47 +00:00
|
|
|
mkdir dotnettmp
|
|
|
|
(cd dotnettmp; dotnet new > /dev/null)
|
|
|
|
rm -rf dotnettmp
|
|
|
|
|
2015-05-19 00:34:02 +00:00
|
|
|
csharp/buildall.sh
|
2015-12-31 00:03:49 +00:00
|
|
|
cd conformance && make test_csharp && cd ..
|
2017-02-10 00:49:52 +00:00
|
|
|
|
|
|
|
# Run csharp compatibility test between 3.0.0 and the current version.
|
|
|
|
csharp/compatibility_tests/v3.0.0/test.sh 3.0.0
|
2015-05-19 00:34:02 +00:00
|
|
|
}
|
|
|
|
|
2015-11-20 23:32:53 +00:00
|
|
|
build_golang() {
|
|
|
|
# Go build needs `protoc`.
|
|
|
|
internal_build_cpp
|
|
|
|
# Add protoc to the path so that the examples build finds it.
|
|
|
|
export PATH="`pwd`/src:$PATH"
|
|
|
|
|
|
|
|
# Install Go and the Go protobuf compiler plugin.
|
2016-07-22 01:04:56 +00:00
|
|
|
on_travis sudo apt-get update -qq
|
|
|
|
on_travis sudo apt-get install -qq golang
|
|
|
|
|
2015-11-20 23:32:53 +00:00
|
|
|
export GOPATH="$HOME/gocode"
|
|
|
|
mkdir -p "$GOPATH/src/github.com/google"
|
2016-07-22 01:04:56 +00:00
|
|
|
rm -f "$GOPATH/src/github.com/google/protobuf"
|
2015-11-20 23:32:53 +00:00
|
|
|
ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf"
|
|
|
|
export PATH="$GOPATH/bin:$PATH"
|
|
|
|
go get github.com/golang/protobuf/protoc-gen-go
|
|
|
|
|
|
|
|
cd examples && make gotest && cd ..
|
|
|
|
}
|
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
use_java() {
|
|
|
|
version=$1
|
|
|
|
case "$version" in
|
|
|
|
jdk7)
|
2016-02-19 17:11:38 +00:00
|
|
|
on_travis sudo apt-get install openjdk-7-jdk
|
2015-05-13 23:43:48 +00:00
|
|
|
export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
|
2016-07-21 18:37:46 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
|
2015-05-13 23:43:48 +00:00
|
|
|
;;
|
|
|
|
oracle7)
|
2016-02-22 23:39:29 +00:00
|
|
|
if [ "$TRAVIS" == "true" ]; then
|
|
|
|
sudo apt-get install python-software-properties # for apt-add-repository
|
|
|
|
echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | \
|
|
|
|
sudo debconf-set-selections
|
|
|
|
yes | sudo apt-add-repository ppa:webupd8team/java
|
|
|
|
yes | sudo apt-get install oracle-java7-installer
|
|
|
|
fi;
|
2015-05-13 23:43:48 +00:00
|
|
|
export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH
|
2016-07-21 18:37:46 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
|
2015-05-13 23:43:48 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-03-04 00:02:55 +00:00
|
|
|
if [ "$TRAVIS" != "true" ]; then
|
|
|
|
MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
|
|
|
|
MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY"
|
|
|
|
fi;
|
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
which java
|
|
|
|
java -version
|
2016-07-21 18:37:46 +00:00
|
|
|
$MVN -version
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
|
2016-02-20 20:03:39 +00:00
|
|
|
# --batch-mode supresses download progress output that spams the logs.
|
2016-02-20 20:17:10 +00:00
|
|
|
MVN="mvn --batch-mode"
|
2016-02-20 20:03:39 +00:00
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
build_java() {
|
2016-03-01 23:37:17 +00:00
|
|
|
version=$1
|
|
|
|
dir=java_$version
|
2015-12-21 19:08:18 +00:00
|
|
|
# Java build needs `protoc`.
|
|
|
|
internal_build_cpp
|
2016-03-01 23:37:17 +00:00
|
|
|
cp -r java $dir
|
|
|
|
cd $dir && $MVN clean && $MVN test
|
2015-12-21 19:08:18 +00:00
|
|
|
cd ../..
|
|
|
|
}
|
|
|
|
|
2016-03-01 23:37:17 +00:00
|
|
|
# The conformance tests are hard-coded to work with the $ROOT/java directory.
|
|
|
|
# So this can't run in parallel with two different sets of tests.
|
2015-12-21 19:08:18 +00:00
|
|
|
build_java_with_conformance_tests() {
|
2015-05-13 23:43:48 +00:00
|
|
|
# Java build needs `protoc`.
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp
|
2016-02-20 20:03:39 +00:00
|
|
|
cd java && $MVN test && $MVN install
|
2016-03-01 23:37:17 +00:00
|
|
|
cd util && $MVN package assembly:single
|
2015-12-21 11:25:59 +00:00
|
|
|
cd ../..
|
2015-05-13 23:43:48 +00:00
|
|
|
cd conformance && make test_java && cd ..
|
|
|
|
}
|
|
|
|
|
|
|
|
build_javanano() {
|
|
|
|
# Java build needs `protoc`.
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp
|
2016-02-20 20:17:10 +00:00
|
|
|
cd javanano && $MVN test && cd ..
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_java_jdk7() {
|
|
|
|
use_java jdk7
|
2015-12-21 19:08:18 +00:00
|
|
|
build_java_with_conformance_tests
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
build_java_oracle7() {
|
|
|
|
use_java oracle7
|
2016-03-01 23:37:17 +00:00
|
|
|
build_java oracle7
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
2016-07-29 21:11:21 +00:00
|
|
|
build_java_compatibility() {
|
|
|
|
use_java jdk7
|
|
|
|
internal_build_cpp
|
|
|
|
# Use the unit-tests extraced from 2.5.0 to test the compatibilty between
|
|
|
|
# 3.0.0-beta-4 and the current version.
|
|
|
|
cd java/compatibility_tests/v2.5.0
|
|
|
|
./test.sh 3.0.0-beta-4
|
|
|
|
}
|
2015-05-13 23:43:48 +00:00
|
|
|
|
|
|
|
build_javanano_jdk7() {
|
|
|
|
use_java jdk7
|
|
|
|
build_javanano
|
|
|
|
}
|
|
|
|
build_javanano_oracle7() {
|
|
|
|
use_java oracle7
|
|
|
|
build_javanano
|
|
|
|
}
|
|
|
|
|
2015-08-20 22:19:56 +00:00
|
|
|
internal_install_python_deps() {
|
2016-02-19 20:48:33 +00:00
|
|
|
if [ "$TRAVIS" != "true" ]; then
|
|
|
|
return;
|
|
|
|
fi
|
2015-06-10 21:21:23 +00:00
|
|
|
# Install tox (OS X doesn't have pip).
|
|
|
|
if [ $(uname -s) == "Darwin" ]; then
|
|
|
|
sudo easy_install tox
|
|
|
|
else
|
|
|
|
sudo pip install tox
|
|
|
|
fi
|
2015-08-27 00:30:41 +00:00
|
|
|
# Only install Python2.6/3.x on Linux.
|
2015-08-21 22:51:47 +00:00
|
|
|
if [ $(uname -s) == "Linux" ]; then
|
|
|
|
sudo apt-get install -y python-software-properties # for apt-add-repository
|
|
|
|
sudo apt-add-repository -y ppa:fkrull/deadsnakes
|
|
|
|
sudo apt-get update -qq
|
2017-08-18 20:15:06 +00:00
|
|
|
sudo apt-get install -y python3.3 python3.3-dev
|
2015-08-27 00:30:41 +00:00
|
|
|
sudo apt-get install -y python3.4 python3.4-dev
|
2017-08-22 17:36:52 +00:00
|
|
|
sudo apt-get install -y python3.5 python3.5-dev
|
|
|
|
sudo apt-get install -y python3.6 python3.6-dev
|
2015-08-21 22:51:47 +00:00
|
|
|
fi
|
2015-08-20 22:19:56 +00:00
|
|
|
}
|
|
|
|
|
2016-05-24 15:27:33 +00:00
|
|
|
build_objectivec_ios() {
|
2015-11-09 19:21:51 +00:00
|
|
|
# Reused the build script that takes care of configuring and ensuring things
|
2016-05-24 15:27:33 +00:00
|
|
|
# are up to date. The OS X test runs the objc conformance test, so skip it
|
|
|
|
# here.
|
|
|
|
# Note: travis has xctool installed, and we've looked at using it in the past
|
|
|
|
# but it has ended up proving unreliable (bugs), an they are removing build
|
|
|
|
# support in favor of xcbuild (or just xcodebuild).
|
2015-11-17 15:18:49 +00:00
|
|
|
objectivec/DevTools/full_mac_build.sh \
|
2016-05-24 15:27:33 +00:00
|
|
|
--core-only --skip-xcode-osx --skip-objc-conformance "$@"
|
2015-11-09 19:21:51 +00:00
|
|
|
}
|
|
|
|
|
2016-05-24 15:27:33 +00:00
|
|
|
build_objectivec_ios_debug() {
|
|
|
|
build_objectivec_ios --skip-xcode-release
|
2015-06-10 21:21:23 +00:00
|
|
|
}
|
|
|
|
|
2016-05-24 15:27:33 +00:00
|
|
|
build_objectivec_ios_release() {
|
|
|
|
build_objectivec_ios --skip-xcode-debug
|
2015-06-10 21:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_objectivec_osx() {
|
2016-05-24 15:27:33 +00:00
|
|
|
# Reused the build script that takes care of configuring and ensuring things
|
|
|
|
# are up to date.
|
|
|
|
objectivec/DevTools/full_mac_build.sh \
|
|
|
|
--core-only --skip-xcode-ios
|
2015-06-10 21:21:23 +00:00
|
|
|
}
|
2015-08-20 22:19:56 +00:00
|
|
|
|
2016-06-14 18:26:01 +00:00
|
|
|
build_objectivec_cocoapods_integration() {
|
|
|
|
# Update pod to the latest version.
|
|
|
|
gem install cocoapods --no-ri --no-rdoc
|
|
|
|
objectivec/Tests/CocoaPods/run_tests.sh
|
|
|
|
}
|
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
build_python() {
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp
|
2015-08-20 22:19:56 +00:00
|
|
|
internal_install_python_deps
|
2015-05-13 23:43:48 +00:00
|
|
|
cd python
|
2015-08-27 00:30:41 +00:00
|
|
|
# Only test Python 2.6/3.x on Linux
|
2015-08-21 22:51:47 +00:00
|
|
|
if [ $(uname -s) == "Linux" ]; then
|
2017-08-22 23:23:21 +00:00
|
|
|
envlist=py\{27,33,34,35,36\}-python
|
2015-08-21 22:51:47 +00:00
|
|
|
else
|
|
|
|
envlist=py27-python
|
|
|
|
fi
|
|
|
|
tox -e $envlist
|
2015-05-13 23:43:48 +00:00
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
|
|
|
build_python_cpp() {
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp
|
2015-08-20 22:19:56 +00:00
|
|
|
internal_install_python_deps
|
2016-09-30 00:07:47 +00:00
|
|
|
export LD_LIBRARY_PATH=../src/.libs # for Linux
|
|
|
|
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
|
2015-05-13 23:43:48 +00:00
|
|
|
cd python
|
2017-08-22 23:23:21 +00:00
|
|
|
# Only test Python 3.x on Linux
|
2015-08-21 22:51:47 +00:00
|
|
|
if [ $(uname -s) == "Linux" ]; then
|
2017-08-22 23:23:21 +00:00
|
|
|
envlist=py\{27,33,34,35,36\}-cpp
|
2015-08-21 22:51:47 +00:00
|
|
|
else
|
|
|
|
envlist=py27-cpp
|
|
|
|
fi
|
|
|
|
tox -e $envlist
|
2015-05-13 23:43:48 +00:00
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
2017-01-23 23:11:00 +00:00
|
|
|
build_python_compatibility() {
|
|
|
|
internal_build_cpp
|
|
|
|
# Use the unit-tests extraced from 2.5.0 to test the compatibilty.
|
|
|
|
cd python/compatibility_tests/v2.5.0
|
|
|
|
# Test between 2.5.0 and the current version.
|
|
|
|
./test.sh 2.5.0
|
|
|
|
# Test between 3.0.0-beta-1 and the current version.
|
|
|
|
./test.sh 3.0.0-beta-1
|
|
|
|
}
|
|
|
|
|
2015-05-13 23:43:48 +00:00
|
|
|
build_ruby21() {
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp # For conformance tests.
|
2015-05-13 23:43:48 +00:00
|
|
|
cd ruby && bash travis-test.sh ruby-2.1 && cd ..
|
|
|
|
}
|
|
|
|
build_ruby22() {
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp # For conformance tests.
|
2015-05-13 23:43:48 +00:00
|
|
|
cd ruby && bash travis-test.sh ruby-2.2 && cd ..
|
|
|
|
}
|
|
|
|
build_jruby() {
|
2015-07-15 18:05:10 +00:00
|
|
|
internal_build_cpp # For conformance tests.
|
2016-07-22 01:04:56 +00:00
|
|
|
# TODO(xiaofeng): Upgrade to jruby-9.x. There are some broken jests to be
|
|
|
|
# fixed.
|
|
|
|
cd ruby && bash travis-test.sh jruby-1.7 && cd ..
|
|
|
|
}
|
|
|
|
build_ruby_all() {
|
|
|
|
build_ruby21
|
|
|
|
build_ruby22
|
2016-12-08 22:39:20 +00:00
|
|
|
# TODO(teboring): Disable jruby test temperarily for it randomly fails.
|
|
|
|
# https://grpc-testing.appspot.com/job/protobuf_pull_request/735/consoleFull.
|
2016-12-09 00:27:56 +00:00
|
|
|
# build_jruby
|
2015-05-13 23:43:48 +00:00
|
|
|
}
|
|
|
|
|
2015-12-21 23:18:17 +00:00
|
|
|
build_javascript() {
|
|
|
|
internal_build_cpp
|
2015-12-28 14:43:42 +00:00
|
|
|
cd js && npm install && npm test && cd ..
|
2016-06-08 19:38:15 +00:00
|
|
|
cd conformance && make test_nodejs && cd ..
|
2015-12-21 23:18:17 +00:00
|
|
|
}
|
|
|
|
|
2016-12-08 19:16:49 +00:00
|
|
|
generate_php_test_proto() {
|
|
|
|
internal_build_cpp
|
|
|
|
pushd php/tests
|
|
|
|
# Generate test file
|
|
|
|
rm -rf generated
|
|
|
|
mkdir generated
|
2017-08-02 14:42:27 +00:00
|
|
|
../../src/protoc --php_out=generated \
|
|
|
|
proto/test.proto \
|
|
|
|
proto/test_include.proto \
|
|
|
|
proto/test_no_namespace.proto \
|
|
|
|
proto/test_prefix.proto \
|
|
|
|
proto/test_php_namespace.proto \
|
|
|
|
proto/test_empty_php_namespace.proto \
|
|
|
|
proto/test_service.proto \
|
|
|
|
proto/test_service_namespace.proto \
|
|
|
|
proto/test_descriptors.proto
|
2016-12-08 19:16:49 +00:00
|
|
|
pushd ../../src
|
|
|
|
./protoc --php_out=../php/tests/generated google/protobuf/empty.proto
|
2017-04-20 23:55:56 +00:00
|
|
|
./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
|
2016-12-08 19:16:49 +00:00
|
|
|
popd
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2016-09-30 19:07:33 +00:00
|
|
|
use_php() {
|
|
|
|
VERSION=$1
|
|
|
|
PHP=`which php`
|
|
|
|
PHP_CONFIG=`which php-config`
|
|
|
|
PHPIZE=`which phpize`
|
2017-04-19 23:23:51 +00:00
|
|
|
ln -sfn "/usr/local/php-${VERSION}/bin/php" $PHP
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}/bin/php-config" $PHP_CONFIG
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}/bin/phpize" $PHPIZE
|
2016-12-08 19:16:49 +00:00
|
|
|
generate_php_test_proto
|
2016-09-30 19:07:33 +00:00
|
|
|
}
|
|
|
|
|
2016-10-04 17:32:08 +00:00
|
|
|
use_php_zts() {
|
|
|
|
VERSION=$1
|
|
|
|
PHP=`which php`
|
|
|
|
PHP_CONFIG=`which php-config`
|
|
|
|
PHPIZE=`which phpize`
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-zts/bin/php" $PHP
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-zts/bin/php-config" $PHP_CONFIG
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-zts/bin/phpize" $PHPIZE
|
2016-12-08 19:16:49 +00:00
|
|
|
generate_php_test_proto
|
2016-10-04 17:32:08 +00:00
|
|
|
}
|
|
|
|
|
2016-10-26 00:27:05 +00:00
|
|
|
use_php_bc() {
|
|
|
|
VERSION=$1
|
|
|
|
PHP=`which php`
|
|
|
|
PHP_CONFIG=`which php-config`
|
|
|
|
PHPIZE=`which phpize`
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-bc/bin/php" $PHP
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-bc/bin/php-config" $PHP_CONFIG
|
|
|
|
ln -sfn "/usr/local/php-${VERSION}-bc/bin/phpize" $PHPIZE
|
2016-12-08 19:16:49 +00:00
|
|
|
generate_php_test_proto
|
2016-10-26 00:27:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 00:07:47 +00:00
|
|
|
build_php5.5() {
|
2017-04-19 23:23:51 +00:00
|
|
|
use_php 5.5
|
2017-03-08 22:31:34 +00:00
|
|
|
|
2016-12-08 22:39:20 +00:00
|
|
|
pushd php
|
2016-09-30 00:07:47 +00:00
|
|
|
rm -rf vendor
|
|
|
|
cp -r /usr/local/vendor-5.5 vendor
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
|
|
|
|
phpunit
|
2016-12-08 22:39:20 +00:00
|
|
|
popd
|
2017-02-01 20:47:58 +00:00
|
|
|
pushd conformance
|
2017-06-30 19:14:09 +00:00
|
|
|
make test_php
|
2017-02-01 20:47:58 +00:00
|
|
|
popd
|
2016-09-30 00:07:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 21:59:58 +00:00
|
|
|
build_php5.5_c() {
|
2017-04-19 23:23:51 +00:00
|
|
|
use_php 5.5
|
|
|
|
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
|
2017-06-30 19:14:09 +00:00
|
|
|
pushd php/tests
|
|
|
|
/bin/bash ./test.sh
|
2017-02-01 20:47:58 +00:00
|
|
|
popd
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
|
|
|
# make test_php_c
|
|
|
|
# popd
|
2016-10-03 21:59:58 +00:00
|
|
|
}
|
|
|
|
|
2016-10-04 17:32:08 +00:00
|
|
|
build_php5.5_zts_c() {
|
|
|
|
use_php_zts 5.5
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
|
2016-10-04 17:32:08 +00:00
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
|
|
|
# make test_php_zts_c
|
|
|
|
# popd
|
2016-11-10 19:20:50 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 00:07:47 +00:00
|
|
|
build_php5.6() {
|
2016-09-30 19:07:33 +00:00
|
|
|
use_php 5.6
|
2016-12-08 22:39:20 +00:00
|
|
|
pushd php
|
2016-09-30 00:07:47 +00:00
|
|
|
rm -rf vendor
|
|
|
|
cp -r /usr/local/vendor-5.6 vendor
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
|
|
|
|
phpunit
|
2016-12-08 22:39:20 +00:00
|
|
|
popd
|
2017-02-01 20:47:58 +00:00
|
|
|
pushd conformance
|
2017-06-30 19:14:09 +00:00
|
|
|
make test_php
|
2017-02-01 20:47:58 +00:00
|
|
|
popd
|
2016-09-30 00:07:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 21:59:58 +00:00
|
|
|
build_php5.6_c() {
|
|
|
|
use_php 5.6
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
|
2016-09-30 00:07:47 +00:00
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
2017-04-19 23:23:51 +00:00
|
|
|
# make test_php_c
|
2017-06-30 19:14:09 +00:00
|
|
|
# popd
|
2017-04-19 23:23:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_php5.6_zts_c() {
|
|
|
|
use_php_zts 5.6
|
|
|
|
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
|
|
|
# make test_php_zts_c
|
|
|
|
# popd
|
2016-09-30 00:07:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-06 01:28:13 +00:00
|
|
|
build_php5.6_mac() {
|
2016-12-08 19:16:49 +00:00
|
|
|
generate_php_test_proto
|
2016-10-06 01:28:13 +00:00
|
|
|
# Install PHP
|
|
|
|
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6
|
2016-11-08 19:38:34 +00:00
|
|
|
PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"` # The folder name may change upon time
|
|
|
|
export PATH="$PHP_FOLDER/bin:$PATH"
|
2016-10-06 01:28:13 +00:00
|
|
|
|
|
|
|
# Install phpunit
|
2017-02-07 18:55:48 +00:00
|
|
|
curl https://phar.phpunit.de/phpunit-5.6.10.phar -L -o phpunit.phar
|
2016-10-06 01:28:13 +00:00
|
|
|
chmod +x phpunit.phar
|
|
|
|
sudo mv phpunit.phar /usr/local/bin/phpunit
|
|
|
|
|
|
|
|
# Install valgrind
|
|
|
|
echo "#! /bin/bash" > valgrind
|
|
|
|
chmod ug+x valgrind
|
|
|
|
sudo mv valgrind /usr/local/bin/valgrind
|
|
|
|
|
|
|
|
# Test
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
2017-04-19 23:23:51 +00:00
|
|
|
# make test_php_c
|
2017-06-30 19:14:09 +00:00
|
|
|
# popd
|
2016-10-06 01:28:13 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 00:07:47 +00:00
|
|
|
build_php7.0() {
|
2016-09-30 19:07:33 +00:00
|
|
|
use_php 7.0
|
2016-12-08 22:39:20 +00:00
|
|
|
pushd php
|
2016-09-30 00:07:47 +00:00
|
|
|
rm -rf vendor
|
|
|
|
cp -r /usr/local/vendor-7.0 vendor
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
|
|
|
phpunit
|
2016-12-08 22:39:20 +00:00
|
|
|
popd
|
2017-02-01 20:47:58 +00:00
|
|
|
pushd conformance
|
2017-06-30 19:14:09 +00:00
|
|
|
make test_php
|
2017-02-01 20:47:58 +00:00
|
|
|
popd
|
2016-09-30 00:07:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 21:59:58 +00:00
|
|
|
build_php7.0_c() {
|
|
|
|
use_php 7.0
|
2017-04-19 23:23:51 +00:00
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
2016-10-03 21:59:58 +00:00
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
2017-04-19 23:23:51 +00:00
|
|
|
# make test_php_c
|
2017-06-30 19:14:09 +00:00
|
|
|
# popd
|
2017-04-19 23:23:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_php7.0_zts_c() {
|
|
|
|
use_php_zts 7.0
|
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back.
|
|
|
|
# pushd conformance
|
|
|
|
# make test_php_zts_c
|
|
|
|
# popd
|
2017-04-19 23:23:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_php7.0_mac() {
|
|
|
|
generate_php_test_proto
|
|
|
|
# Install PHP
|
|
|
|
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
|
|
|
|
PHP_FOLDER=`find /usr/local -type d -name "php7-7.0*"` # The folder name may change upon time
|
|
|
|
export PATH="$PHP_FOLDER/bin:$PATH"
|
|
|
|
|
|
|
|
# Install phpunit
|
|
|
|
curl https://phar.phpunit.de/phpunit-5.6.0.phar -L -o phpunit.phar
|
|
|
|
chmod +x phpunit.phar
|
|
|
|
sudo mv phpunit.phar /usr/local/bin/phpunit
|
|
|
|
|
|
|
|
# Install valgrind
|
|
|
|
echo "#! /bin/bash" > valgrind
|
|
|
|
chmod ug+x valgrind
|
|
|
|
sudo mv valgrind /usr/local/bin/valgrind
|
|
|
|
|
|
|
|
# Test
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
2017-06-30 19:14:09 +00:00
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# pushd conformance
|
2017-04-19 23:23:51 +00:00
|
|
|
# make test_php_c
|
2017-06-30 19:14:09 +00:00
|
|
|
# popd
|
2016-10-03 21:59:58 +00:00
|
|
|
}
|
|
|
|
|
2017-05-05 18:14:11 +00:00
|
|
|
build_php_compatibility() {
|
|
|
|
internal_build_cpp
|
|
|
|
php/tests/compatibility_test.sh
|
|
|
|
}
|
|
|
|
|
2017-05-10 22:59:59 +00:00
|
|
|
build_php7.1() {
|
|
|
|
use_php 7.1
|
|
|
|
pushd php
|
|
|
|
rm -rf vendor
|
|
|
|
cp -r /usr/local/vendor-7.1 vendor
|
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
|
|
|
phpunit
|
|
|
|
popd
|
|
|
|
pushd conformance
|
|
|
|
# TODO(teboring): Add it back
|
|
|
|
# make test_php
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
build_php7.1_c() {
|
|
|
|
use_php 7.1
|
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
|
|
|
pushd conformance
|
|
|
|
# make test_php_c
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
build_php7.1_zts_c() {
|
|
|
|
use_php_zts 7.1
|
|
|
|
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
|
|
|
|
cd php/tests && /bin/bash ./test.sh && cd ../..
|
|
|
|
pushd conformance
|
|
|
|
# make test_php_c
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2017-05-05 18:14:11 +00:00
|
|
|
build_php_all_32() {
|
2016-09-30 19:07:33 +00:00
|
|
|
build_php5.5
|
|
|
|
build_php5.6
|
|
|
|
build_php7.0
|
2017-05-10 22:59:59 +00:00
|
|
|
build_php7.1
|
2016-09-30 19:07:33 +00:00
|
|
|
build_php5.5_c
|
|
|
|
build_php5.6_c
|
2017-04-19 23:23:51 +00:00
|
|
|
build_php7.0_c
|
2017-05-10 22:59:59 +00:00
|
|
|
build_php7.1_c
|
2016-10-04 17:32:08 +00:00
|
|
|
build_php5.5_zts_c
|
2017-04-19 23:23:51 +00:00
|
|
|
build_php5.6_zts_c
|
|
|
|
build_php7.0_zts_c
|
2017-05-10 22:59:59 +00:00
|
|
|
build_php7.1_zts_c
|
2016-10-26 00:27:05 +00:00
|
|
|
}
|
|
|
|
|
2017-05-05 18:14:11 +00:00
|
|
|
build_php_all() {
|
|
|
|
build_php_all_32
|
|
|
|
build_php_compatibility
|
|
|
|
}
|
|
|
|
|
2016-02-19 04:10:23 +00:00
|
|
|
# Note: travis currently does not support testing more than one language so the
|
|
|
|
# .travis.yml cheats and claims to only be cpp. If they add multiple language
|
|
|
|
# support, this should probably get updated to install steps and/or
|
|
|
|
# rvm/gemfile/jdk/etc. entries rather than manually doing the work.
|
|
|
|
|
|
|
|
# .travis.yml uses matrix.exclude to block the cases where app-get can't be
|
|
|
|
# use to install things.
|
|
|
|
|
|
|
|
# -------- main --------
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "
|
|
|
|
Usage: $0 { cpp |
|
2016-07-20 00:20:31 +00:00
|
|
|
cpp_distcheck |
|
2016-02-19 04:10:23 +00:00
|
|
|
csharp |
|
|
|
|
java_jdk7 |
|
|
|
|
java_oracle7 |
|
2016-07-29 21:11:21 +00:00
|
|
|
java_compatibility |
|
2016-02-19 04:10:23 +00:00
|
|
|
javanano_jdk7 |
|
|
|
|
javanano_oracle7 |
|
|
|
|
objectivec_ios |
|
2016-05-24 15:27:33 +00:00
|
|
|
objectivec_ios_debug |
|
|
|
|
objectivec_ios_release |
|
2016-02-19 04:10:23 +00:00
|
|
|
objectivec_osx |
|
2016-06-14 18:26:01 +00:00
|
|
|
objectivec_cocoapods_integration |
|
2016-02-19 04:10:23 +00:00
|
|
|
python |
|
|
|
|
python_cpp |
|
2017-01-23 23:11:00 +00:00
|
|
|
python_compatibility |
|
2016-02-22 23:39:29 +00:00
|
|
|
ruby21 |
|
|
|
|
ruby22 |
|
2016-07-22 01:04:56 +00:00
|
|
|
jruby |
|
2016-09-30 00:07:47 +00:00
|
|
|
ruby_all |
|
|
|
|
php5.5 |
|
|
|
|
php5.5_c |
|
|
|
|
php5.6 |
|
|
|
|
php5.6_c |
|
|
|
|
php7.0 |
|
2016-09-30 19:07:33 +00:00
|
|
|
php7.0_c |
|
2017-05-05 18:14:11 +00:00
|
|
|
php_compatibility |
|
2017-05-10 22:59:59 +00:00
|
|
|
php7.1 |
|
|
|
|
php7.1_c |
|
2016-09-30 19:07:33 +00:00
|
|
|
php_all)
|
2016-02-19 04:10:23 +00:00
|
|
|
"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e # exit immediately on error
|
|
|
|
set -x # display all commands
|
|
|
|
eval "build_$1"
|