configure.ac: set CFLAGS and friends to -O0 if gcov is being used add GCOV LIBS

Original commit message from CVS:
* configure.ac:
set CFLAGS and friends to -O0 if gcov is being used
add GCOV LIBS
* gst/Makefile.am:
* libs/gst/base/Makefile.am:
* libs/gst/check/Makefile.am:
* libs/gst/controller/Makefile.am:
* libs/gst/dataprotocol/Makefile.am:
* libs/gst/net/Makefile.am:
* plugins/elements/Makefile.am:
* plugins/indexers/Makefile.am:
add makefile rules to generate gcov data and clean up
* tests/check/Makefile.am:
add a coverage target that generates an html overview
of coverage data
This commit is contained in:
Thomas Vander Stichele 2006-07-01 23:26:06 +00:00
parent 12b7074822
commit 3c3bbc87d4
12 changed files with 141 additions and 6 deletions

View file

@ -1,3 +1,21 @@
2006-07-02 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:
set CFLAGS and friends to -O0 if gcov is being used
add GCOV LIBS
* gst/Makefile.am:
* libs/gst/base/Makefile.am:
* libs/gst/check/Makefile.am:
* libs/gst/controller/Makefile.am:
* libs/gst/dataprotocol/Makefile.am:
* libs/gst/net/Makefile.am:
* plugins/elements/Makefile.am:
* plugins/indexers/Makefile.am:
add makefile rules to generate gcov data and clean up
* tests/check/Makefile.am:
add a coverage target that generates an html overview
of coverage data
2006-07-01 Thomas Vander Stichele <thomas at apestaart dot org>
* tests/check/elements/fakesink.c:

2
common

@ -1 +1 @@
Subproject commit f4348ab157cc5e859f287e746004c0210880969a
Subproject commit 2cd1cf860cd15e61827c0f5f1db96f877344c722

View file

@ -436,6 +436,20 @@ if test "x$USE_DEBUG" = xyes; then
fi
AC_SUBST(PROFILE_CFLAGS)
dnl if gcov is used, we do not want default -O2 CFLAGS
if test "x$GST_GCOV_ENABLED" = "xyes"
then
CFLAGS="-O0"
AC_SUBST(CFLAGS)
CXXFLAGS="-O0"
AC_SUBST(CXXFLAGS)
FFLAGS="-O0"
AC_SUBST(FFLAGS)
CCASFLAGS="-O0"
AC_SUBST(CCASFLAGS)
AC_MSG_NOTICE([gcov enabled, setting CFLAGS and friends to $CFLAGS])
fi
DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
AC_SUBST(DEPRECATED_CFLAGS)
@ -454,7 +468,7 @@ dnl from LibXML except for in the core library
GST_ALL_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir) -I\$(top_builddir) $GLIB_CFLAGS $XML_CFLAGS \$(GST_OPTION_CFLAGS)"
dnl FIXME: check if LTLIBINTL is needed everywhere
dnl I presume it is given that it contains the symbols that _() stuff maps to
GST_ALL_LIBS="$GLIB_LIBS $LTLIBINTL"
GST_ALL_LIBS="$GLIB_LIBS $LTLIBINTL \$(GCOV_LIBS)"
dnl LDFLAGS really should only contain flags, not libs - they get added before
dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
GST_ALL_LDFLAGS="-no-undefined"

View file

