UL_WARN_ADD([-Wno-unused-parameter], [NO_UNUSED_WARN_CFLAGS])
AC_SUBST([NO_UNUSED_WARN_CFLAGS])
+
+AC_ARG_ENABLE([asan],
+ AS_HELP_STRING([--enable-asan], [compile with Address Sanitizer]),
+ [], [enable_asan=no]
+)
+AS_IF([test "x$enable_asan" == xyes], [
+ UL_WARN_ADD([-fsanitize=address])
+])
+
+
+
dnl libtool-2
LT_INIT
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")
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"
$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
--force |\
--fake |\
--memcheck-valgrind |\
+ --memcheck-asan |\
--show-diff |\
--verbose |\
--skip-loopdevs |\
echo " --force execute demanding tests"
echo " --fake do not run, setup tests only"
echo " --memcheck-valgrind run with valgrind"
+ echo " --memcheck-asan enable ASAN (requires ./configure --enable-asan)"
echo " --verbose verbose mode"
echo " --show-diff show diff from failed tests"
echo " --nonroot ignore test suite if user is root"