summaryrefslogtreecommitdiff
path: root/common/coverage/lcov.mak
diff options
context:
space:
mode:
Diffstat (limited to 'common/coverage/lcov.mak')
-rw-r--r--common/coverage/lcov.mak43
1 files changed, 43 insertions, 0 deletions
diff --git a/common/coverage/lcov.mak b/common/coverage/lcov.mak
new file mode 100644
index 0000000..fc1f6b2
--- /dev/null
+++ b/common/coverage/lcov.mak
@@ -0,0 +1,43 @@
+## .PHONY so it always rebuilds it
+.PHONY: lcov-reset lcov lcov-run lcov-report lcov-upload
+
+# 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
+
+if GST_GCOV_ENABLED
+# reset run coverage tests
+lcov-run:
+ @-rm -rf lcov
+ lcov --directory . --zerocounters
+ -if test -d tests/check; then $(MAKE) -C tests/check inspect; fi
+ -$(MAKE) check
+
+# generate report based on current coverage data
+lcov-report:
+ mkdir lcov
+ lcov --compat-libtool --directory . --capture --output-file lcov/lcov.info
+ lcov --list-full-path -l lcov/lcov.info | grep -v "`cd $(top_srcdir) && pwd`" | cut -d\| -f1 > lcov/remove
+ lcov --list-full-path -l lcov/lcov.info | grep "tests/check/" | cut -d\| -f1 >> lcov/remove
+ lcov --list-full-path -l lcov/lcov.info | grep "docs/plugins/" | cut -d\| -f1 >> lcov/remove
+ lcov -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 --num-spaces 2 lcov/lcov.info
+
+lcov-upload: lcov
+ rsync -rvz -e ssh --delete lcov/* gstreamer.freedesktop.org:/srv/gstreamer.freedesktop.org/www/data/coverage/lcov/$(PACKAGE)
+
+else
+lcov-run:
+ echo "Need to reconfigure with --enable-gcov"
+
+lcov-report:
+ echo "Need to reconfigure with --enable-gcov"
+endif
+