Browse Source

Add php test script for automated tests.

Bo Yang 9 years ago
parent
commit
fd332d146d
1 changed files with 59 additions and 5 deletions
  1. 59 5
      tests.sh

+ 59 - 5
tests.sh

@@ -35,9 +35,7 @@ internal_build_cpp() {
 build_cpp() {
 build_cpp() {
   internal_build_cpp
   internal_build_cpp
   make check -j2
   make check -j2
-  pushd conformance
-  make test_cpp
-  popd
+  cd conformance && make test_cpp && cd ..
 
 
   # Verify benchmarking code can build successfully.
   # Verify benchmarking code can build successfully.
   git submodule init
   git submodule init
@@ -52,7 +50,7 @@ build_cpp_distcheck() {
   make dist
   make dist
 
 
   # List all files that should be included in the distribution package.
   # List all files that should be included in the distribution package.
-  git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\)" |\
+  git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|cmake\|examples\)" |\
       grep -v ".gitignore" | grep -v "java/compatibility_tests" > dist.lst
       grep -v ".gitignore" | grep -v "java/compatibility_tests" > dist.lst
   # Unzip the dist tar file.
   # Unzip the dist tar file.
   DIST=`ls *.tar.gz`
   DIST=`ls *.tar.gz`
@@ -297,6 +295,8 @@ build_python() {
 build_python_cpp() {
 build_python_cpp() {
   internal_build_cpp
   internal_build_cpp
   internal_install_python_deps
   internal_install_python_deps
+  export LD_LIBRARY_PATH=../src/.libs # for Linux
+  export DYLD_LIBRARY_PATH=../src/.libs # for OS X
   cd python
   cd python
   # Only test Python 2.6/3.x on Linux
   # Only test Python 2.6/3.x on Linux
   if [ $(uname -s) == "Linux" ]; then
   if [ $(uname -s) == "Linux" ]; then
@@ -334,6 +334,54 @@ build_javascript() {
   cd js && npm install && npm test && cd ..
   cd js && npm install && npm test && cd ..
 }
 }
 
 
+build_php5.5_c() {
+  ln -sfn /usr/bin/php5.5 /usr/bin/php
+  ln -sfn /usr/bin/php-config5.5 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize5.5 /usr/bin/phpize
+  cd php/tests && /bin/bash ./test.sh && cd ../..
+}
+
+build_php5.5() {
+  ln -sfn /usr/bin/php5.5 /usr/bin/php
+  ln -sfn /usr/bin/php-config5.5 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize5.5 /usr/bin/phpize
+  rm -rf vendor
+  cp -r /usr/local/vendor-5.5 vendor
+  ./vendor/bin/phpunit
+}
+
+build_php5.6_c() {
+  ln -sfn /usr/bin/php5.6 /usr/bin/php
+  ln -sfn /usr/bin/php-config5.6 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize5.6 /usr/bin/phpize
+  cd php/tests && /bin/bash ./test.sh && cd ../..
+}
+
+build_php5.6() {
+  ln -sfn /usr/bin/php5.6 /usr/bin/php
+  ln -sfn /usr/bin/php-config5.6 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize5.6 /usr/bin/phpize
+  rm -rf vendor
+  cp -r /usr/local/vendor-5.6 vendor
+  ./vendor/bin/phpunit
+}
+
+build_php7.0_c() {
+  ln -sfn /usr/bin/php7.0 /usr/bin/php
+  ln -sfn /usr/bin/php-config7.0 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize7.0 /usr/bin/phpize
+  cd php/tests && /bin/bash ./test.sh && cd ../..
+}
+
+build_php7.0() {
+  ln -sfn /usr/bin/php7.0 /usr/bin/php
+  ln -sfn /usr/bin/php-config7.0 /usr/bin/php-config
+  ln -sfn /usr/bin/phpize7.0 /usr/bin/phpize
+  rm -rf vendor
+  cp -r /usr/local/vendor-7.0 vendor
+  ./vendor/bin/phpunit
+}
+
 # Note: travis currently does not support testing more than one language so the
 # 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
 # .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
 # support, this should probably get updated to install steps and/or
@@ -364,7 +412,13 @@ Usage: $0 { cpp |
             ruby21 |
             ruby21 |
             ruby22 |
             ruby22 |
             jruby |
             jruby |
-            ruby_all)
+            ruby_all |
+            php5.5   |
+            php5.5_c |
+            php5.6   |
+            php5.6_c |
+            php7.0   |
+            php7.0_c)
 "
 "
   exit 1
   exit 1
 fi
 fi