Hi,

this patch does not do anything really useful for now, it just adds
configure checks. The related ticket
https://fedorahosted.org/freeipa/ticket/3434 is in the current milestone
but it can easily deferred to a later milestone if you do not have the
time to review it.

bye,
Sumit
From 8fd76e4b6f911243aa17b73910348c2b4c4bcd7b Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Wed, 27 Mar 2013 18:00:29 +0100
Subject: [PATCH] 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
---
 daemons/configure.ac | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/daemons/configure.ac b/daemons/configure.ac
index 
0eb064665623f0406d88b3d7c019661505650bbe..3e8e81f5e3fa278347c1990ff2d831216e4e5eb3
 100644
--- a/daemons/configure.ac
+++ b/daemons/configure.ac
@@ -273,6 +273,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 --
-- 
1.8.1.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to