It used to be possible to run the testsuite whether coverage was enabled
or not; this is very useful for eg. distros who want to automatically
run the testsuite without having to compile with coverage support.
Most other EFL in the stable branch already allow this (evas, ecore,
edje); update Eina to bring it in line with them.
---
Makefile.am | 29 -
configure.ac | 10 +++-
m4/common/efl_coverage.m4 | 62 +
m4/common/efl_tests.m4| 27 +++-
4 files changed, 97 insertions(+), 31 deletions(-)
create mode 100644 m4/common/efl_coverage.m4
diff --git a/Makefile.am b/Makefile.am
index 5ff1896..e67c183 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,7 +42,8 @@ m4/common/efl_attribute.m4 \
m4/common/efl_benchmark.m4 \
m4/common/efl_check_funcs.m4 \
m4/common/efl_compiler_flag.m4 \
-m4/common/efl_cpu.m4 \
+m4/common/efl_coverage.m4 \
+m4/common/efl_cpu.m4\
m4/common/efl_doxygen.m4 \
m4/common/efl_examples.m4 \
m4/common/efl_path_max.m4 \
@@ -68,6 +69,20 @@ install-doc:
if EFL_ENABLE_TESTS
+check-local:
+ @./src/tests/eina_suite
+
+else
+
+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
@@ -80,21 +95,21 @@ lcov-report:
genhtml -t "$(PACKAGE_STRING)" -o $(top_builddir)/coverage/html
$(top_builddir)/coverage/coverage.cleaned.info
@echo "Coverage Report at $(top_builddir)/coverage/html"
-check-local:
+coverage:
@$(MAKE) lcov-reset
- @./src/tests/eina_suite
+ @$(MAKE) check
@$(MAKE) lcov-report
else
lcov-reset:
- @echo "reconfigure with --enable-tests"
+ @echo "reconfigure with --enable-coverage"
lcov-report:
- @echo "reconfigure with --enable-tests"
+ @echo "reconfigure with --enable-coverage"
-check-local:
- @echo "reconfigure with --enable-tests"
+coverage:
+ @echo "reconfigure with --enable-tests --enable-coverage"
endif
diff --git a/configure.ac b/configure.ac
index d132d15..1775f0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -553,6 +553,14 @@ EINA_CHECK_MODULE([one-big],[${enable_one_big}],
[one big])
EFL_CHECK_TESTS([eina], [enable_tests="yes"], [enable_tests="no"])
+EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"],
[enable_coverage="no"])
+EINA_CFLAGS="${EINA_CFLAGS} ${EFL_COVERAGE_CFLAGS} ${EXOTIC_CFLAGS}"
+EINA_LIBS="${EINA_LIBS} ${EFL_COVERAGE_LIBS} ${EXOTIC_LIBS}"
+if test "x$enable_coverage" = "xyes" ; then
+ EINA_CFLAGS="${EINA_CFLAGS} ${EFL_DEBUG_CFLAGS}"
+fi
+
+
EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
EINA_BENCH_MODULE([glib], [${enable_benchmark}], [glib-2.0],
[enable_benchmark_glib="yes"], [enable_benchmark_glib="no"])
if test -n "$CXX" && test "x$enable_benchmark" = "xyes" ; then
@@ -628,7 +636,7 @@ echo " Documentation: ${build_doc}"
if test "x${build_doc}" = "xyes" ; then
echo "Installation...: make install-doc"
fi
-echo " Tests: ${enable_tests} (Coverage:
${efl_enable_coverage})"
+echo " Tests: ${enable_tests} (Coverage: ${enable_coverage})"
echo " Examples.: ${enable_build_examples}"
echo " Tiler Example: ${build_tiler_example}"
echo " Examples installed...: ${enable_install_examples}"
diff --git a/m4/common/efl_coverage.m4 b/m4/common/efl_coverage.m4
new file mode 100644
index 000..85d0321
--- /dev/null
+++ b/m4/common/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
+
+i