usefulness extraordinaire.

could probably use some more polishing, but seems to work ok.

i'd like if people started using this, especially people who use lots 
of eye candy, dock, clip, whatever (which is mostly everyone but me 
and gilbert ;), and make their reports available.

muchos gracias to sir raorn for the autoconf bit.

>From 3be3804726e6146b784ecbbbbc8c9c356279ffa8 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Wed, 29 Sep 2010 17:15:55 +0200
Subject: [PATCH] Add LCOV support to generate coverage information

How to use:

- Install LCOV (http://ltp.sourceforge.net/coverage/lcov.php)
- AFAICT, compiler must be GCC.
- ./configure --prefix=/some/path --enable-lcov=/var/www

  This will configure the sources so that generated coverage information
  (HTML pages) will end up in /var/www/coverage-report. Choose a directory
  you have write access to.

- make

  No installation necessary (although it probably doesn't hurt to have
  WM installed in ${prefix} so it can find resources and stuff, but the
  build tree must be kept intact anyway).

- Put ${srcroot}/src, ${srcroot}/WPrefs.app and ${srcroot}/util first in
  your path.
- Arrange for your .xinitrc or DM to start ${srcroot}/src/wmaker as your
  window manager.
- Use it as you normally would, possibly for an extended period of time.
- make coverage.

  This will create a tree of web pages under /var/www/coverage-report

- Further `make coverage's (after some more use) will re-generate the
  report (deleting the directory first).

- `make coverage-reset' will reset execution counts to zero (see lcov(1)).

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 Makefile.am  |   14 ++++++++++++++
 configure.ac |   18 ++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8f7b6b0..07a0dbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,3 +10,17 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N FAQ.I18N.cs 
FAQ.I18N.sk \
        The-perfect-Window-Maker-patch.txt \
        README.es README.pt COPYING.WTFPL autogen.sh
 
+if USE_LCOV
+coverage-reset:
+       find . -type f -name '*.gcda' -exec rm -f '{}' ';'
+       lcov --directory . --zerocounters
+
+coverage:
+       rm -rf coverage @lcov_output_directory@
+       -mkdir -p coverage @lcov_output_directory@
+       lcov --compat-libtool --capture --directory . --output-file 
coverage/coverage.info
+       genhtml --output-directory @lcov_output_directory@ 
coverage/coverage.info
+
+.PHONY:        coverage-reset coverage
+endif
+
diff --git a/configure.ac b/configure.ac
index 89bde42..5cce996 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,6 +155,24 @@ AS_IF([test "x$with_boehm_gc" = "xyes"],
     )
 )
 
+dnl LCOV
+dnl ====
+AC_ARG_ENABLE([lcov],
+    [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data 
generation using LCOV (GCC only) [default=no]])],
+    [],
+    [enable_lcov=no])
+
+AS_IF([test "x$enable_lcov" != "xno"],
+    [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
+    if test "x$enable_lcov" = "xyes"; then
+        lcov_output_directory="coverage-report"
+    else
+        lcov_output_directory="${enable_lcov}/coverage-report"
+    fi
+    AC_SUBST(lcov_output_directory)]
+)
+AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
+
 dnl
 dnl ============================
 dnl Checks for library functions
-- 
1.7.0.4


-- 
[-]

mkdir /nonexistent
From 3be3804726e6146b784ecbbbbc8c9c356279ffa8 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Wed, 29 Sep 2010 17:15:55 +0200
Subject: [PATCH] Add LCOV support to generate coverage information

How to use:

- Install LCOV (http://ltp.sourceforge.net/coverage/lcov.php)
- AFAICT, compiler must be GCC.
- ./configure --prefix=/some/path --enable-lcov=/var/www

  This will configure the sources so that generated coverage information
  (HTML pages) will end up in /var/www/coverage-report. Choose a directory
  you have write access to.

- make

  No installation necessary (although it probably doesn't hurt to have
  WM installed in ${prefix} so it can find resources and stuff, but the
  build tree must be kept intact anyway).

- Put ${srcroot}/src, ${srcroot}/WPrefs.app and ${srcroot}/util first in
  your path.
- Arrange for your .xinitrc or DM to start ${srcroot}/src/wmaker as your
  window manager.
- Use it as you normally would, possibly for an extended period of time.
- make coverage.

  This will create a tree of web pages under /var/www/coverage-report

- Further `make coverage's (after some more use) will re-generate the
  report (deleting the directory first).

- `make coverage-reset' will reset execution counts to zero (see lcov(1)).

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 Makefile.am  |   14 ++++++++++++++
 configure.ac |   18 ++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8f7b6b0..07a0dbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,3 +10,17 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N FAQ.I18N.cs FAQ.I18N.sk \
 	The-perfect-Window-Maker-patch.txt \
 	README.es README.pt COPYING.WTFPL autogen.sh
 
+if USE_LCOV
+coverage-reset:
+	find . -type f -name '*.gcda' -exec rm -f '{}' ';'
+	lcov --directory . --zerocounters
+
+coverage:
+	rm -rf coverage @lcov_output_directory@
+	-mkdir -p coverage @lcov_output_directory@
+	lcov --compat-libtool --capture --directory . --output-file coverage/coverage.info
+	genhtml --output-directory @lcov_output_directory@ coverage/coverage.info
+
+.PHONY:	coverage-reset coverage
+endif
+
diff --git a/configure.ac b/configure.ac
index 89bde42..5cce996 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,6 +155,24 @@ AS_IF([test "x$with_boehm_gc" = "xyes"],
     )
 )
 
+dnl LCOV
+dnl ====
+AC_ARG_ENABLE([lcov],
+    [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
+    [],
+    [enable_lcov=no])
+
+AS_IF([test "x$enable_lcov" != "xno"],
+    [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
+    if test "x$enable_lcov" = "xyes"; then
+        lcov_output_directory="coverage-report"
+    else
+        lcov_output_directory="${enable_lcov}/coverage-report"
+    fi
+    AC_SUBST(lcov_output_directory)]
+)
+AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
+
 dnl
 dnl ============================
 dnl Checks for library functions
-- 
1.7.0.4

Reply via email to