run_tests.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. # Loads the local shared library, and runs all of the test cases in tests/
  16. # against it
  17. set -ex
  18. cd $(dirname $0)/../../..
  19. root=$(pwd)
  20. cd src/php/bin
  21. source ./determine_extension_dir.sh
  22. # in some jenkins macos machine, somehow the PHP build script can't find libgrpc.dylib
  23. export DYLD_LIBRARY_PATH=$root/libs/$CONFIG
  24. $(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \
  25. --exclude-group persistent_list_bound_tests ../tests/unit_tests
  26. for arg in "$@"
  27. do
  28. if [[ "$arg" == "--skip-persistent-channel-tests" ]]; then
  29. SKIP_PERSISTENT_CHANNEL_TESTS=true
  30. break
  31. fi
  32. done
  33. if [[ "$SKIP_PERSISTENT_CHANNEL_TESTS" != "true" ]]; then
  34. $(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \
  35. ../tests/unit_tests/PersistentChannelTests
  36. fi
  37. export ZEND_DONT_UNLOAD_MODULES=1
  38. export USE_ZEND_ALLOC=0
  39. # Detect whether valgrind is executable
  40. if [ -x "$(command -v valgrind)" ]; then
  41. $(which valgrind) --error-exitcode=10 --leak-check=yes \
  42. $(which php) $extension_dir -d max_execution_time=300 \
  43. ../tests/MemoryLeakTest/MemoryLeakTest.php
  44. fi