aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian-Ken Rueegsegger <ken@codelabs.ch>2012-05-18 21:19:52 +0200
committerTobias Brunner <tobias@strongswan.org>2013-03-19 15:23:44 +0100
commit0aa5a4666914a5a786e98201fe6ebae81dbe8fbc (patch)
tree38196ffc8b21dd4e03065855cfaff23feaf6d08c
parentdeafaf51f1c768ce1dbdc7ff7ac91f7fb4ea5e21 (diff)
downloadstrongswan-0aa5a4666914a5a786e98201fe6ebae81dbe8fbc.tar.bz2
strongswan-0aa5a4666914a5a786e98201fe6ebae81dbe8fbc.tar.xz
Add configure option --enable-unit-tests
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/
-rw-r--r--HACKING1
-rw-r--r--configure.in10
2 files changed, 11 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index 830b68841..dbb347e6f 100644
--- 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:
diff --git a/configure.in b/configure.in
index 716bad5b1..54e4abb30 100644
--- a/configure.in
+++ b/configure.in
@@ -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