subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1416646 - in /subversion/trunk: Makefile.in configure.ac tools/dev/gcov.patch
Date Mon, 03 Dec 2012 19:43:33 GMT
Author: julianfoad
Date: Mon Dec  3 19:43:32 2012
New Revision: 1416646

URL: http://svn.apache.org/viewvc?rev=1416646&view=rev
Log:
Add build-time options to enable 'Gcov' code-coverage reports.

This requires GCC, gcov, and lcov (which includes the 'genhtml' tool).  In
my rather limited testing this requires the configure options:

 --enable-gcov --disable-shared --without-gnome-keyring

and works with the javahl, ctypes-python, and swig-pl bindings but not with
the other Swig bindings.

* configure.ac
  (gcov): New option: --enable-gcov.

* Makefile.in
  (gcov, gcov-reset, gcov-clean): New targets.
  (check-clean): Also clean the coverage files here, since coverage reports
    are associated with testing more than anything else.

* tools/dev/gcov.patch
  Delete this old version of this patch.

Removed:
    subversion/trunk/tools/dev/gcov.patch
Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/configure.ac

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1416646&r1=1416645&r2=1416646&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Mon Dec  3 19:43:32 2012
@@ -572,7 +572,23 @@ svnsshcheck: bin $(TEST_DEPS) @BDB_TEST_
 bdbcheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@
 	@$(MAKE) check FS_TYPE=bdb
 
-check-clean:
+# Create an execution coverage report from the data collected during
+# all execution since the last reset.
+gcov:
+	lcov --capture -d . -b . -o gcov-lcov.dat > gcov-lcov.log
+	genhtml gcov-lcov.dat -o gcov-report > gcov-genhtml.log
+
+# Reset all execution coverage counters to zero.
+gcov-reset:
+	lcov --zerocounters -d .
+
+# Remove the execution coverage data and the report.
+gcov-clean:
+	rm -f gcov-lcov.dat gcov-lcov.log gcov-genhtml.log
+	rm -rf gcov-report
+	find . -name "*.gcda" -o -name "*.gcno" -print0 | xargs -0 rm -f
+
+check-clean: gcov-clean
 	rm -rf subversion/tests/cmdline/svn-test-work          \
 	       subversion/tests/libsvn_fs/test-repo-*          \
 	       subversion/tests/libsvn_fs_base/test-repo-*     \

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1416646&r1=1416645&r2=1416646&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Mon Dec  3 19:43:32 2012
@@ -1112,6 +1112,30 @@ AC_SUBST(MOD_ACTIVATION)
 
 
 
+AC_ARG_ENABLE(gcov,
+AC_HELP_STRING([--enable-gcov],
+               [Turn on gcov coverage testing (GCC only).]),
+[
+    if test "$enableval" = "yes" ; then
+      dnl Probably other compilers support something similar;
+      dnl feel free to extend this to include them.
+      if test "$GCC" = "yes"; then
+        if test "$svn_enable_shared" = "yes" ; then
+          AC_MSG_ERROR([Can't have --enable-gcov without --disable-shared (we
+                        recommend also using --enable-all-static).])
+        fi
+        if test ! "$enable_all_static" = "yes" ; then
+          AC_MSG_WARN(We recommend --enable-all-static with --enable-gcov.)
+        fi
+        AC_MSG_NOTICE([Enabling gcov coverage testing.])
+        CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+        CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
+      else
+        AC_MSG_ERROR([We only support --enable-gcov with GCC right now.])
+      fi
+    fi
+])
+
 AC_ARG_ENABLE(gprof,
 AS_HELP_STRING([--enable-gprof],
                [Produce gprof profiling data in 'gmon.out' (GCC only).]),



Mime
View raw message