]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Add configure option --enable-unit-tests
authorAdrian-Ken Rueegsegger <ken@codelabs.ch>
Fri, 18 May 2012 19:19:52 +0000 (21:19 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 19 Mar 2013 14:23:44 +0000 (15:23 +0100)
This configure option enables check-based unit testing. Check is a unit
test framework for C [1].

The unit tests can be executed by issuing the following command in the
toplevel build directory:

make check

[1] - http://check.sourceforge.net/

HACKING
configure.in

diff --git a/HACKING b/HACKING
index 830b688412a4359248fa753ccf41ffd3dc2a5fe0..dbb347e6fef579891e6754ead322a3bb78bb2de8 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -18,6 +18,7 @@ the code, you need the following tools:
     - lex/flex
     - yacc/bison
     - gperf
+    - check
     - optionally Doxygen
 
 To check out the master branch, use:
index 716bad5b122a0b7e87ea65d29c853dc679de49bb..54e4abb3025bf5a1ecfffc2992e89e061e07bc84 100644 (file)
@@ -236,6 +236,7 @@ ARG_ENABL_SET([radattr],        [enable plugin to inject and process custom RADI
 ARG_ENABL_SET([vstr],           [enforce using the Vstr string library to replace glibc-like printf hooks.])
 ARG_ENABL_SET([monolithic],     [build monolithic version of libstrongswan that includes all enabled plugins. Similarly, the plugins of charon are assembled in libcharon.])
 ARG_ENABL_SET([bfd-backtraces], [use binutils libbfd to resolve backtraces for memory leaks and segfaults.])
+ARG_ENABL_SET([unit-tests],     [enable unit tests using the check test framework.])
 
 # ===================================
 #  option to disable default options
@@ -258,6 +259,8 @@ if test -z "$CFLAGS"; then
        CFLAGS="-g -O2 -Wall -Wno-format -Wno-pointer-sign"
 fi
 AC_PROG_CC
+AM_PROG_CC_C_O
+
 AC_LIB_PREFIX
 AC_C_BIGENDIAN
 
@@ -894,6 +897,12 @@ AC_SUBST(dev_headers)
 
 CFLAGS="$CFLAGS -include `pwd`/config.h"
 
+if test x$unit_tests = xtrue; then
+       PKG_CHECK_MODULES(CHECK, [check >= 0.9.4])
+       AC_SUBST(CHECK_CFLAGS)
+       AC_SUBST(CHECK_LIBS)
+fi
+
 # ===============================================
 #  collect plugin list for strongSwan components
 # ===============================================
@@ -1208,6 +1217,7 @@ AM_CONDITIONAL(USE_IMCV, test x$imcv = xtrue)
 AM_CONDITIONAL(USE_PTS, test x$pts = xtrue)
 AM_CONDITIONAL(USE_TROUSERS, test x$tss = xtrousers)
 AM_CONDITIONAL(MONOLITHIC, test x$monolithic = xtrue)
+AM_CONDITIONAL(UNITTESTS, test x$unit_tests = xtrue)
 
 # ========================
 #  set global definitions