From: David Schleef Date: Fri, 9 Jan 2004 01:42:11 +0000 (+0000) Subject: Add option --enable-gcov to build GStreamer with -fprofile-arcs and -ftest-coverage... X-Git-Tag: BRANCH-RELEASE-0_7_4-ROOT~176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67062b73202787346f669d1bc07c06d6b67f1bda;p=platform%2Fupstream%2Fgstreamer.git Add option --enable-gcov to build GStreamer with -fprofile-arcs and -ftest-coverage, which allows gcov to show inform... Original commit message from CVS: Add option --enable-gcov to build GStreamer with -fprofile-arcs and -ftest-coverage, which allows gcov to show information about testsuite coverage. --- diff --git a/ChangeLog b/ChangeLog index e90df06..add1b8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-01-08 David Schleef + + * Makefile.am: + * configure.ac: + Add option --enable-gcov to build GStreamer with -fprofile-arcs + and -ftest-coverage, which allows gcov to show information about + testsuite coverage. + 2004-01-08 Benjamin Otte * gst/gstutils.h: diff --git a/Makefile.am b/Makefile.am index c3c43e5..244d02b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,6 +50,7 @@ EXTRA_DIST = gstreamer.spec.in gst-element-check.m4 \ CLEANFILES = gst-element-check-@GST_MAJORMINOR@.m4 + dist-hook: cp gstreamer.spec $(distdir) rm -rf `find $(distdir)/common -name CVS` @@ -59,3 +60,43 @@ rpm: dist include $(top_srcdir)/idiottest.mak + +if GST_GCOV_ENABLED +clean-gcov: + find -name "*.da" -o -name "*.gcov" | xargs rm || true + +clean-bbg: + find -name "*.bbg" -o -name "*.bb" | xargs rm || true + +GCOV_DIRS=gst libs + +## .PHONY so it always rebuilds it +.PHONY: coverage-report.txt +coverage-report.txt: + BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg"` ; \ + C_FILES= ; \ + for F in $$BBG_FILES ; do \ + F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ; \ + C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g'` ; \ + B=`basename $$F .bbg` ; \ + D=`dirname $$F` ; \ + DA=`echo $$F | sed -e 's/.bbg/.da/g'` ; \ + DA_libs=`echo $$D/.libs/$$B/.da` ; \ + if test -e $$DA || test -e $$DA_libs; then \ + C_FILES="$$C_FILES $$C" ; \ + fi ; \ + done ; \ + echo $$C_FILES ; \ + $(top_builddir)/testsuite/decode-gcov --report $$C_FILES > coverage-report.txt + +check-coverage: clean-gcov all check coverage-report.txt + cat coverage-report.txt + +else +coverage-report.txt: + echo "Need to reconfigure with --enable-gcov" + +check-coverage: + echo "Need to reconfigure with --enable-gcov" + +endif diff --git a/configure.ac b/configure.ac index f3b82b0..ac216e5 100644 --- a/configure.ac +++ b/configure.ac @@ -161,6 +161,22 @@ if test x$HAVE_CPU_PPC = xyes ; then true) fi +AC_ARG_ENABLE(gcov, + [--enable-gcov compile with coverage profiling instrumentation (gcc only)], + enable_gcov=$enableval,enable_gcov=no) +if test x$enable_gcov = xyes ; then + AS_COMPILER_FLAG(["-fprofile-arcs"], + [GST_INT_CFLAGS="$GST_INT_CFLAGS -fprofile-arcs"], + true) + AS_COMPILER_FLAG(["-ftest-coverage"], + [GST_INT_CFLAGS="$GST_INT_CFLAGS -ftest-coverage"], + true) + GST_INT_CFLAGS=`echo "$GST_INT_CFLAGS" | sed -e 's/-O[0-9]*//g'` + + AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing]) +fi +AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes) + dnl Check for essential libraries first: dnl ====================================