Simplified PHP testing scripts. (#7574)

* Simplified PHP testing scripts.

- allow them to be run from any directory.
- remove "VERSION" arg, we can get PHP from $PATH.

* Added a few places I missed.

* Removed redundant "cd `dirname $0`".

Also replaced all backticks with $(), for consistency.
pull/7631/head
Joshua Haberman 5 years ago committed by GitHub
parent 1688ea8d60
commit 2cc68efd56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      php/tests/compatibility_test.sh
  2. 13
      php/tests/compile_extension.sh
  3. 4
      php/tests/gdb_test.sh
  4. 8
      php/tests/multirequest.sh
  5. 7
      php/tests/test.sh
  6. 94
      tests.sh

@ -1,12 +1,5 @@
#!/bin/bash
function use_php() {
VERSION=$1
OLD_PATH=$PATH
export PATH=/usr/local/php-${VERSION}/bin:$OLD_PATH
}
function generate_proto() {
PROTOC1=$1
PROTOC2=$2
@ -87,7 +80,6 @@ git checkout v$OLD_VERSION
popd
# Build and copy the new runtime
use_php 7.1
pushd ../ext/google/protobuf
make clean || true
phpize && ./configure && make

@ -1,12 +1,17 @@
#!/bin/bash
VERSION=$2
cd $(dirname $0)
export PATH=/usr/local/php-$VERSION/bin:$PATH
if [ "$1" = "--release"]; then
CFLAGS="-Wall"
else
# To get debugging symbols in PHP itself, build PHP with:
# $ ./configure --enable-debug CFLAGS='-g -O0'
CFLAGS="-g -O0 -Wall"
fi
pushd ../ext/google/protobuf
make clean || true
set -e
# Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
phpize && ./configure --with-php-config=`which php-config` CFLAGS='-g -O0 -Wall' && make
phpize && ./configure --with-php-config=$(which php-config) CFLAGS="$CFLAGS" && make
popd

@ -1,9 +1,5 @@
#!/bin/bash
VERSION=$1
export PATH=/usr/local/php-$VERSION/bin:$PATH
php -i | grep "Configuration"
# gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which

@ -1,12 +1,12 @@
#!/bin/bash
cd $(dirname $0)
set -e
# Compile c extension
VERSION=7.4
PORT=12345
export PATH=/usr/local/php-$VERSION/bin:$PATH
/bin/bash ./compile_extension.sh $VERSION
./compile_extension.sh
nohup php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so -S localhost:$PORT multirequest.php 2>&1 &

@ -1,11 +1,8 @@
#!/bin/bash
VERSION=$1
cd $(dirname $0)
export PATH=/usr/local/php-$VERSION/bin:$PATH
# Compile c extension
/bin/bash ./compile_extension.sh $VERSION
./compile_extension.sh
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php descriptors_test.php wrapper_type_setters_test.php)

@ -501,12 +501,6 @@ use_php_zts() {
generate_php_test_proto
}
use_php_bc() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}-bc/bin:$PATH
generate_php_test_proto
}
build_php5.5() {
use_php 5.5
@ -523,9 +517,7 @@ build_php5.5() {
build_php5.5_c() {
IS_64BIT=$1
use_php 5.5
pushd php/tests
/bin/bash ./test.sh 5.5
popd
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -541,9 +533,7 @@ build_php5.5_mixed() {
pushd php
rm -rf vendor
composer update
pushd tests
/bin/bash ./compile_extension.sh 5.5
popd
tests/compile_extension.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@ -551,7 +541,7 @@ build_php5.5_mixed() {
build_php5.5_zts_c() {
IS_64BIT=$1
use_php_zts 5.5
cd php/tests && /bin/bash ./test.sh 5.5-zts && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -577,7 +567,7 @@ build_php5.6() {
build_php5.6_c() {
IS_64BIT=$1
use_php 5.6
cd php/tests && /bin/bash ./test.sh 5.6 && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -593,9 +583,7 @@ build_php5.6_mixed() {
pushd php
rm -rf vendor
composer update
pushd tests
/bin/bash ./compile_extension.sh 5.6
popd
tests/compile_extension.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@ -603,7 +591,7 @@ build_php5.6_mixed() {
build_php5.6_zts_c() {
IS_64BIT=$1
use_php_zts 5.6
cd php/tests && /bin/bash ./test.sh 5.6-zts && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -633,10 +621,8 @@ build_php5.6_mac() {
sudo mv valgrind /usr/local/bin/valgrind
# Test
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
make test_php_c
popd
php/tests/test.sh
(cd conformance && make test_php_c)
}
build_php7.0() {
@ -646,15 +632,13 @@ build_php7.0() {
composer update
./vendor/bin/phpunit
popd
pushd conformance
make test_php
popd
(cd conformance && make test_php)
}
build_php7.0_c() {
IS_64BIT=$1
use_php 7.0
cd php/tests && /bin/bash ./test.sh 7.0 && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -670,9 +654,7 @@ build_php7.0_mixed() {
pushd php
rm -rf vendor
composer update
pushd tests
/bin/bash ./compile_extension.sh 7.0
popd
tests/compile_extension.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@ -680,7 +662,7 @@ build_php7.0_mixed() {
build_php7.0_zts_c() {
IS_64BIT=$1
use_php_zts 7.0
cd php/tests && /bin/bash ./test.sh 7.0-zts && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -710,10 +692,8 @@ build_php7.0_mac() {
sudo mv valgrind /usr/local/bin/valgrind
# Test
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
make test_php_c
popd
php/tests/test.sh
(cd conformance && make test_php_c)
}
build_php7.3_mac() {
@ -737,10 +717,8 @@ build_php7.3_mac() {
sudo mv valgrind /usr/local/bin/valgrind
# Test
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
make test_php_c
popd
php/tests/test.sh
(cd conformance && make test_php_c)
}
build_php_compatibility() {
@ -750,9 +728,7 @@ build_php_compatibility() {
build_php_multirequest() {
use_php 7.4
pushd php/tests
./multirequest.sh
popd
php/tests/multirequest.sh
}
build_php7.1() {
@ -762,15 +738,13 @@ build_php7.1() {
composer update
./vendor/bin/phpunit
popd
pushd conformance
make test_php
popd
(cd conformance && make test_php)
}
build_php7.1_c() {
IS_64BIT=$1
use_php 7.1
cd php/tests && /bin/bash ./test.sh 7.1 && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -786,9 +760,7 @@ build_php7.1_mixed() {
pushd php
rm -rf vendor
composer update
pushd tests
/bin/bash ./compile_extension.sh 7.1
popd
tests/compile_extension.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@ -796,7 +768,7 @@ build_php7.1_mixed() {
build_php7.1_zts_c() {
IS_64BIT=$1
use_php_zts 7.1
cd php/tests && /bin/bash ./test.sh 7.1-zts && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -814,15 +786,13 @@ build_php7.4() {
composer update
./vendor/bin/phpunit
popd
pushd conformance
make test_php
popd
(cd conformance && make test_php)
}
build_php7.4_c() {
IS_64BIT=$1
use_php 7.4
cd php/tests && /bin/bash ./test.sh 7.4 && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -831,9 +801,7 @@ build_php7.4_c() {
make test_php_c_32
fi
popd
pushd php/ext/google/protobuf
phpize --clean
popd
(cd php/ext/google/protobuf && phpize --clean)
}
build_php7.4_mixed() {
@ -841,20 +809,16 @@ build_php7.4_mixed() {
pushd php
rm -rf vendor
composer update
pushd tests
/bin/bash ./compile_extension.sh 7.4
popd
tests/compile_extension.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
pushd php/ext/google/protobuf
phpize --clean
popd
(cd php/ext/google/protobuf && phpize --clean)
}
build_php7.4_zts_c() {
IS_64BIT=$1
use_php_zts 7.4
cd php/tests && /bin/bash ./test.sh 7.4-zts && cd ../..
php/tests/test.sh
pushd conformance
if [ "$IS_64BIT" = "true" ]
then
@ -863,9 +827,7 @@ build_php7.4_zts_c() {
make test_php_c_32
fi
popd
pushd php/ext/google/protobuf
phpize --clean
popd
(cd php/ext/google/protobuf && phpize --clean)
}
build_php_all_32() {

Loading…
Cancel
Save