diff options
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 103 |
1 files changed, 71 insertions, 32 deletions
@@ -44,6 +44,30 @@ build_cpp() { build_cpp_distcheck() { ./autogen.sh ./configure + make dist + + # List all files that should be included in the distribution package. + git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|cmake\|examples\)" |\ + grep -v ".gitignore" | grep -v "java/compatibility_tests" > dist.lst + # 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++. make distcheck -j2 } @@ -57,15 +81,27 @@ build_csharp() { if [ "$TRAVIS" == "true" ]; then # Install latest version of Mono sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551 echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list - echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list sudo apt-get update -qq sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit - wget www.nuget.org/NuGet.exe -O nuget.exe - NUGET=../../nuget.exe + + # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. + sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' + sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 + sudo apt-get update -qq + sudo apt-get install -qq dotnet-dev-1.0.0-preview2-003121 fi - (cd csharp/src; mono $NUGET restore) + # 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. + mkdir dotnettmp + (cd dotnettmp; dotnet new > /dev/null) + rm -rf dotnettmp + + (cd csharp/src; dotnet restore) csharp/buildall.sh cd conformance && make test_csharp && cd .. } @@ -77,10 +113,12 @@ build_golang() { export PATH="`pwd`/src:$PATH" # Install Go and the Go protobuf compiler plugin. - sudo apt-get update -qq - sudo apt-get install -qq golang + on_travis sudo apt-get update -qq + on_travis sudo apt-get install -qq golang + export GOPATH="$HOME/gocode" mkdir -p "$GOPATH/src/github.com/google" + rm -f "$GOPATH/src/github.com/google/protobuf" ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" export PATH="$GOPATH/bin:$PATH" go get github.com/golang/protobuf/protoc-gen-go @@ -91,13 +129,10 @@ build_golang() { use_java() { version=$1 case "$version" in - jdk6) - on_travis sudo apt-get install openjdk-6-jdk - export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin:$PATH - ;; jdk7) on_travis sudo apt-get install openjdk-7-jdk export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH + export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ;; oracle7) if [ "$TRAVIS" == "true" ]; then @@ -108,6 +143,7 @@ use_java() { yes | sudo apt-get install oracle-java7-installer fi; export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH + export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ;; esac @@ -118,6 +154,7 @@ use_java() { which java java -version + $MVN -version } # --batch-mode supresses download progress output that spams the logs. @@ -150,10 +187,6 @@ build_javanano() { cd javanano && $MVN test && cd .. } -build_java_jdk6() { - use_java jdk6 - build_java jdk6 -} build_java_jdk7() { use_java jdk7 build_java_with_conformance_tests @@ -162,11 +195,15 @@ build_java_oracle7() { use_java oracle7 build_java oracle7 } - -build_javanano_jdk6() { - use_java jdk6 - build_javanano +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 } + build_javanano_jdk7() { use_java jdk7 build_javanano @@ -226,6 +263,10 @@ build_objectivec_osx() { build_objectivec_cocoapods_integration() { # First, load the RVM environment in bash, needed to update ruby. source ~/.rvm/scripts/rvm + # Update rvm to the latest version. This is needed to solve + # https://github.com/google/protobuf/issues/1786 and may not be needed in the + # future when Travis updates the default version of rvm. + rvm get head # Update ruby to 2.2.3 as the default one crashes with segmentation faults # when using pod. rvm use 2.2.3 --install --binary --fuzzy @@ -265,14 +306,6 @@ build_python_cpp() { cd .. } -build_ruby19() { - internal_build_cpp # For conformance tests. - cd ruby && bash travis-test.sh ruby-1.9 && cd .. -} -build_ruby20() { - internal_build_cpp # For conformance tests. - cd ruby && bash travis-test.sh ruby-2.0 && cd .. -} build_ruby21() { internal_build_cpp # For conformance tests. cd ruby && bash travis-test.sh ruby-2.1 && cd .. @@ -283,7 +316,14 @@ build_ruby22() { } build_jruby() { internal_build_cpp # For conformance tests. - cd ruby && bash travis-test.sh jruby && cd .. + # 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 + build_jruby } build_javascript() { @@ -304,11 +344,11 @@ build_javascript() { if [ "$#" -ne 1 ]; then echo " Usage: $0 { cpp | + cpp_distcheck | csharp | - java_jdk6 | java_jdk7 | java_oracle7 | - javanano_jdk6 | + java_compatibility | javanano_jdk7 | javanano_oracle7 | objectivec_ios | @@ -318,11 +358,10 @@ Usage: $0 { cpp | objectivec_cocoapods_integration | python | python_cpp | - ruby19 | - ruby20 | ruby21 | ruby22 | - jruby } + jruby | + ruby_all) " exit 1 fi |