1#!/bin/bash 2 3cd $(dirname $0) 4 5set -ex 6 7PORT=12345 8TIMEOUT=10 9 10./compile_extension.sh 11 12run_test() { 13 echo 14 echo "Running memory leak test, args: $@" 15 16 EXTRA_ARGS="" 17 ARGS="-d xdebug.profiler_enable=0 -d display_errors=on -dextension=../ext/google/protobuf/modules/protobuf.so" 18 19 for i in "$@"; do 20 case $i in 21 --keep_descriptors) 22 EXTRA_ARGS=-dprotobuf.keep_descriptor_pool_after_request=1 23 shift 24 ;; 25 esac 26 done 27 28 export ZEND_DONT_UNLOAD_MODULES=1 29 export USE_ZEND_ALLOC=0 30 31 if valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all --suppressions=valgrind.supp --num-callers=100 php $ARGS $EXTRA_ARGS memory_leak_test.php; then 32 echo "Memory leak test SUCCEEDED" 33 else 34 echo "Memory leak test FAILED" 35 exit 1 36 fi 37} 38 39run_test 40run_test --keep_descriptors 41