From 3c3bbc87d4b5b52e36638ded199c18f52a30bb5b Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 1 Jul 2006 23:26:06 +0000 Subject: [PATCH] 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 --- ChangeLog | 18 +++++++++++ common | 2 +- configure.ac | 16 +++++++++- gst/Makefile.am | 9 ++++-- libs/gst/base/Makefile.am | 10 ++++-- libs/gst/check/Makefile.am | 7 ++++ libs/gst/controller/Makefile.am | 7 ++++ libs/gst/dataprotocol/Makefile.am | 6 ++++ libs/gst/net/Makefile.am | 6 ++++ plugins/elements/Makefile.am | 8 +++++ plugins/indexers/Makefile.am | 5 +++ tests/check/Makefile.am | 53 +++++++++++++++++++++++++++++++ 12 files changed, 141 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d13ffd728..c8ed0e16bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-07-02 Thomas Vander Stichele + + * 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 * tests/check/elements/fakesink.c: diff --git a/common b/common index f4348ab157..2cd1cf860c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit f4348ab157cc5e859f287e746004c0210880969a +Subproject commit 2cd1cf860cd15e61827c0f5f1db96f877344c722 diff --git a/configure.ac b/configure.ac index eceb97c0bc..e7dc018589 100644 --- a/configure.ac +++ b/configure.ac @@ -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" diff --git a/gst/Makefile.am b/gst/Makefile.am index c1f9ff5ded..922cd80883 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -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) diff --git a/libs/gst/base/Makefile.am b/libs/gst/base/Makefile.am index 19365169ec..ab5b99097a 100644 --- a/libs/gst/base/Makefile.am +++ b/libs/gst/base/Makefile.am @@ -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) diff --git a/libs/gst/check/Makefile.am b/libs/gst/check/Makefile.am index 2d0cd93001..8d713043e8 100644 --- a/libs/gst/check/Makefile.am +++ b/libs/gst/check/Makefile.am @@ -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) diff --git a/libs/gst/controller/Makefile.am b/libs/gst/controller/Makefile.am index 9771441a1a..1c0ccda96e 100644 --- a/libs/gst/controller/Makefile.am +++ b/libs/gst/controller/Makefile.am @@ -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) diff --git a/libs/gst/dataprotocol/Makefile.am b/libs/gst/dataprotocol/Makefile.am index d879fda063..eca8c6213f 100644 --- a/libs/gst/dataprotocol/Makefile.am +++ b/libs/gst/dataprotocol/Makefile.am @@ -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) diff --git a/libs/gst/net/Makefile.am b/libs/gst/net/Makefile.am index e3ef286700..990dee99ef 100644 --- a/libs/gst/net/Makefile.am +++ b/libs/gst/net/Makefile.am @@ -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) diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am index 07fe6e00ce..98eb6e6e26 100644 --- a/plugins/elements/Makefile.am +++ b/plugins/elements/Makefile.am @@ -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) diff --git a/plugins/indexers/Makefile.am b/plugins/indexers/Makefile.am index 0af5680b1f..bf5c328a5a 100644 --- a/plugins/indexers/Makefile.am +++ b/plugins/indexers/Makefile.am @@ -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) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 050c5ccc23..3b979ecf9b 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -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