summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorKarel Zak2017-11-23 14:59:05 +0100
committerKarel Zak2017-11-23 14:59:05 +0100
commitb97cc9a8299ad84bf75093dc390e36eb6ff77761 (patch)
treea8300730960d2378efadd3b867e73dd174d45e17 /tests/functions.sh
parenttests: rename --memcheck to --memcheck-valgrind (diff)
downloadkernel-qcow2-util-linux-b97cc9a8299ad84bf75093dc390e36eb6ff77761.tar.gz
kernel-qcow2-util-linux-b97cc9a8299ad84bf75093dc390e36eb6ff77761.tar.xz
kernel-qcow2-util-linux-b97cc9a8299ad84bf75093dc390e36eb6ff77761.zip
build-sys: add --enable-asan and --memcheck-asan for tests
The command ./configure --enable-asan adds -fsanitize=address to the compiler command line. In the regression tests leaks detection is disabled by default. You have to use --memcheck-asan on test command line to enable. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 7152a4e33..5b9b61c05 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -230,8 +230,9 @@ function ts_init_env {
LANGUAGE="POSIX"
LC_ALL="POSIX"
CHARSET="UTF-8"
+ ASAN_OPTIONS="detect_leaks=0"
- export LANG LANGUAGE LC_ALL CHARSET
+ export LANG LANGUAGE LC_ALL CHARSET ASAN_OPTIONS
mydir=$(ts_canonicalize "$mydir")
@@ -284,6 +285,10 @@ function ts_init_env {
if [ "$tmp" == "yes" -a -f /usr/bin/valgrind ]; then
TS_VALGRIND_CMD="/usr/bin/valgrind"
fi
+ tmp=$( ts_has_option "memcheck-asan" "$*")
+ if [ "$tmp" == "yes" ]; then
+ TS_ENABLE_ASAN="yes"
+ fi
BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
@@ -384,6 +389,11 @@ function ts_run {
$TS_VALGRIND_CMD --tool=memcheck --leak-check=full \
--leak-resolution=high --num-callers=20 \
--log-file="$TS_VGDUMP" "$@"
+ #
+ # ASAN mode
+ #
+ elif [ "$TS_ENABLE_ASAN" == "yes" ]; then
+ ASAN_OPTIONS='detect_leaks=1' "$@"
#
# Default mode