travis.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. set -ev
  3. ./autogen.sh
  4. if [[ "${NO_UNITTESTS}" != "yes" ]]; then
  5. ARGS="${ARGS} --enable-unittests"
  6. fi
  7. export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
  8. if ! ./configure --enable-nfqueue --enable-hiredis ${ARGS}; then
  9. if [[ "${CONFIGURE_SHOULD_FAIL}" = "yes" ]]; then
  10. EXIT_CODE=0
  11. else
  12. EXIT_CODE=1
  13. fi
  14. fi
  15. if [[ "${EXIT_CODE}" ]]; then
  16. exit "${EXIT_CODE}"
  17. fi
  18. # Linux container builds have 2 cores, make use of them.
  19. if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
  20. j="-j 2"
  21. fi
  22. make ${j}
  23. # Like "make check", but fail on first error. We redirect the output
  24. # so Travis doesn't fail the build with a too much output error.
  25. if [[ "${NO_UNITTESTS}" != "yes" ]]; then
  26. set +e # disable
  27. mkdir -p ./qa/log
  28. ./src/suricata -u -l ./qa/log --fatal-unittests > unittests.log 2>&1
  29. if [[ $? -ne 0 ]]; then
  30. echo "Unit tests failed, last 500 lines of output are:"
  31. tail -n 500 unittests.log
  32. exit 1
  33. fi
  34. set -e
  35. fi
  36. (cd qa/coccinelle && make check)
  37. if [[ "$DO_DISTCHECK" == "yes" ]]; then
  38. make distcheck DISTCHECK_CONFIGURE_FLAGS="${ARGS}"
  39. fi
  40. if [[ "$DO_CHECK_SETUP_SCRIPTS" == "yes" ]]; then
  41. (cd scripts && ./check-setup.sh)
  42. fi
  43. git clone https://github.com/OISF/suricata-verify.git verify
  44. python ./verify/run.py