@@ -4,6 +4,12 @@ IMG=${IMG:-mod_proxy_cluster-testsuite-tomcat}
44HTTPD_IMG=${HTTPD_IMG:- mod_proxy_cluster-testsuite-httpd}
55MPC_NAME=${MPC_NAME:- httpd-mod_proxy_cluster}
66
7+ if [ $CODE_COVERAGE ]; then
8+ MPC_CFLAGS=" $MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -g -O0"
9+ MPC_LDFLAGS=" $MPC_LDFLAGS -lgcov"
10+ HTTPD_EXTRA_FLAGS=" $HTTPD_EXTRA_FLAGS --enable-debugger-mode"
11+ fi
12+
713# Runs a test file ($1) under given name ($2, if given)
814run_test () {
915 local ret=0
@@ -23,13 +29,26 @@ run_test() {
2329 echo " NOK"
2430 ret=1
2531 fi
32+
33+ local httpd_cont=$( docker ps -a | grep $HTTPD_IMG | cut -f 1 -d' ' )
2634 # preserve httpd's logs too if DEBUG
2735 if [ $DEBUG ]; then
28- local httpd_cont=$( docker ps -a | grep $HTTPD_IMG | cut -f 1 -d' ' )
29- docker logs $httpd_cont > " logs/${2:- $1 } -httpd.log" 2>&1
36+ docker logs ${httpd_cont} > " logs/${2:- $1 } -httpd.log" 2>&1
3037 docker cp ${httpd_cont} :/usr/local/apache2/logs/access_log " logs/${2:- $1 } -httpd_access.log" 2> /dev/null || true
3138 fi
3239
40+ if [ $CODE_COVERAGE ]; then
41+ docker exec ${httpd_cont} /usr/local/apache2/bin/apachectl stop
42+ # preserve the coverage files
43+ # docker has problems with names containing spaces
44+ f=$( echo ${2:- 1} | sed ' s/ /-/g' )
45+ docker exec ${httpd_cont} sh -c " cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f .json"
46+
47+ for f in $( docker exec ${httpd_cont} ls /coverage/) ; do
48+ docker cp -q ${httpd_cont} :/coverage/$f $PWD /coverage/$f
49+ done
50+ fi
51+
3352 # Clean all after run
3453 httpd_remove > /dev/null 2>&1
3554 tomcat_all_remove > /dev/null 2>&1
0 commit comments