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 18set -ex 19cd $(dirname $0)/../../.. 20root=$(pwd) 21cd src/php/bin 22source ./determine_extension_dir.sh 23# in some jenkins macos machine, somehow the PHP build script can't find libgrpc.dylib 24export 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 28for arg in "$@" 29do 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 35done 36 37if [[ "$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 40fi 41 42export ZEND_DONT_UNLOAD_MODULES=1 43export USE_ZEND_ALLOC=0 44# Detect whether valgrind is executable 45if [ -x "$(command -v valgrind)" ]; then 46 $(which valgrind) --error-exitcode=10 --leak-check=yes \ 47 $VALGRIND_UNDEF_VALUE_ERRORS \ 48 $(which php) $extension_dir -d max_execution_time=300 \ 49 ../tests/MemoryLeakTest/MemoryLeakTest.php 50fi 51