Merge remote-tracking branch 'origin/topic/timw/travis-leaks'

* origin/topic/timw/travis-leaks:
  fixup! Add new distro to Travis CI configuration for running leak tests
  Add new distro to Travis CI configuration for running leak tests
This commit is contained in:
Jon Siwek 2019-08-12 13:00:21 -07:00
commit 18e4976c6c
6 changed files with 59 additions and 24 deletions

View file

@ -27,6 +27,7 @@ env:
- distro: fedora_28 - distro: fedora_28
- distro: ubuntu_16.04 - distro: ubuntu_16.04
- distro: ubuntu_18.04 - distro: ubuntu_18.04
- distro: ubuntu_18.04_leaktest
install: sh testing/scripts/travis-job install $distro install: sh testing/scripts/travis-job install $distro

View file

@ -1,4 +1,8 @@
3.1.0-dev.21 | 2019-08-12 13:00:21 -0700
* Add new distro to Travis CI configuration for running leak tests (Tim Wojtulewicz, Corelight)
3.1.0-dev.18 | 2019-08-09 10:43:28 -0700 3.1.0-dev.18 | 2019-08-09 10:43:28 -0700
* GH-419: improve multi-protocol logging in known_services.log (Mauro Palumbo) * GH-419: improve multi-protocol logging in known_services.log (Mauro Palumbo)

View file

@ -1 +1 @@
3.1.0-dev.18 3.1.0-dev.21

View file

@ -1 +1 @@
dc6a8f1de9f3b298406051282abcaa6e8f198695 9fbd6e3656f633ce62aa00875205e87fa0609a51

View file

@ -1 +1 @@
fdfcdffd464fd2114be03feacfd075d73a8b1ef9 0df146fde4f878b4b2219d96dc3a9a69f81b8ee1

View file

