light/tools/ci/amd64/gcc/valgrind.sh

46 lines
978 B
Bash
Raw Normal View History

#!/bin/bash
2025-10-16 14:32:48 +03:30
set -euo pipefail
cd "$(git rev-parse --show-toplevel)/"
2025-10-16 14:32:48 +03:30
CC=$(which gcc)
export CC
CXX=$(which g++)
export CXX
DISPLAY=:99
export DISPLAY
DEBUGINFOD_URLS="https://debuginfod.archlinux.org/"
export DEBUGINFOD_URLS
Xvfb :99 -screen 0 1024x768x16 &
2025-09-21 14:15:33 +03:30
# gcc uses libstdc++ by default
2025-10-16 14:32:48 +03:30
cmake \
-S . \
-B build \
-G Ninja \
-D CMAKE_LINKER_TYPE=MOLD \
-D ENABLE_UNIT_TESTS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_CXX_FLAGS="-std=c++23 -fno-omit-frame-pointer -fno-common -g"
cmake --build ./build -j"$(nproc)"
while IFS= read -r -d '' test; do
echo "Running $test"
2025-10-16 14:32:48 +03:30
valgrind \
2025-10-16 14:12:16 +03:30
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--num-callers=50 \
--gen-suppressions=all \
--suppressions='./tools/ci/amd64/gcc/valgrind.supp' \
2025-10-16 14:32:48 +03:30
--error-exitcode=255 "${test}" || exit 1
done < <(find ./build -type f -name '*_tests' -executable -print0)