From: Simon Marchi Date: Fri, 26 Aug 2022 17:50:53 +0000 (-0400) Subject: tests: only preload libasan for gcc compilers X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=2d12d310de1f7bbb07c846d9b87079bf96d0ca6f tests: only preload libasan for gcc compilers 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 CI-Build: Philippe Proulx Tested-by: jenkins --- diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 6107a610..86099297 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -344,9 +344,11 @@ run_python_bt2() { # 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