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/
This commit is contained in:
Adrian-Ken Rueegsegger 2012-05-18 21:19:52 +02:00 committed by Tobias Brunner
parent deafaf51f1
commit 0aa5a46669
2 changed files with 11 additions and 0 deletions

View File

@ -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:

View 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