@ -69,7 +69,6 @@ EXTRA_libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gstmarshal.list gstxml.c gstparse.c gsttrace.c gstregistryxml.c
libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
glib-compat.c \
gst.c \
gstobject.c \
gstbin.c \
@ -123,7 +122,7 @@ BUILT_SOURCES = \
$(built_header_make) \
$(built_source_make)
# CLEANFILES is for files generated by make
CLEANFILES = $(built_header_make) $(built_source_make) $(as_dll_cleanfiles)
CLEANFILES = $(built_header_make) $(built_source_make) $(as_dll_cleanfiles) *.gcno *.gcda *.gcov *.gcov.out
# DISTCLEANFILES is for files generated by configure
DISTCLEANFILES = $(built_header_configure)
@ -147,6 +146,7 @@ libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINO
gst_headers = \
gst.h \
glib-compat.c \
glib-compat.h \
gstobject.h \
gstbin.h \
@ -234,3 +234,8 @@ gstenumtypes.c: $(gst_headers)
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n *id = g_@type@_register_static (\"@EnumName@\", values);\n}\nGType\n@enum_name@_get_type (void)\n{\n static GType id;\n static GOnce once = G_ONCE_INIT;\n\n g_once (&once, (GThreadFunc)register_@enum_name@, &id);\n return id;\n}\n" \
$^ > gstenumtypes.c
%.c.gcov: .libs/libgstreamer_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstreamer_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -2,14 +2,14 @@ lib_LTLIBRARIES = libgstbase-@GST_MAJORMINOR@.la
libgstbase_@GST_MAJORMINOR@_la_DEPENDENCIES = \
$(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la
libgstbase_@GST_MAJORMINOR@_la_SOURCES = \
libgstbase_@GST_MAJORMINOR@_la_SOURCES = \
gstadapter.c \
gstbasesink.c \
gstbasesrc.c \
gstbasetransform.c \
gstcollectpads.c \
gstpushsrc.c \
gsttypefindhelper.c
gsttypefindhelper.c
libgstbase_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstbase_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS)
@ -27,3 +27,9 @@ libgstbase_@GST_MAJORMINOR@include_HEADERS = \
gstpushsrc.h \
gsttypefindhelper.h
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstbase_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstbase_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -16,3 +16,10 @@ libgstcheck_@GST_MAJORMINOR@includedir = \
libgstcheck_@GST_MAJORMINOR@include_HEADERS = \
gstcheck.h
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstcheck_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstcheck_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -14,3 +14,10 @@ libgstcontroller_@GST_MAJORMINOR@_la_SOURCES = \
libgstcontroller_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstcontroller_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS)
libgstcontroller_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstcontroller_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstcontroller_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -12,3 +12,9 @@ libgstdataprotocol_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstdataprotocol_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS)
libgstdataprotocol_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstdataprotocol_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstdataprotocol_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -16,3 +16,9 @@ libgstnet_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstnet_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS)
libgstnet_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstnet_@GST_MAJORMINOR@_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstnet_@GST_MAJORMINOR@_la_SOURCES:=.gcov)

View file

@ -51,3 +51,11 @@ noinst_HEADERS = \
EXTRA_DIST = gstfdsrc.c \
gstfdsink.c
CLEANFILES = *.gcno *.gcda *.gcov
%.c.gcov: .libs/libgstcoreelements_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstcoreelements_la_SOURCES:=.gcov)

View file

@ -19,3 +19,8 @@ libgstcoreindexers_la_SOURCES = gstindexers.c gstmemindex.c $(GST_LOADSAVE_SRC)
libgstcoreindexers_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstcoreindexers_la_LIBADD = $(GST_OBJ_LIBS) $(GST_FILEINDEX_LIBS)
libgstcoreindexers_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
%.c.gcov: .libs/libgstcoreindexers_la-%.gcda %.c
$(GCOV) -b -f -o $^ > $@.out
gcov: $(libgstcoreindexers_la_SOURCES:=.gcov)

View file

@ -150,3 +150,56 @@ VALGRIND_TESTS_DISABLE = \
$(TESTS_THREADED) \
$(VALGRIND_IGNORE) \
$(VALGRIND_TO_FIX)
# indexers does not get tested yet
COVERAGE_DIRS = \
gst \
libs/gst/base \
libs/gst/controller \
libs/gst/check \
libs/gst/dataprotocol \
libs/gst/net \
plugins/elements
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
coverage:
for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done
make check
make coverage-report
else
coverage:
echo "You need to configure with --enable-gcov to get coverage data"
exit 1
endif
coverage-report:
rm -r coverage
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