Adds support for code coverage using lcov.

This commit is contained in:
Andrea Mazzoleni 2011-04-30 10:59:02 +02:00
parent 512dec9d68
commit a47e852059
2 changed files with 39 additions and 6 deletions

View file

@ -62,6 +62,9 @@ man_MANS = snapraid.1
clean-local:
rm -f valgrind.log callgrind.log cachegrind.log
rm -rf test
rm -f *.gcda *.gcno *.gcov
rm -rf cov
rm -f lcov.info
maintainer-clean-local:
rm -f snapraid.1 snapraid.txt
@ -278,7 +281,20 @@ cachegrind:
2> cachegrind.log
tail cachegrind.log
lcov_reset:
lcov --directory . -z
rm -f ./lcov.info
lcov_capture:
lcov --directory . --capture -o lcov.info
lcov_html:
rm -rf ./cov
mkdir cov
genhtml -o ./cov lcov.info
# Rules for documentation
if HAVE_ADVD2
snapraid.1 : snapraid.d
advd2 man < $(srcdir)/$< > $@

View file

@ -51,6 +51,13 @@ dnl Checks for compiler
AC_CHECK_CC_OPT([-Wall], CFLAGS="$CFLAGS -Wall", [])
AC_CHECK_CC_OPT([-Wextra], CFLAGS="$CFLAGS -Wextra", [])
dnl Checks for test environment
AS_CASE([$host],
[*-*-mingw*], [TESTENV="$WINE"],
[]
)
dnls Checks for options
AC_ARG_WITH([crypto],
[AS_HELP_STRING([--with-crypto],
[enable the use of the MD5 fast implementation of the OpenSSL crypto library])],
@ -64,13 +71,23 @@ AS_IF([test "x$with_crypto" != xno], [
])
])
dnl Checks for test environment
AS_CASE([$host],
[*-*-mingw*], [TESTENV="$WINE"],
[TESTENV="$VALGRIND"]
)
AC_ARG_VAR([TESTENV], [Test environment])
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],[enable the use of gcov for code coverage])],
[
TESTENV=""
CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
],
[])
AC_ARG_ENABLE([valgrind],
[AS_HELP_STRING([--enable-valgrind],[enable the use of valgrind in testing])],
[
TESTENV="$VALGRIND"
],
[])
AC_ARG_VAR([TESTENV], [Test environment])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT