Add the option in configure.ac and the macro to define entry points
for testing code.
Change-Id: Icbdc657283b925935861e951123a3b4d4ee55662
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
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,
#include <time.h>
#include <systemd/sd-event.h>
-#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)