summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2010-01-04 14:53:03 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2010-01-13 17:15:06 +0000
commit948db40c875f8eb7032582a32515737be6587067 (patch)
treeaabcb441cc6a21466f69e521eb7c0c326fcf921c /build
parent5322546a4e2100bcec8aba651f8de7d849d67711 (diff)
downloadclutter-948db40c875f8eb7032582a32515737be6587067.tar.gz
Add gcov support to the build
Using gcov it's possible to get a coverage report, that is a break down of how much the exposed API is exercised by the conformance test suite.
Diffstat (limited to 'build')
-rw-r--r--build/autotools/Makefile.am1
-rw-r--r--build/autotools/Makefile.am.gcov33
2 files changed, 34 insertions, 0 deletions
diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am
index bbdcf8955..663c3edf3 100644
--- a/build/autotools/Makefile.am
+++ b/build/autotools/Makefile.am
@@ -5,6 +5,7 @@ EXTRA_DIST = \
Makefile.am.marshal \
Makefile.am.enums \
Makefile.am.changelog \
+ Makefile.am.gcov \
dolt.m4 \
introspection.m4 \
gtk-doc.m4 \
diff --git a/build/autotools/Makefile.am.gcov b/build/autotools/Makefile.am.gcov
new file mode 100644
index 000000000..a16edbd76
--- /dev/null
+++ b/build/autotools/Makefile.am.gcov
@@ -0,0 +1,33 @@
+if GCOV_ENABLED
+gcov-report.txt: gcov-clean
+ $(QUIET_GEN)(rm -f $@; \
+ echo -e "Test coverage for Clutter:\n" >> $@; \
+ total_covered=0; total_actual=0; \
+ for file in $(filter %.c,$(gcov_sources)); do \
+ gcov -o .libs/$${file/.c/.gcda} $$file > /dev/null; \
+ if test -f $$file.gcov; then \
+ actual=`grep -v ' -:' $$file.gcov | wc -l`; \
+ uncovered=`grep '#####:' $$file.gcov | wc -l`; \
+ covered=$$((actual - uncovered)); \
+ total_covered=$$((total_covered + covered)); \
+ total_actual=$$((total_actual + actual)); \
+ echo -e "$$file: \t$$covered / $$actual\t($$((($$covered * 100) / $$actual))%)"; \
+ fi \
+ done >> $@; \
+ cd $(abs_srcdir); \
+ echo -e "\nSource lines: $$total_actual\nCovered statements: $$total_covered\nTotal coverage: $$((($$total_covered * 100) / $$total_actual))%" >> $@)
+
+gcov: gcov-report.txt
+ @echo ""; cat gcov-report.txt
+gcov-clean:
+ @find . -name "*.gcda" -o -name "*.gcov" -delete
+else
+gcov-report.txt:
+ @true
+gcov-clean:
+ @true
+gcov:
+ @echo "Need to reconfigure with --enable-gcov"
+endif # GCOV_ENABLED
+
+.PHONY: gcov gcov-clean gcov-report.txt