summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorEmanuele Aina <em@nerd.ocracy.org>2007-06-24 21:57:11 +0000
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-05-15 16:28:28 +0100
commit6b058337d0aa472495a62e1f95ed40cf47952912 (patch)
tree0ab8cb0dde27a9a8ce04356fddc8f47363b185f0 /rules
parentdfcb0b2b8ca9704b6d6e571f18c4da7eeaaf38b2 (diff)
Add coverage and valgrind support for tests
Diffstat (limited to 'rules')
-rw-r--r--rules/lcov.mak25
1 files changed, 25 insertions, 0 deletions
diff --git a/rules/lcov.mak b/rules/lcov.mak
new file mode 100644
index 0000000..b428b82
--- /dev/null
+++ b/rules/lcov.mak
@@ -0,0 +1,25 @@
+# run lcov from scratch, always
+lcov-reset:
+ make lcov-run
+ make lcov-report
+
+# run lcov from scratch if the dir is not there
+lcov:
+ make lcov-reset
+
+# reset run coverage tests
+lcov-run:
+ @-rm -rf lcov
+ @-find . -name "*.gcda" -exec rm {} \;
+ -make check
+
+# generate report based on current coverage data
+lcov-report:
+ mkdir lcov
+ $(LCOV_PATH) --compat-libtool --directory . --capture --output-file lcov/lcov.info
+ $(LCOV_PATH) --compat-libtool -l lcov/lcov.info | grep -v "`cd $(top_srcdir) && pwd`" | cut -d: -f1 > lcov/remove
+ $(LCOV_PATH) --compat-libtool -l lcov/lcov.info | grep "tests/" | cut -d: -f1 >> lcov/remove
+ $(LCOV_PATH) --compat-libtool -r lcov/lcov.info `cat lcov/remove` > lcov/lcov.cleaned.info
+ rm lcov/remove
+ mv lcov/lcov.cleaned.info lcov/lcov.info
+ genhtml -t "$(PACKAGE_STRING)" -o lcov lcov/lcov.info