summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-03-27 18:00:29 +0100
committerMartin Kosek <mkosek@redhat.com>2013-03-28 16:11:24 +0100
commitaa2ed2d3c83fa7c2ebcfe8dfcab6f5f5dd7fec96 (patch)
tree995f3c11306c083fb1a3ba685433edcff839e477 /daemons
parentdae163aa37a7ea07399a964a143f378c5cb6bffa (diff)
downloadfreeipa-aa2ed2d3c83fa7c2ebcfe8dfcab6f5f5dd7fec96.tar.gz
freeipa-aa2ed2d3c83fa7c2ebcfe8dfcab6f5f5dd7fec96.tar.xz
freeipa-aa2ed2d3c83fa7c2ebcfe8dfcab6f5f5dd7fec96.zip
Add support for cmocka C-Unit Test framework
cmocka is a more advanced unit test framework for C-code than the currently used check framework. This patch adds configure checks and makefile variables so that new unit tests can use cmocka. Fixes https://fedorahosted.org/freeipa/ticket/3434
Diffstat (limited to 'daemons')
-rw-r--r--daemons/configure.ac31
1 files changed, 31 insertions, 0 deletions
diff --git a/daemons/configure.ac b/daemons/configure.ac
index d3b6b19d1..2f6a3e787 100644
--- a/daemons/configure.ac
+++ b/daemons/configure.ac
@@ -263,6 +263,37 @@ else
fi
AM_CONDITIONAL([HAVE_CHECK], [test x$have_check != x])
+dnl ---------------------------------------------------------------------------
+dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/
+dnl This will be simplified when cmocka carries a .pc file.
+dnl ---------------------------------------------------------------------------
+AC_SUBST(CMOCKA_LIBS)
+AC_SUBST(CMOCKA_CFLAGS)
+
+AC_CHECK_HEADERS(
+ [setjmp.h cmocka.h],,,
+ [[ #include <stdarg.h>
+ # include <stddef.h>
+ #ifdef HAVE_SETJMP_H
+ # include <setjmp.h>
+ #endif
+ ]]
+)
+
+if test "x$ac_cv_header_setjmp_h" = "xyes" && test "x$ac_cv_header_cmocka_h" = "xyes" ; then
+ AC_CHECK_LIB([cmocka], [_will_return],
+ [ CMOCKA_LIBS="-lcmocka"
+ AC_MSG_RESULT([libcmocka available, cmocka tests will be build])
+ have_cmocka="yes" ],
+ [AC_MSG_WARN([No libcmocka library found, cmocka tests will not be build])
+ have_cmocka="no" ])
+else
+ AC_MSG_WARN([Required header files for libcmocka are missing, cmocka tests will not be build])
+ have_cmocka="no"
+fi
+
+AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
+
dnl -- dirsrv is needed for the extdom unit tests --
PKG_CHECK_MODULES([DIRSRV], [dirsrv >= 1.3.0])
dnl -- sss_idmap is needed by the extdom exop --