Allow checking code coverage

This commit is contained in:
Thibault Saunier 2012-12-24 09:29:04 -03:00
parent 67da662276
commit 9f63e6514a
3 changed files with 57 additions and 4 deletions

View file

@ -64,10 +64,10 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties. # contains GtkObjects/GObjects and you want to document signals and properties.
GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_BASE_CFLAGS) \ GTKDOC_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) $(GIO_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS) $(GCOV_CFLAGS)
GTKDOC_LIBS = \ GTKDOC_LIBS = \
$(top_builddir)/ges/libges-@GST_API_VERSION@.la \ $(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_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC) GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC)

View file

@ -5,7 +5,7 @@ lib_LTLIBRARIES = libges-@GST_API_VERSION@.la
EXTRA_libges_@GST_API_VERSION@_la_SOURCES = gesmarshal.list 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 = \ libges_@GST_API_VERSION@_la_SOURCES = \
$(built_source_make) \ $(built_source_make) \
@ -200,6 +200,11 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif 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) Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer -:PROJECT libges -:SHARED libges-@GST_API_VERSION@ \ androgenizer -:PROJECT libges -:SHARED libges-@GST_API_VERSION@ \
-:TAGS eng debug \ -:TAGS eng debug \

View file

@ -8,7 +8,7 @@ plugindir = $(libdir)/gstreamer-@GST_API_VERSION@
install-pluginLTLIBRARIES: install-pluginLTLIBRARIES:
# the core dumps of some machines have PIDs appended # 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) \ common_cflags=-I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_OBJ_CFLAGS) \
$(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) $(GST_CFLAGS) $(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) $(GST_CFLAGS)
@ -54,3 +54,51 @@ EXTRA_DIST = \
ges/test-project.xges \ ges/test-project.xges \
ges/audio_only.ogg \ ges/audio_only.ogg \
ges/audio_video.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