Add AddressSanitizer support. Enable it by default in Travis CI builds.

This commit is contained in:
Alexey Kopytov
2017-01-16 09:34:13 +03:00
parent 60778578f8
commit 52e075cb0c
2 changed files with 12 additions and 2 deletions

View File

@ -68,7 +68,7 @@ before_script:
- psql -U postgres -c 'CREATE DATABASE sbtest'
script:
- ./autogen.sh && ./configure --enable-coverage --with-mysql --with-pgsql
- ./autogen.sh && ./configure --enable-coverage --enable-asan --with-mysql --with-pgsql
- make
- make distcheck
- SBTEST_MYSQL_ARGS="--mysql-user=root" SBTEST_PGSQL_ARGS="--pgsql-user=postgres" make test

View File

@ -81,6 +81,7 @@ then
OPTIMIZE_CFLAGS="-O2"
GCOV_CFLAGS="-O0 --coverage"
GCOV_LDFLAGS="-coverage"
ASAN_CFLAGS="-fsanitize=address"
fi
if test "$ax_cv_c_compiler_vendor" = "sun"
then
@ -320,7 +321,6 @@ fi
AC_CHECK_SIZEOF(size_t)
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_STRERROR_R
@ -400,6 +400,11 @@ AC_ARG_ENABLE([unreachable],
[ac_warn_unreachable="$enableval"],
[ac_warn_unreachable="no"])
AC_ARG_ENABLE([asan],
[AS_HELP_STRING([--enable-asan],
[Enable AddressSanitizer @<:@default=no@:>@])],
[ac_asan="$enableval"],
[ac_asan="no"])
AC_ARG_ENABLE([fail],
[AS_HELP_STRING([--disable-fail],
@ -427,6 +432,11 @@ else
CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS}"
fi
if test "$with_asan" = "yes"
then
CFLAGS="${ASAN_CFLAGS} ${CFLAGS}"
fi
if test "$GCC" = "yes"
then
if test "$ac_warn_fail" = "yes"