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:
Jon Siwek 2020-01-02 13:16:25 -08:00
parent e6f4e01041
commit 38505589e1
4 changed files with 23 additions and 91 deletions

View file

@ -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}