travis: Install dependencies for each test dynamically
authorTobias Brunner <tobias@strongswan.org>
Sat, 1 Mar 2014 07:49:52 +0000 (08:49 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 20 Mar 2014 14:49:05 +0000 (15:49 +0100)
Since the installation of all packages alone takes several minutes this
should speed up some test cases.

.travis.yml
scripts/test.sh

index 8209ca9..affab27 100644 (file)
@@ -7,15 +7,7 @@ compiler:
 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
+  - ./scripts/test.sh deps
 
 script:
   - ./autogen.sh
index 9b38c11..30e851e 100755 (executable)
@@ -9,14 +9,18 @@ cd $TRAVIS_BUILD_DIR
 
 TARGET=check
 
+DEPS="libgmp-dev"
+
 case "$TEST" in
 default)
        ;;
 openssl)
        CONFIG="--disable-defaults --enable-tools --enable-openssl"
+       DEPS="libssl-dev"
        ;;
 gcrypt)
        CONFIG="--disable-defaults --enable-tools --enable-gcrypt --enable-pkcs1"
+       DEPS="libgcrypt11-dev"
        ;;
 all)
        CONFIG="--enable-all --disable-android-dns --disable-android-log
@@ -29,6 +33,10 @@ all)
        CONFIG="$CONFIG --disable-vstr"
        # TODO: enable? perhaps via coveralls.io (cpp-coveralls)?
        CONFIG="$CONFIG --disable-coverage"
+       DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
+                 libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
+                 libnm-glib-dev libnm-glib-vpn-dev libpcsclite-dev libpam0g-dev
+                 binutils-dev libunwind7-dev"
        ;;
 dist)
        TARGET=distcheck
@@ -39,6 +47,11 @@ dist)
        ;;
 esac
 
+if test "$1" = "deps"; then
+       sudo apt-get install -qq $DEPS
+       exit $?
+fi
+
 CONFIG="$CONFIG
        --enable-silent-rules
        --enable-test-vectors