diff --git a/docs/libs/Makefile.am b/docs/libs/Makefile.am index 962c00738d..6eed2fabe9 100644 --- a/docs/libs/Makefile.am +++ b/docs/libs/Makefile.am @@ -64,10 +64,10 @@ extra_files = # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # contains GtkObjects/GObjects and you want to document signals and properties. GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_CFLAGS) $(GIO_CFLAGS) + $(GST_CFLAGS) $(GIO_CFLAGS) $(GCOV_CFLAGS) GTKDOC_LIBS = \ $(top_builddir)/ges/libges-@GST_API_VERSION@.la \ - $(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) + $(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(GCOV_LIBS) GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC) GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC) diff --git a/ges/Makefile.am b/ges/Makefile.am index 162a635d93..4d53b65576 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -5,7 +5,7 @@ lib_LTLIBRARIES = libges-@GST_API_VERSION@.la EXTRA_libges_@GST_API_VERSION@_la_SOURCES = gesmarshal.list -CLEANFILES = $(BUILT_SOURCES) $(built_header_make) $(built_source_make) +CLEANFILES = $(BUILT_SOURCES) $(built_header_make) $(built_source_make) *.gcno *.gcda *.gcov *.gcov.out libges_@GST_API_VERSION@_la_SOURCES = \ $(built_source_make) \ @@ -200,6 +200,11 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) endif +%.c.gcov: .libs/libges_@GST_API_VERSION@_la-%.gcda %.c + $(GCOV) -b -f -o $^ > $@.out + +gcov: $(libges_@GST_API_VERSION@_la_SOURCES:=.gcov) + Android.mk: Makefile.am $(BUILT_SOURCES) androgenizer -:PROJECT libges -:SHARED libges-@GST_API_VERSION@ \ -:TAGS eng debug \ diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 0ecf7e05c1..5da0ac793d 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -8,7 +8,7 @@ plugindir = $(libdir)/gstreamer-@GST_API_VERSION@ install-pluginLTLIBRARIES: # the core dumps of some machines have PIDs appended -CLEANFILES = core.* test-registry.* +CLEANFILES = core.* test-registry.* *.gcno *.gcda common_cflags=-I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_OBJ_CFLAGS) \ $(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) $(GST_CFLAGS) @@ -54,3 +54,51 @@ EXTRA_DIST = \ ges/test-project.xges \ ges/audio_only.ogg \ ges/audio_video.ogg + +COVERAGE_DIRS = \ + ges +COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) +COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES)) +COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out)) +COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES)) + +debug: + echo $(COVERAGE_FILES) + echo $(COVERAGE_FILES_REL) + +.PHONY: coverage +if GST_GCOV_ENABLED +# we rebuild a registry and do gst-inspect so that all the get/set codepaths +# are also covered +coverage: + make check + make coverage-report +else +coverage: + echo "You need to configure with --enable-gcov to get coverage data" + exit 1 +endif + +coverage-report: + if test ! -e coverage; then + rm -r coverage + fi + for dir in $(COVERAGE_DIRS); do \ + mkdir -p coverage/$$dir; \ + make -C $(top_builddir)/$$dir gcov; \ + done + for dir in $(COVERAGE_DIRS); do \ + files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ + if test ! -z "$$files"; then \ + perl $(top_srcdir)/common/coverage/coverage-report.pl \ + $(top_builddir)/$$dir/*.gcov.out > \ + coverage/$$dir/index.xml; \ + xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl \ + coverage/$$dir/index.xml > coverage/$$dir/index.html; \ + fi; \ + done + for file in $(COVERAGE_FILES_REL); do \ + echo Generating coverage/$$file.html; \ + perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \ + $(top_builddir)/$$file > coverage/$$file.html; \ + done