tests: only preload libasan for gcc compilers
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 26 Aug 2022 17:50:53 +0000 (13:50 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 11 Sep 2023 15:24:02 +0000 (11:24 -0400)
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>
tests/utils/utils.sh

index 6107a610453e3dff10cfe3138cb556a2ebee113d..86099297e93872215669d3dd4c3fac8555466243 100644 (file)
@@ -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
 
This page took 0.024342 seconds and 4 git commands to generate.