From 0037cc3f7dc1914ff0bef1a49e12adfea5d93f6a Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 9 Aug 2012 16:19:30 +0000 Subject: [PATCH] ecore: Enable coverage builds for exsisting tests SVN revision: 75055 --- legacy/ecore/Makefile.am | 33 +++++++++- legacy/ecore/configure.ac | 10 ++- legacy/ecore/m4/efl_coverage.m4 | 62 +++++++++++++++++++ legacy/ecore/src/lib/ecore_cocoa/Makefile.am | 3 +- legacy/ecore/src/lib/ecore_con/Makefile.am | 3 +- legacy/ecore/src/lib/ecore_config/Makefile.am | 3 +- .../ecore/src/lib/ecore_directfb/Makefile.am | 2 +- legacy/ecore/src/lib/ecore_evas/Makefile.am | 3 +- legacy/ecore/src/lib/ecore_fb/Makefile.am | 4 +- legacy/ecore/src/lib/ecore_file/Makefile.am | 3 +- legacy/ecore/src/tests/Makefile.am | 3 +- 11 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 legacy/ecore/m4/efl_coverage.m4 diff --git a/legacy/ecore/Makefile.am b/legacy/ecore/Makefile.am index b7be982153..9f16aeb665 100644 --- a/legacy/ecore/Makefile.am +++ b/legacy/ecore/Makefile.am @@ -117,6 +117,7 @@ m4/ecore_check_options.m4 \ m4/efl_doxygen.m4 \ m4/efl_path_max.m4 \ m4/efl_shm_open.m4 \ +m4/efl_coverage.m4 \ m4/efl_tests.m4 \ m4/efl_threads.m4 @@ -196,7 +197,7 @@ if BUILD_ECORE_WAYLAND pkgconfig_DATA += ecore-wayland.pc endif -.PHONY: doc +.PHONY: doc coverage # Documentation @@ -217,3 +218,33 @@ check-local: @echo "reconfigure with --enable-tests" endif + +# Coverage report + +if EFL_ENABLE_COVERAGE +lcov-reset: + @rm -rf $(top_builddir)/coverage + @find $(top_builddir) -name "*.gcda" -delete + @lcov --zerocounters --directory $(top_builddir) + +lcov-report: + @mkdir $(top_builddir)/coverage + lcov --capture --compat-libtool --output-file $(top_builddir)/coverage/coverage.info --directory $(top_builddir) + lcov --remove $(top_builddir)/coverage/coverage.info '*.h' --output-file $(top_builddir)/coverage/coverage.cleaned.info + genhtml -t "$(PACKAGE_STRING)" -o $(top_builddir)/coverage/html $(top_builddir)/coverage/coverage.cleaned.info + @echo "Coverage Report at $(top_builddir)/coverage/html" + +coverage: + @$(MAKE) lcov-reset + @$(MAKE) check + @$(MAKE) lcov-report +else +lcov-reset: + @echo "reconfigure with --enable-coverage" + +lcov-report: + @echo "reconfigure with --enable-coverage" + +coverage: + @echo "reconfigure with --enable-tests --enable-coverage" +endif diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac index 2ab207b0f2..b0a05fc30b 100644 --- a/legacy/ecore/configure.ac +++ b/legacy/ecore/configure.ac @@ -1969,10 +1969,17 @@ ECORE_EVAS_CHECK_MODULE_FULL([wayland-egl], [wayland-egl egl >= 7.10], fi ]) -### Unit tests +### Unit tests and coverage EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"]) +EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"]) +CFLAGS="${CFLAGS} ${EFL_COVERAGE_CFLAGS}" +ECORE_LIBS="${ECORE_LIBS} ${EFL_COVERAGE_LIBS}" +if test "x$enable_coverage" = "xyes" ; then + CFLAGS="${CFLAGS} ${EFL_DEBUG_CFLAGS}" +fi + ### install and build examples EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"]) @@ -2220,6 +2227,7 @@ if test "x${have_ecore_evas}" = "xyes" ; then fi echo echo " Tests................: ${enable_tests}" +echo " Coverage.............: ${enable_coverage}" echo " Maximum log level....: ${with_max_log_level}" echo "Documentation..........: ${build_doc}" echo "Examples...............: ${enable_build_examples}" diff --git a/legacy/ecore/m4/efl_coverage.m4 b/legacy/ecore/m4/efl_coverage.m4 new file mode 100644 index 0000000000..85d03215b3 --- /dev/null +++ b/legacy/ecore/m4/efl_coverage.m4 @@ -0,0 +1,62 @@ +dnl Copyright (C) 2008 Vincent Torri +dnl That code is public domain and can be freely used or copied. + +dnl Macro that check if coverage support is wanted and, if yes, if +dnl lcov is available. + +dnl Usage: EFL_CHECK_COVERAGE(tests [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl The parameter 'tests' is used if a dependency is needed. If set to "yes", +dnl the dependency is available. +dnl Defines EFL_COVERAGE_CFLAGS and EFL_COVERAGE_LIBS variables +dnl Defines the automake conditionnal EFL_ENABLE_COVERAGE + +AC_DEFUN([EFL_CHECK_COVERAGE], +[ + +dnl configure option + +AC_ARG_ENABLE([coverage], + [AC_HELP_STRING([--enable-coverage], [enable coverage profiling instrumentation @<:@default=disabled@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + _efl_enable_coverage="yes" + else + _efl_enable_coverage="no" + fi + ], + [_efl_enable_coverage="no"]) + +AC_MSG_CHECKING([whether to use profiling instrumentation]) +AC_MSG_RESULT([$_efl_enable_coverage]) + +dnl lcov check + +if test "x$_efl_enable_coverage" = "xyes" && test ! "x$1" = "xyes" ; then + AC_MSG_WARN([Coverage report requested but tests not being built, disable profiling instrumentation.]) + AC_MSG_WARN([Run configure with --enable-tests]) + _efl_enable_coverage="no" +fi + +if test "x$_efl_enable_coverage" = "xyes" ; then + AC_CHECK_PROG(have_lcov, [lcov], [yes], [no]) + if test "x$have_lcov" = "xyes" ; then + EFL_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + EFL_COVERAGE_LIBS="-lgcov" +# remove any optimisation flag and force debug symbols + EFL_DEBUG_CFLAGS="-g -O0 -DDEBUG" + else + AC_MSG_WARN([lcov is not found, disable profiling instrumentation]) + _efl_enable_coverage="no" + fi +fi + +dnl Substitution +AC_SUBST(EFL_COVERAGE_CFLAGS) +AC_SUBST(EFL_COVERAGE_LIBS) + +AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes") + +AS_IF([test "x$_efl_enable_coverage" = "xyes"], [$2], [$3]) +]) + +dnl End of efl_coverage.m4 diff --git a/legacy/ecore/src/lib/ecore_cocoa/Makefile.am b/legacy/ecore/src/lib/ecore_cocoa/Makefile.am index 4ac7b118d6..c41bd9befc 100644 --- a/legacy/ecore/src/lib/ecore_cocoa/Makefile.am +++ b/legacy/ecore/src/lib/ecore_cocoa/Makefile.am @@ -6,7 +6,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src/lib/ecore \ -I$(top_builddir)/src/lib/ecore_input \ @EVAS_CFLAGS@ \ -@EINA_CFLAGS@ +@EINA_CFLAGS@ \ +@EFL_ECORE_BUILD@ lib_LTLIBRARIES = libecore_cocoa.la includes_HEADERS = \ diff --git a/legacy/ecore/src/lib/ecore_con/Makefile.am b/legacy/ecore/src/lib/ecore_con/Makefile.am index 0e8e071545..1c3871ffcc 100644 --- a/legacy/ecore/src/lib/ecore_con/Makefile.am +++ b/legacy/ecore/src/lib/ecore_con/Makefile.am @@ -12,7 +12,8 @@ AM_CPPFLAGS = \ @EINA_CFLAGS@ \ @TLS_CFLAGS@ \ @CARES_CFLAGS@ \ -@WIN32_CPPFLAGS@ +@WIN32_CPPFLAGS@ \ +@EFL_ECORE_BUILD@ lib_LTLIBRARIES = libecore_con.la includes_HEADERS = Ecore_Con.h diff --git a/legacy/ecore/src/lib/ecore_config/Makefile.am b/legacy/ecore/src/lib/ecore_config/Makefile.am index c4593515eb..c8e8ae3f08 100644 --- a/legacy/ecore/src/lib/ecore_config/Makefile.am +++ b/legacy/ecore/src/lib/ecore_config/Makefile.am @@ -12,7 +12,8 @@ AM_CPPFLAGS = \ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ @EVAS_CFLAGS@ \ @EET_CFLAGS@ \ -@EINA_CFLAGS@ +@EINA_CFLAGS@ \ +@EFL_ECORE_BUILD@ CLEANFILES = $(DB) diff --git a/legacy/ecore/src/lib/ecore_directfb/Makefile.am b/legacy/ecore/src/lib/ecore_directfb/Makefile.am index 8142d33b39..6c536269e8 100644 --- a/legacy/ecore/src/lib/ecore_directfb/Makefile.am +++ b/legacy/ecore/src/lib/ecore_directfb/Makefile.am @@ -3,7 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_builddir)/src/lib/ecore \ -@DIRECTFB_CFLAGS@ @EINA_CFLAGS@ +@DIRECTFB_CFLAGS@ @EINA_CFLAGS@ @EFL_ECORE_BUILD@ lib_LTLIBRARIES = libecore_directfb.la includes_HEADERS = Ecore_DirectFB.h diff --git a/legacy/ecore/src/lib/ecore_evas/Makefile.am b/legacy/ecore/src/lib/ecore_evas/Makefile.am index cd7f37beea..1828096244 100644 --- a/legacy/ecore/src/lib/ecore_evas/Makefile.am +++ b/legacy/ecore/src/lib/ecore_evas/Makefile.am @@ -107,7 +107,8 @@ $(ECORE_IPC_INC) \ @EVAS_CFLAGS@ \ @EINA_CFLAGS@ \ @EVIL_CFLAGS@ \ -@WAYLAND_EGL_CFLAGS@ +@WAYLAND_EGL_CFLAGS@ \ +@EFL_ECORE_BUILD@ AM_CFLAGS = @WIN32_CFLAGS@ diff --git a/legacy/ecore/src/lib/ecore_fb/Makefile.am b/legacy/ecore/src/lib/ecore_fb/Makefile.am index 9129fec000..3af625a446 100644 --- a/legacy/ecore/src/lib/ecore_fb/Makefile.am +++ b/legacy/ecore/src/lib/ecore_fb/Makefile.am @@ -5,8 +5,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_input \ @TSLIB_CFLAGS@ \ -@EINA_CFLAGS@ - +@EINA_CFLAGS@ \ +@EFL_ECORE_BUILD@ lib_LTLIBRARIES = libecore_fb.la includes_HEADERS = Ecore_Fb.h diff --git a/legacy/ecore/src/lib/ecore_file/Makefile.am b/legacy/ecore/src/lib/ecore_file/Makefile.am index ab23ace4f5..e3cb74ab43 100644 --- a/legacy/ecore/src/lib/ecore_file/Makefile.am +++ b/legacy/ecore/src/lib/ecore_file/Makefile.am @@ -8,7 +8,8 @@ AM_CPPFLAGS = \ @CURL_CFLAGS@ \ @EVIL_CFLAGS@ \ @EINA_CFLAGS@ \ -@WIN32_CPPFLAGS@ +@WIN32_CPPFLAGS@ \ +@EFL_ECORE_BUILD@ AM_CFLAGS = @WIN32_CFLAGS@ diff --git a/legacy/ecore/src/tests/Makefile.am b/legacy/ecore/src/tests/Makefile.am index bfd20d9069..217f5f80f9 100644 --- a/legacy/ecore/src/tests/Makefile.am +++ b/legacy/ecore/src/tests/Makefile.am @@ -5,7 +5,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore_con \ -I$(top_srcdir)/src/lib/ecore_x \ @EINA_CFLAGS@ \ -@CHECK_CFLAGS@ +@CHECK_CFLAGS@ \ +@EFL_ECORE_BUILD@ if EFL_ENABLE_TESTS