test.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. VERSION=$1
  3. export PATH=/usr/local/php-$VERSION/bin:$PATH
  4. export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
  5. export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH
  6. # Compile c extension
  7. pushd ../ext/google/protobuf/
  8. make clean || true
  9. set -e
  10. # Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
  11. phpize && ./configure CFLAGS='-g -O0' && make
  12. popd
  13. tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service_test.php descriptors_test.php )
  14. for t in "${tests[@]}"
  15. do
  16. echo "****************************"
  17. echo "* $t"
  18. echo "****************************"
  19. # php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
  20. echo ""
  21. done
  22. # # Make sure to run the memory test in debug mode.
  23. # php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
  24. export ZEND_DONT_UNLOAD_MODULES=1
  25. export USE_ZEND_ALLOC=0
  26. valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
  27. # TODO(teboring): Only for debug (phpunit has memory leak which blocks this beging used by
  28. # regresssion test.)
  29. # for t in "${tests[@]}"
  30. # do
  31. # echo "****************************"
  32. # echo "* $t (memory leak)"
  33. # echo "****************************"
  34. # valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
  35. # echo ""
  36. # done