mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Switch CI scripts to use ASAN/LSAN instead of gperftools
Using AddressSanitizer/LeakSanitizer is better. It covers the full unit/baseline test suite by default without requiring one to write specific memory leak tests. It also covers other types of memory errors besides just leaks.
This commit is contained in:
parent
e6f4e01041
commit
38505589e1
4 changed files with 23 additions and 91 deletions
13
.cirrus.yml
13
.cirrus.yml
|
@ -3,7 +3,7 @@ btest_jobs: &BTEST_JOBS 8
|
|||
memory: &MEMORY 8GB
|
||||
|
||||
config: &CONFIG --build-type=release --enable-cpp-tests
|
||||
leak_config: &LEAK_CONFIG --build-type=debug --enable-perftools-debug
|
||||
memcheck_config: &MEMCHECK_CONFIG --build-type=debug --enable-cpp-tests --sanitizers=address
|
||||
|
||||
resources_template: &RESOURCES_TEMPLATE
|
||||
cpu: *CPUS
|
||||
|
@ -16,8 +16,7 @@ ci_template: &CI_TEMPLATE
|
|||
$CIRRUS_BRANCH =~ 'release/.*'
|
||||
|
||||
# Default timeout is 60 minutes, Cirrus hard limit is 120 minutes for free
|
||||
# tasks. This leakcheck one can tend to run long, but see no downside
|
||||
# to universally asking for the maximum.
|
||||
# tasks, so may as well ask for full time.
|
||||
timeout_in: 120m
|
||||
|
||||
sync_submodules_script: git submodule update --recursive --init
|
||||
|
@ -114,13 +113,11 @@ freebsd_task:
|
|||
prepare_script: ./ci/freebsd/prepare.sh
|
||||
<< : *CI_TEMPLATE
|
||||
|
||||
leakcheck_task:
|
||||
memcheck_task:
|
||||
container:
|
||||
# Just uses a recent/common distro to run leak checks.
|
||||
# Just uses a recent/common distro to run memory error/leak checks.
|
||||
dockerfile: ci/ubuntu-18.04/Dockerfile
|
||||
<< : *RESOURCES_TEMPLATE
|
||||
<< : *CI_TEMPLATE
|
||||
env:
|
||||
ZEEK_CI_LEAK_CHECK: true
|
||||
ZEEK_CI_CONFIGURE_FLAGS: *LEAK_CONFIG
|
||||
ZEEK_CI_BTEST_JOBS: 7
|
||||
ZEEK_CI_CONFIGURE_FLAGS: *MEMCHECK_CONFIG
|
||||
|
|
56
ci/test.sh
56
ci/test.sh
|
@ -2,8 +2,7 @@
|
|||
|
||||
# It's possible to use this script locally from the zeek repo's root dir.
|
||||
# The parallelism level when running tests locally is $1 if provided, else
|
||||
# the value of `nproc` if available, otherwise just a single core. Run with
|
||||
# ZEEK_CI_LEAK_CHECK set to do just the leak checks.
|
||||
# the value of `nproc` if available, otherwise just a single core.
|
||||
|
||||
result=0
|
||||
BTEST=$(pwd)/aux/btest/btest
|
||||
|
@ -102,57 +101,10 @@ function run_external_btests
|
|||
fi
|
||||
}
|
||||
|
||||
function run_leak_tests
|
||||
{
|
||||
local zeek_testing_pid=""
|
||||
local zeek_testing_pid_private=""
|
||||
banner "Running memory leak tests: zeek"
|
||||
|
||||
pushd testing/btest
|
||||
${BTEST} -d -b -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} -g leaks || result=1
|
||||
prep_artifacts
|
||||
popd
|
||||
|
||||
pushd testing/external/zeek-testing
|
||||
${BTEST} -d -b -x btest-results.xml -j ${ZEEK_CI_BTEST_JOBS} -g leaks >btest.out 2>&1 &
|
||||
zeek_testing_pid=$!
|
||||
popd
|
||||
|
||||
if [[ -d testing/external/zeek-testing-private ]]; then
|
||||
pushd testing/external/zeek-testing-private
|
||||
# Note that we don't use btest's "-d" flag or generate/upload any
|
||||
# artifacts to prevent leaking information about the private pcaps.
|
||||
${BTEST} -b -j ${ZEEK_CI_BTEST_JOBS} -g leaks >btest.out 2>&1 &
|
||||
zeek_testing_private_pid=$!
|
||||
popd
|
||||
fi
|
||||
|
||||
banner "Running memory leak tests: external/zeek-testing"
|
||||
wait ${zeek_testing_pid} || result=1
|
||||
pushd testing/external/zeek-testing
|
||||
cat btest.out
|
||||
prep_artifacts
|
||||
popd
|
||||
|
||||
if [[ -n "${zeek_testing_private_pid}" ]]; then
|
||||
banner "Running memory leak tests: external/zeek-testing-private"
|
||||
wait ${zeek_testing_private_pid} || result=1
|
||||
cat testing/external/zeek-testing-private/btest.out
|
||||
else
|
||||
banner "Skipping private tests (not available for PRs)"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
banner "Start tests: ${ZEEK_CI_CPUS} cpus, ${ZEEK_CI_BTEST_JOBS} btest jobs"
|
||||
|
||||
if [[ -n "${ZEEK_CI_LEAK_CHECK}" ]]; then
|
||||
run_leak_tests
|
||||
else
|
||||
run_unit_tests
|
||||
run_btests
|
||||
run_external_btests
|
||||
fi
|
||||
run_unit_tests
|
||||
run_btests
|
||||
run_external_btests
|
||||
|
||||
exit ${result}
|
||||
|
|
|
@ -100,7 +100,7 @@ install_in_docker() {
|
|||
distro_cmds="apt-get update; apt-get -y install wget xz-utils 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"
|
||||
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"
|
||||
local_distro="ubuntu_18.04"
|
||||
;;
|
||||
*)
|
||||
|
@ -168,7 +168,7 @@ build() {
|
|||
./configure --build-type=Release --disable-broker-tests --enable-cpp-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
|
||||
./configure --build-type=Debug --disable-broker-tests --enable-cpp-tests --disable-python --disable-zeekctl --sanitizers=address && make -j 2
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,6 @@ run() {
|
|||
ulimit -a
|
||||
ret=0
|
||||
|
||||
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
|
||||
echo
|
||||
echo "Running unit tests ##################################################"
|
||||
echo
|
||||
|
@ -222,7 +221,6 @@ run() {
|
|||
fi
|
||||
|
||||
set -e
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Running baseline tests ##############################################"
|
||||
|
@ -231,11 +229,7 @@ run() {
|
|||
|
||||
set +e
|
||||
# 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
|
||||
else
|
||||
../../aux/btest/btest -j 4 -d -g leaks
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
ret=1
|
||||
|
@ -278,11 +272,7 @@ run() {
|
|||
|
||||
if [ -d zeek-testing ]; then
|
||||
cd zeek-testing
|
||||
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
|
||||
make
|
||||
else
|
||||
make leaks
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
showdiag
|
||||
|
@ -294,11 +284,7 @@ run() {
|
|||
|
||||
if [ -d zeek-testing-private ]; then
|
||||
cd zeek-testing-private
|
||||
if [ "${BUILD_DISTRO}" != "${LEAK_TEST_DISTRO}" ]; then
|
||||
make
|
||||
else
|
||||
make leaks
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
showdiag
|
||||
|
|
|
@ -20,9 +20,6 @@ RUN apt-get update && apt-get -y install \
|
|||
sqlite3 \
|
||||
curl \
|
||||
wget \
|
||||
google-perftools \
|
||||
libgoogle-perftools4 \
|
||||
libgoogle-perftools-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Many distros adhere to PEP 394's recommendation for `python` = `python2` so
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue