diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-07-09 12:37:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-07-10 15:22:16 -0400 |
commit | 17e9fc09c31dffdc647385220a14daef5a35273a (patch) | |
tree | 66b1a0ccb2e176bc2646a25cdd03fd6eb0d90435 /configure.ac | |
parent | a3e0a87d951b1323ca542c9b115d5525d0d022c9 (diff) | |
download | tor-17e9fc09c31dffdc647385220a14daef5a35273a.tar.gz tor-17e9fc09c31dffdc647385220a14daef5a35273a.zip |
Coverage support: build with --enable-coverage to have tests run with gcov
If you pass the --enable-coverage flag on the command line, we build
our testing binaries with appropriate options eo enable coverage
testing. We also build a "tor-cov" binary that has coverage enabled,
for integration tests.
On recent OSX versions, test coverage only works with clang, not gcc.
So we warn about that.
Also add a contrib/coverage script to actually run gcov with the
appropriate options to generate useful .gcov files. (Thanks to
automake, the .o files will not have the names that gcov expects to
find.)
Also, remove generated gcda and gcno files on clean.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 34ed524dd8..22aac31bf2 100644 --- a/configure.ac +++ b/configure.ac @@ -41,8 +41,13 @@ AC_ARG_ENABLE(curve25519, AS_HELP_STRING(--disable-curve25519, Build Tor with no curve25519 elliptic-curve crypto support)) AC_ARG_ENABLE(unittests, AS_HELP_STRING(--disable-unittests, [Don't build unit tests for Tor. Risky!])) +AC_ARG_ENABLE(coverage, + AS_HELP_STRING(--enable-coverage, [Enable coverage support in the unit-test build])) -AM_CONDITIONAL(UNITTESTS_ENABLED, test x$unittests != xno) +AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno) +AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes) + +echo "COVERAGE: $enable_coverage" if test "$enable_static_tor" = "yes"; then enable_static_libevent="yes"; @@ -1457,7 +1462,12 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy # CFLAGS="$CFLAGS -Winline" fi - +if test "$enable_coverage" = yes && test "$have_clang" = "no"; then + case "$host_os" in + darwin*) + AC_MSG_WARN([Tried to enable coverage on OSX without using the clang compiler. This might not work! If coverage fails, use CC=clang when configuring with --enable-profiling.]) + esac +fi CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib" |