scripts/run_tests.sh: add ASAN tests

This commit is contained in:
Eric Biggers 2020-10-18 14:21:26 -07:00
parent 3b12acdf32
commit 3b4a590f10
2 changed files with 24 additions and 0 deletions

View File

@ -47,14 +47,20 @@ jobs:
- dist: xenial
compiler: clang
arch: arm64
# ASAN fails with internal error
env: DISABLE_ASAN=1
- dist: xenial
compiler: gcc
arch: ppc64le
# ASAN fails with internal error
env: DISABLE_ASAN=1
- dist: xenial
compiler: clang
arch: ppc64le
# ASAN fails with internal error
env: DISABLE_ASAN=1
- dist: xenial
compiler: gcc

View File

@ -35,6 +35,13 @@ CC_VERSION=$($CC --version | head -1)
ARCH=$(uname -m)
# Allow setting DISABLE_ASAN=1 in the environment to disable the ASAN tests.
if [ "${DISABLE_ASAN:-}" = "1" ]; then
DISABLE_ASAN=true
else
DISABLE_ASAN=false
fi
###############################################################################
INDENT=0
@ -250,6 +257,17 @@ run_tests() {
log "Skipping UBSAN tests because compiler ($CC_VERSION) doesn't support UBSAN"
fi
cflags=("-fsanitize=address" "-fno-sanitize-recover=address")
if $DISABLE_ASAN; then
log "Skipping ASAN tests because DISABLE_ASAN=1 was set"
elif cflags_supported "${cflags[@]}"; then
begin "Running tests with ASAN"
CFLAGS="$CFLAGS ${cflags[*]}" do_run_tests --quick
end
else
log "Skipping ASAN tests because compiler ($CC_VERSION) doesn't support ASAN"
fi
install_uninstall_tests
check_symbol_prefixes
}