-
Notifications
You must be signed in to change notification settings - Fork 5
/
run-tests.sh
executable file
·65 lines (62 loc) · 1.98 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
if [ -z $TEST_PHP_EXECUTABLE ]; then
export TEST_PHP_EXECUTABLE=`which php`
fi
#if [ -z $TEST_PHP_CGI_EXECUTABLE ]; then
# export TEST_PHP_CGI_EXECUTABLE=`which php-cgi`
#fi
case $1 in
normal)
phpize
./configure
make clean all
make test
;;
coverage)
phpize
./configure CFLAGS="--coverage -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage"
make clean all
lcov --directory . --zerocounters
lcov --directory . --capture --compat-libtool --initial --output-file coverage.info
$TEST_PHP_EXECUTABLE run-tests.php -d extension=modules/request.so -n ./tests/
lcov --no-checksum --directory . --capture --compat-libtool --output-file coverage.info
lcov --remove coverage.info "/usr*" \
--remove coverage.info "*/.phpenv/*" \
--remove coverage.info "/home/travis/build/include/*" \
--compat-libtool --output-file coverage.info
genhtml coverage.info --output-directory reports
;;
valgrind)
phpize
./configure
make clean all
make test TEST_PHP_ARGS=-m
;;
after_success)
lcov --no-checksum --directory . --capture --compat-libtool --output-file coverage.info
lcov --remove coverage.info "/usr*" --remove coverage.info "*/.phpenv/*" --remove coverage.info "/home/travis/build/include/*" --compat-libtool --output-file coverage.info
coveralls-lcov coverage.info
;;
after_failure)
for i in `find tests -name "*.out" 2>/dev/null`; do
echo "-- START ${i}";
cat $i;
printf "\n";
echo "-- END";
done
for i in `find tests -name "*.mem" 2>/dev/null`; do
echo "-- START ${i}";
cat $i;
printf "\n";
echo "-- END";
done
# get backtrace for coredumps
COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
if [[ -f "$COREFILE" ]]; then
gdb -c "$COREFILE" $(phpenv which php) -ex "thread apply all bt" -ex "set pagination 0" -batch
fi
;;
esac