From: Łukasz Stelmach Date: Wed, 14 Jun 2017 14:30:20 +0000 (+0200) Subject: Add the option to enable testing code X-Git-Tag: submit/tizen/20170622.101818~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3eb5434a33111acdf885bd74cf104fd1b8c62d69;p=platform%2Fcore%2Fsystem%2Ffaultd.git Add the option to enable testing code Add the option in configure.ac and the macro to define entry points for testing code. Change-Id: Icbdc657283b925935861e951123a3b4d4ee55662 Signed-off-by: Łukasz Stelmach --- diff --git a/configure.ac b/configure.ac index 2778466..318051f 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,14 @@ AC_ARG_ENABLE([test_programs], AM_CONDITIONAL(BUILD_TEST_PROGRAMS, [test "x$enable_test_programs" = xyes]) +AC_ARG_ENABLE([tests], + AS_HELP_STRING([--enable-tests], [enable tests]), + [enable_test_programs=$enableval], [enable_tests=no]) +if test "x$enable_tests" = "xyes"; then + AC_DEFINE(ENABLE_TESTS, 1, [Define if testing code is to be enabled]) +fi +AM_CONDITIONAL(ENABLE_TESTS, [test "x$enable_tests" = xyes]) + PKG_CHECK_MODULES(LIBSYSTEMD, [libsystemd >= 231], have_libsystemd=yes, diff --git a/src/core/module.h b/src/core/module.h index 9f0f78c..931a4e5 100644 --- a/src/core/module.h +++ b/src/core/module.h @@ -22,8 +22,16 @@ #include #include -#include "list.h" #include "common.h" +#include "config.h" +#include "list.h" + +#ifdef ENABLE_TESTS +#define TEST_ENTRY_POINT(func) \ + typeof(func) CONCAT(FAULTD_MODNAME_T, _ ## func) = func +#else +#define TEST_ENTRY_POINT(func) +#endif #define FAULTD_MODNAME STR(FAULTD_MODNAME_T)