CI: Enable Address Sanitizer (ASAN) where supported

GCC on MSYS2 doesn't have ASAN support.

And do not enable it for MSVC "Release" target.
This commit is contained in:
Ingvar Stepanyan
2023-11-25 12:39:18 +00:00
committed by Tormod Volden
parent e28fa3069a
commit c0057c3942
4 changed files with 18 additions and 3 deletions

View File

@@ -18,4 +18,5 @@ jobs:
run: |
echo 'Running in MSYS2!'
./bootstrap.sh
./.private/ci-build.sh --build-dir build-msys2
# GCC on MSYS2 doesn't have ASAN support (but Clang does).
./.private/ci-build.sh --build-dir build-msys2 --no-asan

View File

@@ -19,4 +19,8 @@ echo "Bootstrapping ..."
./bootstrap.sh
echo ""
exec .private/ci-build.sh --build-dir "${builddir}" --install -- "--prefix=${installdir}"
extra_args=""
if [ "${Configuration}" == "Release" ]; then
extra_args="--no-asan"
fi
exec .private/ci-build.sh --build-dir "${builddir}" --install ${extra_args} -- "--prefix=${installdir}"

View File

@@ -5,6 +5,7 @@ set -e
builddir=
install=no
test=yes
asan=yes
while [ $# -gt 0 ]; do
case "$1" in
@@ -24,6 +25,10 @@ while [ $# -gt 0 ]; do
test=no
shift
;;
--no-asan)
asan=no
shift
;;
--)
shift
break;
@@ -57,6 +62,11 @@ cflags+=" -Wpointer-arith"
cflags+=" -Wredundant-decls"
cflags+=" -Wswitch-enum"
# enable address sanitizer
if [ "${asan}" = "yes" ]; then
cflags+=" -fsanitize=address"
fi
echo ""
echo "Configuring ..."
CFLAGS="${cflags}" ../configure --enable-examples-build --enable-tests-build "$@"

View File

@@ -1 +1 @@
#define LIBUSB_NANO 11822
#define LIBUSB_NANO 11823