light/tools/ci/amd64/clang/lsan.sh

39 lines
885 B
Bash
Raw Normal View History

#!/bin/bash
set -e
cd $(git rev-parse --show-toplevel)/
2025-10-08 08:58:27 +03:30
rm -rf ./build && mkdir build/
2025-09-21 13:52:32 +03:30
2025-09-21 14:11:58 +03:30
Xvfb :99 -screen 0 1024x768x16 &
2025-09-21 13:52:32 +03:30
export CXX=$(which clang++)
export CC=$(which clang)
2025-09-21 14:11:58 +03:30
export DISPLAY=:99
2025-10-08 08:58:27 +03:30
cmake . \
-Bbuild \
-GNinja \
-DCMAKE_LINKER_TYPE=MOLD \
-DENABLE_UNIT_TESTS=ON \
-DCMAKE_BUILD_TYPE=Debug \
2025-09-21 13:52:32 +03:30
-DCMAKE_CXX_FLAGS=" \
-fsanitize=leak \
-g \
-fno-omit-frame-pointer \
-std=c++23 \
-nostdinc++ \
-isystem /libcxx_lsan/include/c++/v1/" \
2025-09-21 13:52:32 +03:30
-DCMAKE_EXE_LINKER_FLAGS=" \
-fsanitize=leak \
-L/libcxx_lsan/lib \
-lc++ \
-lc++abi \
-Wl,-rpath,/libcxx_lsan/lib" \
2025-10-08 09:02:15 +03:30
&& cmake --build ./build -j`nproc`
2025-10-09 12:42:17 +03:30
export LSAN_OPTIONS="suppressions=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/lsan.supp:fast_unwind_on_malloc=0"
export LSAN_SYMBOLIZER_PATH="$(which llvm-symbolizer)"
2025-10-08 09:02:15 +03:30
for test in $(find ./build -type f -name '*_tests' -executable); do
2025-10-09 12:13:43 +03:30
echo "Running $test"
"$test"
done