diff options
Diffstat (limited to 'src/php/bin/run_tests.sh')
-rwxr-xr-x | src/php/bin/run_tests.sh | 30 |
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 |