b70e3c0f4ce178609fc26926b15d9278418da2cf
[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-tools --enable-openssl"
23 DEPS="libssl-dev"
24 ;;
25 gcrypt)
26 CONFIG="--disable-defaults --enable-tools --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-svc --disable-dbghelp-backtraces"
38 if test "$LEAK_DETECTIVE" = "yes"; then
39 # libgcrypt can't be deinitialized
40 CONFIG="$CONFIG --disable-gcrypt"
41 # libunwind causes threads to be cleaned up after LD is disabled
42 CONFIG="$CONFIG --disable-unwind-backtraces"
43 fi
44 # not enabled on the build server
45 CONFIG="$CONFIG --disable-af-alg"
46 # TODO: enable? perhaps via coveralls.io (cpp-coveralls)?
47 CONFIG="$CONFIG --disable-coverage"
48 DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
49 libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
50 libnm-glib-dev libnm-glib-vpn-dev libpcsclite-dev libpam0g-dev
51 binutils-dev libunwind7-dev libjson0-dev"
52 ;;
53 dist)
54 TARGET=distcheck
55 ;;
56 *)
57 echo "$0: unknown test $TEST" >&2
58 exit 1
59 ;;
60 esac
61
62 if test "$1" = "deps"; then
63 sudo apt-get install -qq $DEPS
64 exit $?
65 fi
66
67 CONFIG="$CONFIG
68 --enable-silent-rules
69 --enable-test-vectors
70 --enable-monolithic=${MONOLITHIC-no}
71 --enable-leak-detective=${LEAK_DETECTIVE-no}"
72
73 echo "$ ./configure $CONFIG && make $TARGET"
74 CFLAGS="$CFLAGS" ./configure $CONFIG && make -j4 $TARGET