diff --git a/.drone.yml b/.drone.yml index 3c533b3..3929ed9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -63,6 +63,47 @@ steps: find ./build -type f -name "*_tests" -executable | xargs -I {} bash -c 'valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --error-exitcode=255 {}' || exit 1 +--- +kind: pipeline +type: docker +name: leak sanitizer +clone: + recursive: true + submodule_update_remote: true + +trigger: + branch: + - main + +steps: +- name: leak sanitizer + image: leak_sanitizer:latest + pull: if-not-exists + commands: + - | + set -e + + git submodule update --init --recursive + conan build . \ + -s build_type=Release \ + -s compiler=clang \ + -s compiler.version=20 \ + -s compiler.libcxx=libc++ \ + -c tools.system.package_manager:mode=install \ + -c tools.cmake.cmaketoolchain:generator=Ninja \ + -c tools.build:cxxflags='["-g", "-fno-omit-frame-pointer", "-nostdinc++", "-isystem", "/libcxx_lsan/include/c++/v1/", "-fsanitize=leak"]' \ + -c tools.build:sharedlinkflags='["-L/libcxx_lsan/lib", "-Wl,-rpath,/libcxx_lsan/lib", "-lc++", "-lc++abi", "-fsanitize=leak"]' \ + -c tools.build:exelinkflags='["-L/libcxx_lsan/lib", "-Wl,-rpath,/libcxx_lsan/lib", "-lc++", "-lc++abi", "-fsanitize=leak"]' \ + -c tools.info.package_id:confs='["tools.build:cxxflags","tools.build:sharedlinkflags","tools.build:exelinkflags"]' \ + -c tools.build:compiler_executables='{"c": "clang", "cpp": "clang++"}' \ + -o enable_static_analysis=False \ + -o enable_tests=True \ + --build=missing + for test in $(find ./build -type f -name '*_tests' -executable); do + echo "Running $test" + "$test" + done + --- kind: pipeline type: docker diff --git a/tools/ci/images/leak_sanitizer/Dockerfile b/tools/ci/images/leak_sanitizer/Dockerfile new file mode 100644 index 0000000..bf5e456 --- /dev/null +++ b/tools/ci/images/leak_sanitizer/Dockerfile @@ -0,0 +1,67 @@ +FROM archlinux:base-devel + +RUN pacman -Syu --noconfirm && \ + pacman -S --noconfirm \ + bash \ + base-devel \ + clang \ + llvm \ + cmake \ + git \ + python \ + python-pip \ + mesa \ + mold \ + ninja \ + zlib \ + libunwind + +RUN pip install --no-cache-dir --break-system-packages conan gitpython \ + && conan profile detect + +RUN clang --version \ + && conan --version \ + && pip --version \ + && cmake --version \ + && g++ --version \ + && clang --version \ + && ninja --version \ + && mold --version + +RUN git clone --depth=1 https://github.com/llvm/llvm-project.git -b llvmorg-20.1.8 \ + && cd llvm-project/ \ + && mkdir build/ \ + && cd build/ \ + && cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_LINKER_TYPE="MOLD" \ + -DCMAKE_INSTALL_PREFIX=/libcxx_lsan \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ + -DLLVM_ENABLE_PIC=ON \ + -DLIBCXX_INSTALL_MODULES=ON \ + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \ + -DLLVM_USE_SANITIZER=Leaks \ + ../runtimes \ + && ninja cxx cxxabi \ + && ninja -C . install-cxx install-cxxabi \ + && rm -r /llvm-project/ + +RUN git clone 'https://git.light7734.com/light7734/light.git' --recursive \ + && cd light \ + && conan install . \ + -s build_type=Release \ + -s compiler=clang \ + -s compiler.version=20 \ + -s compiler.libcxx=libc++ \ + -c tools.system.package_manager:mode=install \ + -c tools.cmake.cmaketoolchain:generator=Ninja \ + -c tools.build:cxxflags='["-g", "-fno-omit-frame-pointer", "-nostdinc++", "-isystem", "/libcxx_lsan/include/c++/v1/", "-fsanitize=leak"]' \ + -c tools.build:sharedlinkflags='["-L/libcxx_lsan/lib", "-Wl,-rpath,/libcxx_lsan/lib", "-lc++", "-lc++abi", "-fsanitize=leak"]' \ + -c tools.build:exelinkflags='["-L/libcxx_lsan/lib", "-Wl,-rpath,/libcxx_lsan/lib", "-lc++", "-lc++abi", "-fsanitize=leak"]' \ + -c tools.info.package_id:confs='["tools.build:cxxflags","tools.build:sharedlinkflags","tools.build:exelinkflags"]' \ + -c tools.build:compiler_executables='{"c": "clang", "cpp": "clang++"}' \ + --build=missing +