aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2012-05-01 18:45:39 +0000
committerBlue Swirl <blauwirbel@gmail.com>2013-01-06 08:15:08 +0000
commit1d728c394652d40a9065668606d62f28bc544949 (patch)
tree6f6ef35d2942115f40e1b84ac1d548af74697e23 /configure
parent549db5c32bb025501e2eeb23d2e5cc669061eb71 (diff)
tests: add gcov support
Add support for compiling for GCOV test coverage, enabled with '--enable-gcov' during configure. Test coverage will be reported after each test. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure20
1 files changed, 19 insertions, 1 deletions
diff --git a/configure b/configure
index 837a84aff0..fe18ed2b25 100755
--- a/configure
+++ b/configure
@@ -176,6 +176,8 @@ strip_opt="yes"
tcg_interpreter="no"
bigendian="no"
mingw32="no"
+gcov="no"
+gcov_tool="gcov"
EXESUF=""
prefix="/usr/local"
mandir="\${prefix}/share/man"
@@ -600,6 +602,8 @@ for opt do
;;
--python=*) python="$optarg"
;;
+ --gcov=*) gcov_tool="$optarg"
+ ;;
--smbd=*) smbd="$optarg"
;;
--extra-cflags=*)
@@ -620,6 +624,8 @@ for opt do
;;
--enable-gprof) gprof="yes"
;;
+ --enable-gcov) gcov="yes"
+ ;;
--static)
static="yes"
LDFLAGS="-static $LDFLAGS"
@@ -1134,6 +1140,8 @@ echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
echo " gthread, ucontext, sigaltstack, windows"
echo " --enable-glusterfs enable GlusterFS backend"
echo " --disable-glusterfs disable GlusterFS backend"
+echo " --enable-gcov enable test coverage analysis with gcov"
+echo " --gcov=GCOV use specified gcov [$gcov_tool]"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -3120,10 +3128,14 @@ fi
# End of CC checks
# After here, no more $cc or $ld runs
-if test "$debug" = "no" ; then
+if test "$gcov" = "yes" ; then
+ CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
+ LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
+elif test "$debug" = "no" ; then
CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
fi
+
# Disable zero malloc errors for official releases unless explicitly told to
# enable/disable
if test -z "$zero_malloc" ; then
@@ -3305,6 +3317,8 @@ echo "seccomp support $seccomp"
echo "coroutine backend $coroutine_backend"
echo "GlusterFS support $glusterfs"
echo "virtio-blk-data-plane $virtio_blk_data_plane"
+echo "gcov $gcov_tool"
+echo "gcov enabled $gcov"
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -3738,6 +3752,10 @@ echo "EXESUF=$EXESUF" >> $config_host_mak
echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
echo "POD2MAN=$POD2MAN" >> $config_host_mak
echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
+if test "$gcov" = "yes" ; then
+ echo "CONFIG_GCOV=y" >> $config_host_mak
+ echo "GCOV=$gcov_tool" >> $config_host_mak
+fi
# generate list of library paths for linker script