| 1 |
#!/bin/bash |
| 2 |
# Copyright 2015 gRPC authors. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
# you may not use this file except in compliance with the License. |
| 6 |
# You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
# Loads the local shared library, and runs all of the test cases in tests/ |
| 17 |
# against it |
| 18 |
set -ex |
| 19 |
cd $(dirname $0)/../../.. |
| 20 |
root=$(pwd) |
| 21 |
cd src/php/bin |
| 22 |
source ./determine_extension_dir.sh |
| 23 |
# in some jenkins macos machine, somehow the PHP build script can't find libgrpc.dylib |
| 24 |
export DYLD_LIBRARY_PATH=$root/libs/$CONFIG |
| 25 |
$(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ |
| 26 |
--exclude-group persistent_list_bound_tests ../tests/unit_tests |
| 27 |
|
| 28 |
for arg in "$@" |
| 29 |
do |
| 30 |
if [[ "$arg" == "--skip-persistent-channel-tests" ]]; then |
| 31 |
SKIP_PERSISTENT_CHANNEL_TESTS=true |
| 32 |
elif [[ "$arg" == "--ignore-valgrind-undef-errors" ]]; then |
| 33 |
VALGRIND_UNDEF_VALUE_ERRORS="--undef-value-errors=no" |
| 34 |
fi |
| 35 |
done |
| 36 |
|
| 37 |
if [[ "$SKIP_PERSISTENT_CHANNEL_TESTS" != "true" ]]; then |
| 38 |
$(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ |
| 39 |
../tests/unit_tests/PersistentChannelTests |
| 40 |
fi |
| 41 |
|
| 42 |
export ZEND_DONT_UNLOAD_MODULES=1 |
| 43 |
export USE_ZEND_ALLOC=0 |
| 44 |
# Detect whether valgrind is executable |
| 45 |
if [ -x "$(command -v valgrind)" ]; then |
| 46 |
# skip the memory leak test on ARM64 |
| 47 |
# TODO(jtattermusch): reenable the test once https://github.com/grpc/grpc/issues/29098 is fixed. |
| 48 |
if [ "$(uname -m)" != "aarch64" ]; then |
| 49 |
$(which valgrind) --error-exitcode=10 --leak-check=yes \ |
| 50 |
-v \ |
| 51 |
--num-callers=30 \ |
| 52 |
--suppressions=../tests/MemoryLeakTest/ignore_leaks.supp \ |
| 53 |
$VALGRIND_UNDEF_VALUE_ERRORS \ |
| 54 |
$(which php) $extension_dir -d max_execution_time=300 \ |
| 55 |
../tests/MemoryLeakTest/MemoryLeakTest.php |
| 56 |
fi |
| 57 |
fi |
| 58 |
|