summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDafydd Harries <dafydd.harries@collabora.co.uk>2007-01-24 10:50:00 +0000
committerDafydd Harries <dafydd.harries@collabora.co.uk>2007-01-24 10:50:00 +0000
commit75cf9b118c6f66b6bed5bf1fd927528f9d2a0bbe (patch)
treefca6d46dfc021f19cfa0b03c961689f210d5791f
parent00d46b7bf7f86d8ef8be92e2cb61f7342b6977a7 (diff)
downloadlibnice-75cf9b118c6f66b6bed5bf1fd927528f9d2a0bbe.tar.gz
add makefile/script for generating lcov report
darcs-hash:20070124105053-c9803-38b34a6da597017d4640707adb574e00d5d14c44.gz
-rw-r--r--scripts/lcov.mk28
-rwxr-xr-xscripts/lcov.sh4
2 files changed, 32 insertions, 0 deletions
diff --git a/scripts/lcov.mk b/scripts/lcov.mk
new file mode 100644
index 0000000..d6b64c7
--- /dev/null
+++ b/scripts/lcov.mk
@@ -0,0 +1,28 @@
+
+# ccache breaks -fprofile-arcs
+export CCACHE_DISABLE=1
+
+OUT=lcov
+
+lcov-clean:
+ $(MAKE) clean
+ find -name "*.gcno" -o -name "*.gcda" -exec rm '{}' ';'
+ rm -rf $(OUT)
+
+lcov-build:
+ $(MAKE) CFLAGS="-O0 -fprofile-arcs -ftest-coverage" LDFLAGS="-lgcov" check
+
+lcov-report:
+ # hack: move gcov file from libraries back to source directory
+ for dir in `find -name .libs`; do \
+ (cd `dirname $$dir`; mv .libs/*.gc?? . || true) 2>/dev/null; \
+ done
+
+ mkdir -p $(OUT)
+ lcov -d . -c >$(OUT)/lcov.info 2>/dev/null
+ lcov -l $(OUT)/lcov.info 2>/dev/null |\
+ egrep '(^/usr|/test.*\.c)' |\
+ cut -d: -f1 >$(OUT)/lcov.remove
+ lcov -r $(OUT)/lcov.info `cat $(OUT)/lcov.remove` 2>/dev/null >$(OUT)/lcov.info.clean
+ genhtml -o lcov $(OUT)/lcov.info.clean
+
diff --git a/scripts/lcov.sh b/scripts/lcov.sh
new file mode 100755
index 0000000..4b56fbc
--- /dev/null
+++ b/scripts/lcov.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+make -f scripts/lcov.mk lcov-clean && \
+make -f scripts/lcov.mk lcov-build && \
+make -f scripts/lcov.mk lcov-report