fixup! Add new distro to Travis CI configuration for running leak tests

This commit is contained in:
Tim Wojtulewicz 2019-08-09 11:01:16 -07:00
parent 80e3c42526
commit b9f6992c0e
3 changed files with 47 additions and 42 deletions

View file

@ -1 +1 @@
4e78e7e6f9baf56ec6303d2580f380628fd31e36 f09295557a33f20bd36415d100964ce5cadd8077

View file

@ -1 +1 @@
6fef8f0d8eb896856fa72551af65668d0ea01bf4 faf8fa15c30a116b5401b03044db6eecfa4dd693

View file

@ -8,6 +8,8 @@
# 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:"
@ -30,7 +32,6 @@ distro=$2
case $step in case $step in
install) ;; install) ;;
build) ;; build) ;;
build_leaktests) ;;
run) ;; run) ;;
all) ;; all) ;;
*) echo "Error: unknown build step: $step"; usage; exit 1 ;; *) echo "Error: unknown build step: $step"; usage; exit 1 ;;
@ -97,7 +98,7 @@ 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"
;; ;;
ubuntu_18.04_leaktest) ${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" 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" local_distro="ubuntu_18.04"
;; ;;
@ -115,17 +116,17 @@ install_in_docker() {
# Build Zeek in a docker container. # Build Zeek in a docker container.
build_in_docker() { build_in_docker() {
if [ "${distro}" = "ubuntu_18.04_leaktest" ]; then # Pass the distro as a different environment variable name to docker since
docker exec zeektest sh testing/scripts/travis-job build_leaktests travis # the script will set $distro to "travis" as part of the invocation.
else docker exec -e BUILD_DISTRO=${distro} zeektest sh testing/scripts/travis-job build travis
docker exec zeektest sh testing/scripts/travis-job build travis
fi
} }
# 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
} }
@ -136,21 +137,14 @@ 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
echo "Configuring for normal build" # 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"
# Build Zeek for leak testing
build_leaktests() {
# Cleanup any previous build (this is really only necessary if running this
# outside of Travis).
make distclean > /dev/null
# Skip building Broker tests, python bindings, and zeekctl, as these are
# not needed by the Zeek tests.
echo "Configuring with perftools for leak testing"
./configure --build-type=Debug --disable-broker-tests --disable-python --disable-zeekctl --enable-perftools --enable-perftools-debug && make -j 2 ./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.
@ -193,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
@ -232,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
@ -244,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
@ -359,8 +366,6 @@ elif [ "$distro" = "travis" ]; then
# a single line when viewing the "Job log" on the Travis CI web site). # a single line when viewing the "Job log" on the Travis CI web site).
if [ "$step" = "build" ]; then if [ "$step" = "build" ]; then
build build
elif [ "$step" = "build_leaktests" ]; then
build_leaktests
elif [ "$step" = "run" ]; then elif [ "$step" = "run" ]; then
run run
elif [ "$step" = "all" ]; then elif [ "$step" = "all" ]; then