travis: Install iptables-dev for connmark plugin in "all" tests
[strongswan.git] / scripts / test.sh
1 #!/bin/sh
2 # Build script for Travis CI
3
4 if test -z $TRAVIS_BUILD_DIR; then
5 TRAVIS_BUILD_DIR=$PWD
6 fi
7
8 cd $TRAVIS_BUILD_DIR
9
10 TARGET=check
11
12 DEPS="libgmp-dev"
13
14 CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror"
15
16 case "$TEST" in
17 default)
18 # should be the default, but lets make sure
19 CONFIG="--with-printf-hooks=glibc"
20 ;;
21 openssl)
22 CONFIG="--disable-defaults --enable-pki --enable-openssl"
23 DEPS="libssl-dev"
24 ;;
25 gcrypt)
26 CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1"
27 DEPS="libgcrypt11-dev"
28 ;;
29 printf-builtin)
30 CONFIG="--with-printf-hooks=builtin"
31 ;;
32 all)
33 CONFIG="--enable-all --disable-android-dns --disable-android-log
34 --disable-dumm --disable-kernel-pfroute --disable-keychain
35 --disable-lock-profiler --disable-maemo --disable-padlock
36 --disable-osx-attr --disable-tkm --disable-uci --disable-aikgen
37 --disable-systemd --disable-soup
38 --disable-svc --disable-dbghelp-backtraces --disable-socket-win
39 --disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
40 if test "$LEAK_DETECTIVE" = "yes"; then
41 # libgcrypt can't be deinitialized
42 CONFIG="$CONFIG --disable-gcrypt"
43 # libunwind causes threads to be cleaned up after LD is disabled
44 CONFIG="$CONFIG --disable-unwind-backtraces"
45 fi
46 # not enabled on the build server
47 CONFIG="$CONFIG --disable-af-alg"
48 # TODO: enable? perhaps via coveralls.io (cpp-coveralls)?
49 CONFIG="$CONFIG --disable-coverage"
50 DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
51 libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
52 libnm-glib-dev libnm-glib-vpn-dev libpcsclite-dev libpam0g-dev
53 binutils-dev libunwind7-dev libjson0-dev iptables-dev"
54 ;;
55 win*)
56 CONFIG="--disable-defaults --enable-svc --enable-ikev2
57 --enable-ikev1 --enable-static --enable-test-vectors --enable-nonce
58 --enable-constraints --enable-revocation --enable-pem --enable-pkcs1
59 --enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
60 --enable-eap-tnc --enable-eap-ttls --enable-eap-identity
61 --enable-updown --enable-ext-auth
62 --enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
63 --enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
64 --enable-pki --enable-swanctl --enable-socket-win"
65 # no make check for Windows binaries
66 TARGET=
67 CFLAGS="$CFLAGS -mno-ms-bitfields"
68 DEPS="gcc-mingw-w64-base mingw-w64-dev"
69 case "$TEST" in
70 win64)
71 CONFIG="--host=x86_64-w64-mingw32 $CONFIG"
72 DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 $DEPS"
73 CC="x86_64-w64-mingw32-gcc"
74 ;;
75 win32)
76 CONFIG="--host=i686-w64-mingw32 $CONFIG"
77 DEPS="gcc-mingw-w64-i686 binutils-mingw-w64-i686 $DEPS"
78 CC="i686-w64-mingw32-gcc"
79 ;;
80 esac
81 ;;
82 dist)
83 TARGET=distcheck
84 ;;
85 *)
86 echo "$0: unknown test $TEST" >&2
87 exit 1
88 ;;
89 esac
90
91 if test "$1" = "deps"; then
92 sudo apt-get install -qq $DEPS
93 exit $?
94 fi
95
96 CONFIG="$CONFIG
97 --enable-silent-rules
98 --enable-test-vectors
99 --enable-monolithic=${MONOLITHIC-no}
100 --enable-leak-detective=${LEAK_DETECTIVE-no}"
101
102 echo "$ CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG && make $TARGET"
103 CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG && make -j4 $TARGET