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