From 24195b9c873cc6622b746d7e9d120ebd29914d6f Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Fri, 27 May 2011 17:37:43 -0700 Subject: [PATCH] configure: add option for building with gcov coverage support Signed-off-by: Josh Durgin --- .gitignore | 2 ++ configure.ac | 7 +++++++ src/Makefile.am | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 43bd2d80efb08..73a9ea05dfa93 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ *.dsc *.changes ./config.* +*.gcda +*.gcov *.gcno .deps web/*.html diff --git a/configure.ac b/configure.ac index 552fb913a95ed..3d32d1ceab674 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,13 @@ AM_CONDITIONAL(WITH_DEBUG, test "$with_debug" = "yes") AC_DEFINE([DEBUG_GATHER], [1], [Define if you want C_Gather debugging]) +# code coverage? +AC_ARG_ENABLE([coverage], + [AS_HELP_STRING([--enable-coverage], [enable code coverage tracking])], + [], + [enable_coverage=no]) +AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" != xno) + # radosgw? AC_ARG_WITH([radosgw], [AS_HELP_STRING([--with-radosgw], [build RADOS gateway])], diff --git a/src/Makefile.am b/src/Makefile.am index 12b804d09dd83..17756b779b43e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -503,6 +503,11 @@ if WITH_LIBATOMIC AM_LDFLAGS += -latomic_ops endif +if ENABLE_COVERAGE +AM_CFLAGS += -fprofile-arcs -ftest-coverage +AM_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0 +EXTRALIBS += -lgcov +endif noinst_LIBRARIES = \ libcommon.a \ -- 2.39.5