Clang appears to not use an external library for ASan, so we should not
try to preload it when building with clang.
Change-Id: I5cd88007fefcd7b8ad7caaee9155d3d9ea7f463e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10806
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
# existing ASAN_OPTIONS, such that we override the user's value if it
# contains detect_leaks=1.
if [ "${BT_TESTS_ENABLE_ASAN:-}" = "1" ]; then
- lib_asan=$(${BT_TESTS_CC_BIN} -print-file-name=libasan.so)
+ if ${BT_TESTS_CC_BIN} --version | head -n 1 | grep -q '^gcc'; then
+ lib_asan=$(${BT_TESTS_CC_BIN} -print-file-name=libasan.so)
+ env_args+=("LD_PRELOAD=${lib_asan}:${LD_PRELOAD:-}")
+ fi
- env_args+=("LD_PRELOAD=${lib_asan}:${LD_PRELOAD:-}")
env_args+=("ASAN_OPTIONS=${ASAN_OPTIONS:-},detect_leaks=0")
fi