blob: 700dd295cc39362eb64a793a15f3dbbe8c18f3d5 [file] [log] [blame]
Austin Schuh40c16522018-10-28 20:27:54 -07001#!/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
10pushd ../ext/google/protobuf/
11make clean || true
12set -e
13# Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
14phpize && ./configure CFLAGS='-g -O0' && make
15popd
16
17tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php descriptors_test.php )
18
19for t in "${tests[@]}"
20do
21 echo "****************************"
22 echo "* $t"
23 echo "****************************"
24 php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
25 echo ""
26done
27
28# # Make sure to run the memory test in debug mode.
29# php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
30
31export ZEND_DONT_UNLOAD_MODULES=1
32export USE_ZEND_ALLOC=0
33valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
34
35# TODO(teboring): Only for debug (phpunit has memory leak which blocks this beging used by
36# regresssion test.)
37
38# for t in "${tests[@]}"
39# do
40# echo "****************************"
41# echo "* $t (memory leak)"
42# echo "****************************"
43# valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
44# echo ""
45# done