]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
travis-ci: test that configure fails without jansson
authorJason Ish <ish@unx.ca>
Thu, 21 Mar 2019 14:37:28 +0000 (08:37 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 13 Apr 2019 13:35:02 +0000 (15:35 +0200)
Update the no-jansson test to fail out if configure
passes.

The script needed to be converted into a single list item
for the early exit to work on Travis.

.travis.yml

index a83b837d83d4e279fdee0611bf500c6a74e17e3f..a380d54d69fec114ff907173a6e35e3c72802ad2 100644 (file)
@@ -29,7 +29,6 @@ addons:
       - libnfnetlink-dev
       - libnfnetlink0
       - libhiredis-dev
-      - libjansson-dev
       - libevent-dev
       - libevent-pthreads-2.0-5
     # Now define the default set of packages which is those above, and
@@ -166,8 +165,9 @@ matrix:
     - os: linux
       compiler: gcc
       env:
-        - NAME="linux,gcc,no-json"
+        - NAME="linux,gcc,no-jansson"
         - *default-cflags
+        - CONFIGURE_SHOULD_FAIL="yes"
       addons:
         apt:
           packages:
@@ -182,14 +182,22 @@ matrix:
         - *default-cflags
 
 script:
-  - sh ./autogen.sh
   - |
+    sh ./autogen.sh
+
     if [[ "${NO_UNITTESTS}" != "yes" ]]; then
         ARGS="${ARGS} --enable-unittests"
     fi
+
     if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
         export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
-        ./configure --enable-nfqueue --enable-hiredis ${ARGS}
+        if ! ./configure --enable-nfqueue --enable-hiredis ${ARGS}; then
+            if [[ "${CONFIGURE_SHOULD_FAIL}" = "yes" ]]; then
+                EXIT_CODE=0
+            else
+                EXIT_CODE=1
+            fi
+        fi
     elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
         export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
         ./configure --enable-hiredis --enable-ipfw \
@@ -201,13 +209,17 @@ script:
             --with-libnspr-includes=/usr/local/opt/nspr/include/nspr \
             --with-libnspr-libraries=/usr/local/opt/nspr/lib ${ARGS}
     fi
-  - |
+
+    if [[ "${EXIT_CODE}" ]]; then
+        exit "${EXIT_CODE}"
+    fi
+
     # Linux container builds have 2 cores, make use of them.
     if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
         j="-j 2"
     fi
     make ${j}
-  - |
+
     # Like "make check", but fail on first error. We redirect the output
     # so Travis doesn't fail the build with a too much output error.
     if [[ "${NO_UNITTESTS}" != "yes" ]]; then
@@ -219,16 +231,17 @@ script:
             exit 1
         fi
     fi
+
     (cd qa/coccinelle && make check)
-  - |
+
     if [[ "$DO_DISTCHECK" == "yes" ]]; then
         make distcheck DISTCHECK_CONFIGURE_FLAGS="${ARGS}"
     fi
-  - |
+
     if [[ "$DO_CHECK_SETUP_SCRIPTS" == "yes" ]]; then
         (cd scripts && ./check-setup.sh)
     fi
-  - |
+
     git clone https://github.com/OISF/suricata-verify.git verify
     python ./verify/run.py