aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/bin
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2015-06-16 17:33:34 -0700
committerGravatar Stanley Cheung <stanleycheung@google.com>2015-06-18 09:50:22 -0700
commitcb14eab39569d43c1451a1287d7f73b3dfbc5817 (patch)
tree37a575ab8e58ff35f3333a3de4c71bf8a46841c8 /src/php/bin
parent4ec433741a0b163dd8d6ccf8452ebd37d3e16245 (diff)
Add package.xml and necessary files for pecl extension
Diffstat (limited to 'src/php/bin')
-rwxr-xr-xsrc/php/bin/run_tests.sh30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh
index 551be12514..422757bb44 100755
--- a/src/php/bin/run_tests.sh
+++ b/src/php/bin/run_tests.sh
@@ -34,15 +34,31 @@ set -e
cd $(dirname $0)
default_extension_dir=`php -i | grep extension_dir | sed 's/.*=> //g'`
-module_dir=../ext/grpc/modules
+if command -v brew >/dev/null && [ -d `brew --prefix`/opt/grpc-php ]
+then
+ # homebrew and the grpc-php formula are installed
+ extension_dir="-d extension_dir="`brew --prefix`/opt/grpc-php
+elif [ ! -e $default_extension_dir/grpc.so ]
+then
+ # the grpc extension is not found in the default PHP extension dir
+ # try the source modules directory
+ module_dir=../ext/grpc/modules
+ if [ ! -d $module_dir ]
+ then
+ echo "Please run 'phpize && ./configure && make' from ext/grpc first"
+ exit 1
+ fi
-# sym-link in system supplied extensions
-for f in $default_extension_dir/*.so
-do
- ln -s $f $module_dir/$(basename $f) &> /dev/null || true
-done
+ # sym-link in system supplied extensions
+ for f in $default_extension_dir/*.so
+ do
+ ln -s $f $module_dir/$(basename $f) &> /dev/null || true
+ done
+
+ extension_dir='-d extension_dir='$module_dir
+fi
php \
- -d extension_dir=$module_dir \
+ $extension_dir \
-d extension=grpc.so \
`which phpunit` -v --debug --strict ../tests/unit_tests