aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-09 12:37:11 -0400
committerNick Mathewson <nickm@torproject.org>2013-07-10 15:22:16 -0400
commit17e9fc09c31dffdc647385220a14daef5a35273a (patch)
tree66b1a0ccb2e176bc2646a25cdd03fd6eb0d90435 /contrib
parenta3e0a87d951b1323ca542c9b115d5525d0d022c9 (diff)
downloadtor-17e9fc09c31dffdc647385220a14daef5a35273a.tar
tor-17e9fc09c31dffdc647385220a14daef5a35273a.tar.gz
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 'contrib')
-rwxr-xr-xcontrib/coverage13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/coverage b/contrib/coverage
new file mode 100755
index 000000000..52fe96d75
--- /dev/null
+++ b/contrib/coverage
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Copyright 2013 The Tor Project, Inc.
+# See LICENSE for licensing information.
+
+# coverage -- run gcov on the appropriate set of object files to extract
+# coverage information.
+
+for fn in src/{or,common}/*.c; do
+ BN=`basename $fn`
+ DN=`dirname $fn`
+ F=`echo $BN | sed -e 's/\.c$//;'`
+ gcov -o $DN/src_*$F.o $fn
+done