aboutsummaryrefslogtreecommitdiff
path: root/tests.sh
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2017-04-19 16:23:51 -0700
committerGitHub <noreply@github.com>2017-04-19 16:23:51 -0700
commit190b5270c8717ca343db42da489e5e7d6d9efb2c (patch)
tree3815f20268bc56aac88267004149f9e4eb634223 /tests.sh
parent43234828da6ae3a3a3ada25d11488fdfd080b79c (diff)
downloadprotobuf-190b5270c8717ca343db42da489e5e7d6d9efb2c.tar.gz
protobuf-190b5270c8717ca343db42da489e5e7d6d9efb2c.tar.bz2
protobuf-190b5270c8717ca343db42da489e5e7d6d9efb2c.zip
Make PHP c extension work with PHP7 (#2951)
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh125
1 files changed, 65 insertions, 60 deletions
diff --git a/tests.sh b/tests.sh
index 68ba7cc7..8c56172d 100755
--- a/tests.sh
+++ b/tests.sh
@@ -371,12 +371,9 @@ use_php() {
PHP=`which php`
PHP_CONFIG=`which php-config`
PHPIZE=`which phpize`
- rm $PHP
- rm $PHP_CONFIG
- rm $PHPIZE
- cp "/usr/bin/php$VERSION" $PHP
- cp "/usr/bin/php-config$VERSION" $PHP_CONFIG
- cp "/usr/bin/phpize$VERSION" $PHPIZE
+ 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
generate_php_test_proto
}
@@ -403,18 +400,13 @@ use_php_bc() {
}
build_php5.5() {
- PHP=`which php`
- PHP_CONFIG=`which php-config`
- PHPIZE=`which phpize`
- ln -sfn "/usr/local/php-5.5/bin/php" $PHP
- ln -sfn "/usr/local/php-5.5/bin/php-config" $PHP_CONFIG
- ln -sfn "/usr/local/php-5.5/bin/phpize" $PHPIZE
- generate_php_test_proto
+ use_php 5.5
pushd php
rm -rf vendor
cp -r /usr/local/vendor-5.5 vendor
- ./vendor/bin/phpunit
+ wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
+ phpunit
popd
pushd conformance
# TODO(teboring): Add it back
@@ -423,51 +415,21 @@ build_php5.5() {
}
build_php5.5_c() {
- PHP=`which php`
- PHP_CONFIG=`which php-config`
- PHPIZE=`which phpize`
- ln -sfn "/usr/local/php-5.5/bin/php" $PHP
- ln -sfn "/usr/local/php-5.5/bin/php-config" $PHP_CONFIG
- ln -sfn "/usr/local/php-5.5/bin/phpize" $PHPIZE
- generate_php_test_proto
- wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit
-
+ use_php 5.5
+ wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
- make test_php_c
+ # make test_php_c
popd
}
build_php5.5_zts_c() {
use_php_zts 5.5
- wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit
+ wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
- make test_php_c
- popd
-}
-
-build_php5.5_32() {
- use_php_bc 5.5
- pushd php
- rm -rf vendor
- cp -r /usr/local/vendor-5.5 vendor
- ./vendor/bin/phpunit
- popd
- # TODO(teboring): Add conformance test.
- # pushd conformance
- # make test_php
- # popd
-}
-
-build_php5.5_c_32() {
- use_php_bc 5.5
- wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit
- cd php/tests && /bin/bash ./test.sh && cd ../..
- # TODO(teboring): Add conformance test.
- # pushd conformance
# make test_php_c
- # popd
+ popd
}
build_php5.6() {
@@ -475,7 +437,8 @@ build_php5.6() {
pushd php
rm -rf vendor
cp -r /usr/local/vendor-5.6 vendor
- ./vendor/bin/phpunit
+ wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
+ phpunit
popd
pushd conformance
# TODO(teboring): Add it back
@@ -485,9 +448,19 @@ build_php5.6() {
build_php5.6_c() {
use_php 5.6
+ wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
- make test_php_c
+ # make test_php_c
+ popd
+}
+
+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 ../..
+ pushd conformance
+ # make test_php_c
popd
}
@@ -511,7 +484,7 @@ build_php5.6_mac() {
# Test
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
- make test_php_c
+ # make test_php_c
popd
}
@@ -520,7 +493,8 @@ build_php7.0() {
pushd php
rm -rf vendor
cp -r /usr/local/vendor-7.0 vendor
- ./vendor/bin/phpunit
+ wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
+ phpunit
popd
pushd conformance
# TODO(teboring): Add it back
@@ -530,9 +504,43 @@ build_php7.0() {
build_php7.0_c() {
use_php 7.0
+ 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
+ # make test_php_c
+ popd
+}
+
+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 ../..
+ pushd conformance
+ # make test_php_c
+ popd
+}
+
+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 ../..
+ pushd conformance
+ # make test_php_c
popd
}
@@ -542,13 +550,10 @@ build_php_all() {
build_php7.0
build_php5.5_c
build_php5.6_c
- # build_php7.0_c
+ build_php7.0_c
build_php5.5_zts_c
-}
-
-build_php_all_32() {
- build_php5.5_32
- build_php5.5_c_32
+ build_php5.6_zts_c
+ build_php7.0_zts_c
}
# Note: travis currently does not support testing more than one language so the