Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : proto/eina

Dir     : e17/proto/eina


Modified Files:
        Makefile.am configure.in 


Log Message:
add unit test and coverage support in configure.in and Makefile.am. Now let's 
encourage Cedric for writing the unit tests :)

===================================================================
RCS file: /cvs/e/e17/proto/eina/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 30 Jul 2008 12:46:54 -0000      1.1
+++ Makefile.am 30 Jul 2008 13:58:26 -0000      1.2
@@ -30,3 +30,52 @@
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = eina.pc
+
+# Unit tests
+
+if EINA_ENABLE_TESTS
+
+check-local:
+       @./src/tests/eina_suite
+
+else
+
+check-local:
+       @echo "reconfigure with --enable-tests"
+
+endif
+
+# Coverage report
+
+if EINA_ENABLE_COVERAGE
+lcov-reset:
+       @rm -rf coverage
+       @find . -name "*.gcda" -exec rm {} \;
+       @lcov --directory . --zerocounters
+
+lcov-report:
+       @mkdir coverage
+       @lcov --compat-libtool --directory . --capture --output-file 
coverage/coverage.info
+       @lcov -l coverage/coverage.info | grep -v "`cd $(top_srcdir) && pwd`" | 
cut -d: -f1 > coverage/remove
+       @lcov -r coverage/coverage.info `cat coverage/remove` > 
coverage/coverage.cleaned.info
+       @rm coverage/remove
+       @mv coverage/coverage.cleaned.info coverage/coverage.info
+       @genhtml -t "$(PACKAGE_STRING)" -o coverage coverage/coverage.info
+
+coverage:
+       @make lcov-reset
+       @make check
+       @make lcov-report
+
+clean-local:
+       @rm -rf coverage
+else
+lcov-reset:
+       @echo "reconfigure with --enable-coverage"
+
+lcov-report:
+       @echo "reconfigure with --enable-coverage"
+
+coverage:
+       @echo "reconfigure with --enable-tests --enable-coverage"
+endif
===================================================================
RCS file: /cvs/e/e17/proto/eina/configure.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- configure.in        30 Jul 2008 13:16:09 -0000      1.2
+++ configure.in        30 Jul 2008 13:58:26 -0000      1.3
@@ -24,30 +24,111 @@
 AC_SUBST(VMAJ)
 AC_SUBST(version_info)
 
-# Checks for programs
-AC_PROG_CC
+### Additional options to configure
+
+# Unit tests
+
+AC_ARG_ENABLE([tests],
+   [AC_HELP_STRING([--enable-tests], [enable tests @<:@default=no@:>@])],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       enable_tests="yes"
+    else
+       enable_tests="no"
+    fi
+   ],
+   [enable_tests="no"]
+)
+AC_MSG_CHECKING([whether tests are built])
+AC_MSG_RESULT([${enable_tests}])
+
+# Coverage
+
+AC_ARG_ENABLE([coverage],
+   [AC_HELP_STRING([--enable-coverage], [compile with coverage profiling 
instrumentation @<:@default=no@:>@])],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       enable_coverage="yes"
+    else
+       enable_coverage="no"
+    fi
+   ],
+   [enable_coverage="no"]
+)
+AC_MSG_CHECKING([whether to use profiling instrumentation])
+AC_MSG_RESULT([$enable_coverage])
+
+
+### Checks for libraries
+
+# Check library for unit tests
+
+if test "x${enable_tests}" = "xyes" ; then
+   PKG_CHECK_MODULES([CHECK],
+      [check >= 0.9.5],
+      [dummy="yes"],
+      [enable_tests="no"]
+   )
+fi
+
+AM_CONDITIONAL(EINA_ENABLE_TESTS, test "x${enable_tests}" = "xyes")
 
-# Checks for libraries
 
-# Checks for header files
+### Checks for header files
 AC_HEADER_ASSERT
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 
-# Checks for types
 
-# Checks for structures
+### Checks for programs
+AC_PROG_CC
+
+# lcov program for coverage report
+
+if test "x$enable_tests" = "xno" -a "x$enable_coverage" = "xyes" ; then
+   AC_MSG_WARN([Coverage report requested but tests not being built. Run 
configure with --enable-tests])
+   enable_coverage="no"
+fi
+
+if test "x$enable_coverage" = "xyes"; then
+   AC_CHECK_PROG(have_lcov, [lcov], [yes], [no])
+   if test "x$have_lcov" = "xyes" ; then
+      COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
+      COVERAGE_LIBS="-lgcov"
+# remove any optimisation flag and force debug symbols
+      DEBUG_CFLAGS="-g -O0"
+   else
+      AC_MSG_WARN([lcov is not found, disable profiling instrumentation])
+      enable_coverage="no"
+   fi
+fi
+AC_SUBST(COVERAGE_CFLAGS)
+AC_SUBST(COVERAGE_LIBS)
+
+AM_CONDITIONAL(EINA_ENABLE_COVERAGE, test "x${enable_coverage}" = "xyes")
+
+
+### Checks for types
+
 
-# Checks for compiler characteristics
+### Checks for structures
+
+
+### Checks for compiler characteristics
 AC_C_CONST
 AC_C_BIGENDIAN
 AC_PROG_CC_STDC
 
+if test "x$enable_coverage" = "xyes"; then
+   CFLAGS="${DEBUG_CFLAGS}"
+fi
+
 if ! test "${VMIC}" = "x" ; then
    CFLAGS="${CFLAGS} -Wall -W -Wextra" # -Werror
 fi
 
-# Checks for linker characteristics
+
+### Checks for linker characteristics
 lt_enable_auto_import=""
 case "$host_os" in
    mingw*|cegcc*)
@@ -56,9 +137,11 @@
 esac
 AC_SUBST(lt_enable_auto_import)
 
-# Checks for library functions
 
-## Make the debug preprocessor configurable
+### Checks for library functions
+
+
+### Make the debug preprocessor configurable
 
 AC_CONFIG_FILES([
 Makefile
@@ -85,7 +168,12 @@
 echo
 echo "Configuration Options Summary:"
 echo
-echo "Installation Path.........: $prefix"
+echo "  Tests................: ${enable_tests}"
+echo "  Coverage.............: ${enable_coverage}"
+echo
+echo "  Installation.........: make install"
+echo
+echo "    prefix.............: $prefix"
 echo
 echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE,"
 echo "and then afterwards as root (or the user who will install this), type"



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to