@ -8,11 +8,14 @@
# outside of Travis then you will need to fetch the private tests manually # outside of Travis then you will need to fetch the private tests manually
# (if you don't, then the private tests will be skipped). # (if you don't, then the private tests will be skipped).
LEAK_TEST_DISTRO="ubuntu_18.04_leaktest"
usage() { usage() {
echo "usage: $0 CMD DISTRO" echo "usage: $0 CMD DISTRO"
echo " CMD is a build step:" echo " CMD is a build step:"
echo " install: install prereqs" echo " install: install prereqs"
echo " build: build zeek" echo " build: build zeek"
echo " build_leaktests: build zeek with memory leak testing enabled"
echo " run: run the tests" echo " run: run the tests"
echo " all: do all of the above" echo " all: do all of the above"
echo " DISTRO is a Linux distro, 'travis' to run without docker, or 'coverity' to run a coverity scan" echo " DISTRO is a Linux distro, 'travis' to run without docker, or 'coverity' to run a coverity scan"
@ -78,6 +81,7 @@ run_coverity() {
# Create a docker container, and install all packages needed to build Zeek. # Create a docker container, and install all packages needed to build Zeek.
install_in_docker() { install_in_docker() {
local_distro=$distro
case $distro in case $distro in
centos_7) centos_7)
distro_cmds="yum -y install gdb cmake make gcc gcc-c++ flex bison libpcap-devel openssl-devel git openssl which" distro_cmds="yum -y install gdb cmake make gcc gcc-c++ flex bison libpcap-devel openssl-devel git openssl which"
@ -94,13 +98,17 @@ install_in_docker() {
ubuntu_18.04) ubuntu_18.04)
distro_cmds="apt-get update; apt-get -y install gdb cmake make gcc g++ flex bison python3 libpcap-dev libssl-dev zlib1g-dev libkrb5-dev git sqlite3 curl bsdmainutils; ln -s /usr/bin/python3 /usr/local/bin/python" distro_cmds="apt-get update; apt-get -y install gdb cmake make gcc g++ flex bison python3 libpcap-dev libssl-dev zlib1g-dev libkrb5-dev git sqlite3 curl bsdmainutils; ln -s /usr/bin/python3 /usr/local/bin/python"
;; ;;
${LEAK_TEST_DISTRO})
distro_cmds="apt-get update; apt-get -y install gdb cmake make gcc g++ flex bison python3 libpcap-dev libssl-dev zlib1g-dev libkrb5-dev git sqlite3 curl bsdmainutils google-perftools libgoogle-perftools4 libgoogle-perftools-dev; ln -s /usr/bin/python3 /usr/local/bin/python"
local_distro="ubuntu_18.04"
;;
*) *)
echo "Error: distro ${distro} is not recognized by this script" echo "Error: distro ${distro} is not recognized by this script"
exit 1 exit 1
;; ;;
esac esac
docker_image=`echo $distro | tr '_' ':'` docker_image=`echo $local_distro | tr '_' ':'`
docker run --name zeektest -id -v "`pwd`:/zeek" -w /zeek ${docker_image} sh docker run --name zeektest -id -v "`pwd`:/zeek" -w /zeek ${docker_image} sh
docker exec zeektest sh -c "${distro_cmds}" docker exec zeektest sh -c "${distro_cmds}"
} }
@ -108,13 +116,17 @@ install_in_docker() {
# Build Zeek in a docker container. # Build Zeek in a docker container.
build_in_docker() { build_in_docker() {
docker exec zeektest sh testing/scripts/travis-job build travis # Pass the distro as a different environment variable name to docker since
# the script will set $distro to "travis" as part of the invocation.
docker exec -e BUILD_DISTRO=${distro} zeektest sh testing/scripts/travis-job build travis
} }
# Run Zeek tests in a docker container. # Run Zeek tests in a docker container.
run_in_docker() { run_in_docker() {
docker exec -t -e TRAVIS -e TRAVIS_PULL_REQUEST -e TESTING_PRIVATE_DEPLOYKEY zeektest sh testing/scripts/travis-job run travis # Pass the distro as a different environment variable name to docker since
# the script will set $distro to "travis" as part of the invocation.
docker exec -t -e TRAVIS -e TRAVIS_PULL_REQUEST -e TESTING_PRIVATE_DEPLOYKEY -e BUILD_DISTRO=${distro} zeektest sh testing/scripts/travis-job run travis
} }
@ -125,11 +137,16 @@ build() {
make distclean > /dev/null make distclean > /dev/null
# Skip building Broker tests, python bindings, and zeekctl, as these are # Skip building Broker tests, python bindings, and zeekctl, as these are
# not needed by the Zeek tests. # not needed by the Zeek tests. If the distro is set for leak tests, enable
# those options as well.
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
./configure --build-type=Release --disable-broker-tests --disable-python --disable-zeekctl && make -j 2 ./configure --build-type=Release --disable-broker-tests --disable-python --disable-zeekctl && make -j 2
else
echo "Configuring zeek to build for leak testing"
./configure --build-type=Debug --disable-broker-tests --disable-python --disable-zeekctl --enable-perftools --enable-perftools-debug && make -j 2
fi
} }
# Get the private tests. # Get the private tests.
get_private_tests() { get_private_tests() {
if [ "${TRAVIS}" != "true" ]; then if [ "${TRAVIS}" != "true" ]; then
@ -170,7 +187,12 @@ run() {
set +e set +e
# Must specify a value for "-j" option, otherwise Travis uses a huge value. # Must specify a value for "-j" option, otherwise Travis uses a huge value.
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
../../aux/btest/btest -j 4 -d ../../aux/btest/btest -j 4 -d
else
../../aux/btest/btest -j 4 -d -g leaks
fi
ret=$? ret=$?
set -e set -e
@ -209,7 +231,11 @@ run() {
if [ -d zeek-testing ]; then if [ -d zeek-testing ]; then
cd zeek-testing cd zeek-testing
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
make make
else
make leaks
fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
showdiag showdiag
@ -221,7 +247,11 @@ run() {
if [ -d zeek-testing-private ]; then if [ -d zeek-testing-private ]; then
cd zeek-testing-private cd zeek-testing-private
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
make make
else
make leaks
fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
showdiag showdiag