From 3ac06e5af384b0f394038b40e26e592e7d338362 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 6 Jan 2015 00:56:31 +1300 Subject: [PATCH] Making unittests output coverage information. --- Makefile.am | 1 + tests/unit/Makefile.am | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Makefile.am b/Makefile.am index 0b5de3b..0316a37 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,6 +39,7 @@ endif if GCOV_ENABLED coverage: $(MAKE) -C tools coverage + $(MAKE) -C tests/unit coverage endif style: diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index ce1854e..16e1da5 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -1,7 +1,19 @@ +if GCOV_ENABLED +# --coverage +GCOV_CFLAGS = -fprofile-arcs -ftest-coverage +GCOV_LFLAGS = -fprofile-arcs -ftest-coverage +#GCOV_CFLAGS = --coverage +#GCOV_LFLAGS = --coverage +else +GCOV_CFLAGS = +GCOV_LFLAGS = +endif + include $(top_srcdir)/build/glib-tap.mk AM_CFLAGS = $(GLIB_CFLAGS) $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS) \ + $(GCOV_CFLAGS) \ -DLOG_PREFIX="\"./tests/unit\"" LDADD = $(GLIB_LIBS) $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) @@ -12,4 +24,9 @@ test_programs = \ gstswitchexample \ $(NULL) +if GCOV_ENABLED +coverage: + gcov *.o +endif + include $(top_srcdir)/build/Makefile.am.gitignore