Add Travis CI config and build script
authorTobias Brunner <tobias@strongswan.org>
Wed, 26 Feb 2014 16:49:07 +0000 (17:49 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 20 Mar 2014 14:29:27 +0000 (15:29 +0100)
.travis.yml [new file with mode: 0644]
scripts/test.sh [new file with mode: 0755]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..c5812b5
--- /dev/null
@@ -0,0 +1,38 @@
+language: c
+
+compiler:
+  - gcc
+
+before_install:
+  - sudo apt-get update -qq
+  - sudo apt-get install -qq bison flex gperf gettext
+  # TODO: modularize this to speed up builds (e.g. call 'test.sh deps' to do this for the current TEST)
+  - sudo apt-get install -qq libgmp-dev libssl-dev libgcrypt11-dev
+  - sudo apt-get install -qq libcurl4-gnutls-dev libsoup2.4-dev
+  - sudo apt-get install -qq libunbound-dev libldns-dev
+  - sudo apt-get install -qq libmysqlclient-dev libsqlite3-dev
+  - sudo apt-get install -qq clearsilver-dev libfcgi-dev
+  - sudo apt-get install -qq libnm-glib-dev libnm-glib-vpn-dev
+  - sudo apt-get install -qq libpcsclite-dev libpam0g-dev
+  - sudo apt-get install -qq binutils-dev libunwind7-dev
+
+script:
+  - ./autogen.sh
+  - ./scripts/test.sh
+
+env:
+  global:
+    - TESTS_REDUCED_KEYLENGTHS=yes
+    - LEAK_DETECTIVE=no
+    - MONOLITHIC=no
+  matrix:
+    - TEST=default
+    - TEST=default MONOLITHIC=yes
+    - TEST=default LEAK_DETECTIVE=yes
+    - TEST=openssl
+    - TEST=openssl LEAK_DETECTIVE=yes
+    # libgcrypt can't be deinitialized so we can't test it with leak detective
+    - TEST=gcrypt
+    - TEST=all
+    - TEST=all MONOLITHIC=yes
+    - TEST=dist
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755 (executable)
index 0000000..9b38c11
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Build script for Travis CI
+
+if test -z $TRAVIS_BUILD_DIR; then
+       TRAVIS_BUILD_DIR=$PWD
+fi
+
+cd $TRAVIS_BUILD_DIR
+
+TARGET=check
+
+case "$TEST" in
+default)
+       ;;
+openssl)
+       CONFIG="--disable-defaults --enable-tools --enable-openssl"
+       ;;
+gcrypt)
+       CONFIG="--disable-defaults --enable-tools --enable-gcrypt --enable-pkcs1"
+       ;;
+all)
+       CONFIG="--enable-all --disable-android-dns --disable-android-log
+                       --disable-dumm --disable-kernel-pfroute --disable-keychain
+                       --disable-lock-profiler --disable-maemo --disable-padlock
+                       --disable-osx-attr --disable-tkm --disable-uci"
+       # not enabled on the build server
+       CONFIG="$CONFIG --disable-af-alg"
+       # TODO: add tests for different printf implementations?
+       CONFIG="$CONFIG --disable-vstr"
+       # TODO: enable? perhaps via coveralls.io (cpp-coveralls)?
+       CONFIG="$CONFIG --disable-coverage"
+       ;;
+dist)
+       TARGET=distcheck
+       ;;
+*)
+       echo "$0: unknown test $TEST" >&2
+       exit 1
+       ;;
+esac
+
+CONFIG="$CONFIG
+       --enable-silent-rules
+       --enable-test-vectors
+       --enable-monolithic=${MONOLITHIC-no}
+       --enable-leak-detective=${LEAK_DETECTIVE-no}"
+
+echo "$ ./configure $CONFIG && make $TARGET"
+./configure $CONFIG && make $TARGET