# careful adherence to the documentation, so it's useful for testing
# that.
#
-arch:
- - amd64
- - ppc64le
- - s390x
- - arm64
os:
- linux
- - osx
dist: focal
-compiler:
- - gcc
- - clang
-
#
-# Linux runs on all of the architectures listed above; macOS currently
-# runs only on 64-bit x86, although the Spaceshipologists are all in a
-# tizzy about the possibility of Arm-based Macs. Suppress the macOS
-# builds that don't work.
+# Linux runs on all of the architectures listed above; macOS runs on
+# 64-bit x86 and 64-bit ARM, but Travis doesn't currently have a 64-bit
+# ARM macOS build environment. Suppress the macOS builds that don't work.
#
# In addition, with newer versions of macOS, Apple ships a "gcc" that's
# just another front end to Clang, presumably for backwards
#
# but we *have* no allow_failures jobs.
#
+
jobs:
fast_finish: true
- exclude:
- - arch: ppc64le
- os: osx
- - arch: s390x
- os: osx
- - arch: arm64
- os: osx
- - compiler: gcc
- os: osx
- - if: branch = coverity_scan
+ include:
+ - name: "amd64"
+ arch: amd64
+ if: branch = coverity_scan
+ - name: "arm64"
+ arch: arm64
+ if: branch != coverity_scan
+ - name: "ppc64le"
arch: ppc64le
- - if: branch = coverity_scan
+ if: branch != coverity_scan
+ - name: "s390x"
arch: s390x
- - if: branch = coverity_scan
- arch: arm64
+ if: branch != coverity_scan
cache: ccache
- secure: "DwUeukcRGl1vXNZDDt2237zCA58ZzmzWpCkPcb/Hpeh8OvRw1eBZJiu4L8iD2qtY4A/dPDvOeBiml5MF6bVri9Dui1yPkvkvFqIXzbK5CWS6Ye+NgSBNMwqnAjhTMv/x8I4Bvy9IhDGwj/2JXVUvjBddRMLRyr/ag+MDRB1IVAI="
# Coverity run condition (avoid matrix multiple runs), need customized
# build script. Need an update if new matrix cases.
- - coverity_scan_run_condition='"$TRAVIS_CPU_ARCH" = amd64 -a "$TRAVIS_OS_NAME" = linux -a "$CC" = gcc -a "$REMOTE" = enable -a "$CMAKE" = no -a "$CRYPTO" = yes -a "$BUILD_LIBPCAP" = yes'
+ - coverity_scan_run_condition='"$TRAVIS_CPU_ARCH" = amd64 -a "$TRAVIS_OS_NAME" = linux -a "$CC" = gcc'
# Coverity script test mode (if true no uploading, avoid reaching the quota)
# usual processing: false.
- coverity_scan_script_test_mode=false
- MAKEFLAGS='-j 2' # Travis CI VMs come with 2 cores
- matrix:
- # NOTE: REMOTE= is for the libpcap build, which is done with autotools
- # even if we're building tcpdump with CMake.
- # It's irrelevant if we're building tcpdump with the system libpcap.
- - BUILD_LIBPCAP=no CMAKE=no CRYPTO=no
- - BUILD_LIBPCAP=no CMAKE=no CRYPTO=yes
- - BUILD_LIBPCAP=no CMAKE=yes CRYPTO=no
- - BUILD_LIBPCAP=no CMAKE=yes CRYPTO=yes
- - BUILD_LIBPCAP=yes CMAKE=no REMOTE=disable CRYPTO=no
- - BUILD_LIBPCAP=yes CMAKE=no REMOTE=disable CRYPTO=yes
- - BUILD_LIBPCAP=yes CMAKE=no REMOTE=enable CRYPTO=no
- - BUILD_LIBPCAP=yes CMAKE=no REMOTE=enable CRYPTO=yes
-# The 'BUILD_LIBPCAP=yes CMAKE=yes' builds currently fail
-# - BUILD_LIBPCAP=yes CMAKE=yes REMOTE=disable CRYPTO=no
-# - BUILD_LIBPCAP=yes CMAKE=yes REMOTE=disable CRYPTO=yes
-# - BUILD_LIBPCAP=yes CMAKE=yes REMOTE=enable CRYPTO=no
-# - BUILD_LIBPCAP=yes CMAKE=yes REMOTE=enable CRYPTO=yes
addons:
coverity_scan:
- uname -a
- date
- gem install travis-conditions
- - if [ "$TRAVIS_OS_NAME" = osx ]; then brew update >/dev/null; fi
- if [ "$TRAVIS_OS_NAME" = linux ]; then apt list --installed 'lib*-dev'; fi
-install:
- - if [ "$TRAVIS_OS_NAME" = osx ]; then brew install libsmi | grep -v '%'; fi
-
before_script:
- - if [ "$BUILD_LIBPCAP" = yes ]; then (cd .. && echo '$ git clone [...] libpcap.git' && git clone --depth 3 --branch=master --quiet git://github.com/the-tcpdump-group/libpcap.git && cd libpcap && ./configure "--${REMOTE}-remote" --prefix=/tmp && make && make install); fi
+ - (cd .. && echo '$ git clone [...] libpcap.git' && git clone --depth 3 --branch=master --quiet git://github.com/the-tcpdump-group/libpcap.git)
script:
- - if [ "$COVERITY_SCAN_BRANCH" = 1 ]; then exit 0; fi
- - if [ "$TRAVIS_OS_NAME" = osx ]; then OSX_SSL_DIR=$(ls /usr/local/Cellar/openssl); echo "OSX_SSL_DIR=$OSX_SSL_DIR"; fi
- - touch .devel configure
- - if [ "$CMAKE" = no ]; then echo '$ ./configure [...]' && echo travis_fold:start:script.configure; fi
- - if [ "$CMAKE" = no ]; then ./configure --with-crypto=${CRYPTO} CPPFLAGS="-I/usr/local/Cellar/openssl/$OSX_SSL_DIR/include/" --prefix=/tmp; fi
- - if [ "$CMAKE" = no ]; then echo -n travis_fold:end:script.configure; fi
- - if [ "$CMAKE" = yes ]; then mkdir build; fi
- - if [ "$CMAKE" = yes ]; then cd build; fi
- - if [ "$CMAKE" = yes ]; then echo travis_fold:start:script.cmake; fi
- - if [ "$CMAKE" = yes ]; then cmake -DWITH_CRYPTO="$CRYPTO" -DCMAKE_PREFIX_PATH=/tmp -DCMAKE_INSTALL_PREFIX=/tmp ..; fi
- - if [ "$CMAKE" = yes ]; then echo -n travis_fold:end:script.cmake; fi
- - make -s CFLAGS=-Werror
- - echo '$ make install [...]' && echo travis_fold:start:script.make_install
- - PATH=$PATH make install
- - echo -n travis_fold:end:script.make_install
- - if [ "$BUILD_LIBPCAP" = yes ]; then make check; fi
- - ./tcpdump --version
- - ./tcpdump -h
- - ./tcpdump -D
- - sudo ./tcpdump -J
- - sudo ./tcpdump -L
- - if [ "$TRAVIS_OS_NAME" = linux -a "$TRAVIS_CPU_ARCH" != ppc64le -a "$TRAVIS_CPU_ARCH" != s390x -a "$TRAVIS_CPU_ARCH" != arm64 ]; then sudo ./tcpdump -#n -c 10; fi
- - if [ "$CMAKE" = no ]; then make releasetar; fi
- - echo '$ cat Makefile [...]'; echo travis_fold:start:script.cat_makefile
- - if [ "$CMAKE" = no ]; then cat Makefile | sed -n '1,/DO NOT DELETE THIS LINE -- mkdep uses it/p'; fi
- - if [ "$CMAKE" = yes ]; then cat Makefile; fi
- - echo -n travis_fold:end:script.cat_makefile
- - echo '$ cat config.h'; echo travis_fold:start:script.cat_config_h
- - cat config.h
- - echo -n travis_fold:end:script.cat_config_h
- - if [ "$CMAKE" = no ]; then echo '$ cat config.log'; echo travis_fold:start:script.cat_config_log; fi
- - if [ "$CMAKE" = no ]; then cat config.log; fi
- - if [ "$CMAKE" = no ]; then echo -n travis_fold:end:script.cat_config_log; fi
- - if [ "$TRAVIS_OS_NAME" = osx ]; then sleep 10; fi
+ # On the other hand, using travis_terminate on macOS appears to
+ # *cause* the problem, so we do so only on Linux.
+ #
+ - if [ "$COVERITY_SCAN_BRANCH" = 1 ]; then if [ "$TRAVIS_OS_NAME" = linux ]; then travis_terminate 0; else exit 0; fi; fi
+ - ./build_matrix.sh
--- /dev/null
+#!/usr/bin/env bash
+
+# This script runs one build with setup environment variables: BUILD_LIBPCAP,
+# REMOTE, CC, CMAKE, CRYPTO and SMB
+# (default: BUILD_LIBPCAP=no, REMOTE=no, CC=gcc, CMAKE=no, CRYPTO=no, SMB=no).
+
+set -e
+
+# BUILD_LIBPCAP: no or yes
+BUILD_LIBPCAP=${BUILD_LIBPCAP:-no}
+# REMOTE: no or yes
+REMOTE=${REMOTE:-no}
+# CC: gcc or clang
+CC=${CC:-gcc}
+# CMAKE: no or yes
+CMAKE=${CMAKE:-no}
+# CRYPTO: no or yes
+CRYPTO=${CRYPTO:-no}
+# SMB: no or yes
+SMB=${SMB:-no}
+# Install directory prefix
+PREFIX=/tmp/local
+# For TESTrun
+export TCPDUMP_BIN=/tmp/local/bin/tcpdump
+
+travis_fold() {
+ local action="$1"
+ local name="$2"
+ if [ "$TRAVIS" != true ]; then return; fi
+ echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
+ sleep 1
+}
+
+# Run a command after displaying it
+run_after_echo() {
+ echo -n '$ '
+ echo "$@"
+ $@
+}
+
+# LABEL is needed to build the travis fold labels
+LABEL="$BUILD_LIBPCAP.$REMOTE.$CC.$CMAKE.$CRYPTO.$SMB"
+if [ "$CMAKE" = no ]; then
+ echo '$ ./configure [...]'
+ travis_fold start configure
+ if [ "$BUILD_LIBPCAP" = yes ]; then
+ echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
+ ./configure --with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix=$PREFIX
+ export LD_LIBRARY_PATH=$PREFIX/lib
+ else
+ ./configure --disable-local-libpcap --with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix=$PREFIX
+ fi
+ travis_fold end configure
+else
+ rm -rf build
+ mkdir build
+ cd build
+ echo '$ cmake [...]'
+ travis_fold start cmake
+ if [ "$BUILD_LIBPCAP" = yes ]; then
+ cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$PREFIX ..
+ export LD_LIBRARY_PATH=$PREFIX/lib
+ else
+ cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_INSTALL_PREFIX=$PREFIX ..
+ fi
+ travis_fold end cmake
+fi
+run_after_echo "make -s clean"
+run_after_echo "make -s CFLAGS=-Werror"
+echo '$ make install'
+travis_fold start make_install
+make install
+travis_fold end make_install
+run_after_echo "$TCPDUMP_BIN --version"
+run_after_echo "$TCPDUMP_BIN -h"
+run_after_echo "$TCPDUMP_BIN -D"
+system=$(uname -s)
+if [ "$system" = Linux ]; then
+ run_after_echo "ldd $TCPDUMP_BIN"
+fi
+if [ "$TRAVIS" = true ]; then
+ if [ -n "$LD_LIBRARY_PATH" ]; then
+ run_after_echo "sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -J"
+ run_after_echo "sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -L"
+ else
+ run_after_echo "sudo $TCPDUMP_BIN -J"
+ run_after_echo "sudo $TCPDUMP_BIN -L"
+ fi
+fi
+if [ "$BUILD_LIBPCAP" = yes ]; then
+ run_after_echo "make check"
+fi
+if [ "$CMAKE" = no ]; then
+ system=$(uname -s)
+ if [ "$system" = Darwin ] || [ "$system" = Linux ]; then
+ run_after_echo "make releasetar"
+ fi
+fi
+if [ "$TRAVIS" = true ]; then
+ if [ "$TRAVIS_OS_NAME" = linux ] && [ "$TRAVIS_CPU_ARCH" != ppc64le ] && [ "$TRAVIS_CPU_ARCH" != s390x ] && [ "$TRAVIS_CPU_ARCH" != arm64 ]; then
+ if [ -n "$LD_LIBRARY_PATH" ]; then
+ run_after_echo "sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -#n -c 10"
+ else
+ run_after_echo "sudo $TCPDUMP_BIN -#n -c 10"
+ fi
+ fi
+fi
+# The DEBUG_BUILD variable is not set by default to avoid Travis error message:
+# "The job exceeded the maximum log length, and has been terminated."
+# Setting it needs to reduce the matrix cases.
+if [ "$TRAVIS" = true ] && [ -n "$DEBUG_BUILD" ] ; then
+ echo '$ cat Makefile [...]'
+ travis_fold start cat_makefile
+ if [ "$CMAKE" = no ]; then
+ sed -n '1,/DO NOT DELETE THIS LINE -- mkdep uses it/p' < Makefile
+ else
+ cat Makefile
+ fi
+ travis_fold end cat_makefile
+ echo '$ cat config.h'
+ travis_fold start cat_config_h
+ cat config.h
+ travis_fold end cat_config_h
+ if [ "$CMAKE" = no ]; then
+ echo '$ cat config.log'
+ travis_fold start cat_config_log
+ cat config.log
+ travis_fold end cat_config_log
+ fi
+fi
+# vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :
--- /dev/null
+#!/usr/bin/env bash
+
+# This script executes the matrix loops, exclude tests and cleaning.
+# It calls the build.sh script which runs one build with setup environment
+# variables: BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
+# (default: BUILD_LIBPCAP=no, REMOTE=no, CC=gcc, CMAKE=no, CRYPTO=no, SMB=no).
+# The matrix can be configured with environment variables
+# MATRIX_BUILD_LIBPCAP, MATRIX_REMOTE, MATRIX_CC, MATRIX_CMAKE, MATRIX_CRYPTO
+# and MATRIX_SMB
+# (default: MATRIX_BUILD_LIBPCAP='no yes', MATRIX_REMOTE='no yes',
+# MATRIX_CC='gcc clang', MATRIX_CMAKE='no yes', MATRIX_CRYPTO='no yes',
+# MATRIX_SMB='no yes').
+
+set -e
+
+# ANSI color escape sequences
+ANSI_MAGENTA="\\033[35;1m"
+ANSI_RESET="\\033[0m"
+# Install directory prefix
+PREFIX=/tmp/local
+COUNT=0
+
+travis_fold() {
+ local action="$1"
+ local name="$2"
+ if [ "$TRAVIS" != true ]; then return; fi
+ echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
+ sleep 1
+}
+
+# Display text in magenta
+echo_magenta() {
+ echo -ne "$ANSI_MAGENTA"
+ echo "$@"
+ echo -ne "$ANSI_RESET"
+}
+
+build_tcpdump() {
+ for CC in ${MATRIX_CC:-gcc clang}; do
+ export CC
+ # Exclude gcc on OSX (it is just an alias for clang)
+ if [ "$CC" = gcc ] && [ "$TRAVIS_OS_NAME" = osx ]; then continue; fi
+ for CMAKE in ${MATRIX_CMAKE:-no yes}; do
+ export CMAKE
+ for CRYPTO in ${MATRIX_CRYPTO:-no yes}; do
+ export CRYPTO
+ for SMB in ${MATRIX_SMB:-no yes}; do
+ export SMB
+ COUNT=$((COUNT+1))
+ echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB ====="
+ # LABEL is needed to build the travis fold labels
+ LABEL="$BUILD_LIBPCAP.$REMOTE.$CC.$CMAKE.$CRYPTO.$SMB"
+ # Run one build with setup environment variables:
+ # BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
+ ./build.sh
+ echo 'Cleaning...'
+ travis_fold start cleaning
+ if [ "$CMAKE" = yes ]; then rm -rf build; else make distclean; fi
+ rm -rf $PREFIX/bin/tcpdump*
+ git status -suall
+ # Cancel changes in configure
+ git checkout configure
+ travis_fold end cleaning
+ done
+ done
+ done
+ done
+}
+
+choose_libpcap() {
+ if [ "$BUILD_LIBPCAP" = no ]; then
+ echo_magenta 'Use system libpcap'
+ rm -rf /tmp/local
+ else
+ # Build libpcap with autoconf
+ CMAKE_SAVE=$CMAKE
+ CMAKE=no
+ echo_magenta "Build libpcap (CMAKE=$CMAKE REMOTE=$REMOTE)"
+ (cd ../libpcap && ./build.sh && make distclean)
+ CMAKE=$CMAKE_SAVE
+ fi
+}
+
+touch .devel configure
+for BUILD_LIBPCAP in ${MATRIX_BUILD_LIBPCAP:-no yes}; do
+export BUILD_LIBPCAP
+ if [ "$BUILD_LIBPCAP" = yes ]; then
+ for REMOTE in ${MATRIX_REMOTE:-no}; do
+ export REMOTE
+ choose_libpcap
+ # Set PKG_CONFIG_PATH for configure when building libpcap
+ if [ "$CMAKE" != no ]; then
+ export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
+ fi
+ build_tcpdump
+ done
+ else
+ choose_libpcap
+ build_tcpdump
+ fi
+done
+
+rm -rf $PREFIX
+echo_magenta "Tested setup count: $COUNT"
+# vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :