ci: add memory sanitization check
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone/pr Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone/pr Build was killed
				
			This commit is contained in:
		
							parent
							
								
									798732632a
								
							
						
					
					
						commit
						1c27e4d2c7
					
				
					 3 changed files with 96 additions and 1 deletions
				
			
		
							
								
								
									
										67
									
								
								tools/ci/images/memory_sanitizer/Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								tools/ci/images/memory_sanitizer/Dockerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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_msan \
 | 
				
			||||||
 | 
					    -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=MemoryWithOrigins \
 | 
				
			||||||
 | 
					    ../runtimes \
 | 
				
			||||||
 | 
					    && ninja cxx cxxabi \
 | 
				
			||||||
 | 
					    && ninja -C . install-cxx install-cxxabi \
 | 
				
			||||||
 | 
					    && rm -r /llvm-project/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN git clone 'https://git.light7734.com/light7734/light.git' \
 | 
				
			||||||
 | 
					    && cd light \
 | 
				
			||||||
 | 
					    && conan install . \
 | 
				
			||||||
 | 
					        -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_msan/include/c++/v1/", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					        -c tools.build:sharedlinkflags='["-L/libcxx_msan/lib", "-Wl,-rpath,/libcxx_msan/lib", "-lc++", "-lc++abi", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					        -c tools.build:exelinkflags='["-L/libcxx_msan/lib", "-Wl,-rpath,/libcxx_msan/lib", "-lc++", "-lc++abi", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					        -c tools.info.package_id:confs='["tools.build:cxxflags","tools.build:sharedlinkflags","tools.build:exelinkflags"]' \
 | 
				
			||||||
 | 
					        -c tools.build:compiler_executables='{"c": "clang", "cpp": "clang++"}' \
 | 
				
			||||||
 | 
					        -s build_type=Release \
 | 
				
			||||||
 | 
					        -s compiler=clang \
 | 
				
			||||||
 | 
					        -s compiler.version=20 \
 | 
				
			||||||
 | 
					        -s compiler.libcxx=libc++ \
 | 
				
			||||||
 | 
					        -o use_mold=True \
 | 
				
			||||||
 | 
					        --build=missing
 | 
				
			||||||
							
								
								
									
										25
									
								
								tools/ci/steps/amd64/clang/msan.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								tools/ci/steps/amd64/clang/msan.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,25 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					cd $(git rev-parse --show-toplevel)/
 | 
				
			||||||
 | 
					rm -rf ./build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					conan build . \
 | 
				
			||||||
 | 
					    -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_msan/include/c++/v1/", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					    -c tools.build:sharedlinkflags='["-L/libcxx_msan/lib", "-Wl,-rpath,/libcxx_msan/lib", "-lc++", "-lc++abi", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					    -c tools.build:exelinkflags='["-L/libcxx_msan/lib", "-Wl,-rpath,/libcxx_msan/lib", "-lc++", "-lc++abi", "-fsanitize=memory", "-fsanitize-memory-track-origins"]' \
 | 
				
			||||||
 | 
					    -c tools.info.package_id:confs='["tools.build:cxxflags","tools.build:sharedlinkflags","tools.build:exelinkflags"]' \
 | 
				
			||||||
 | 
					    -c tools.build:compiler_executables='{"c": "clang", "cpp": "clang++"}' \
 | 
				
			||||||
 | 
					    -s build_type=Release \
 | 
				
			||||||
 | 
					    -s compiler=clang \
 | 
				
			||||||
 | 
					    -s compiler.version=20 \
 | 
				
			||||||
 | 
					    -s compiler.libcxx=libc++ \
 | 
				
			||||||
 | 
					    -o use_mold=True \
 | 
				
			||||||
 | 
					    --build=missing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for test in $(find ./build -type f -name '*_tests' -executable); do
 | 
				
			||||||
 | 
					  echo "Running $test"
 | 
				
			||||||
 | 
					  "$test"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -e
 | 
					set -e
 | 
				
			||||||
 | 
					 | 
				
			||||||
IMAGE_DIR="$(git rev-parse --show-toplevel)/tools/ci/images"
 | 
					IMAGE_DIR="$(git rev-parse --show-toplevel)/tools/ci/images"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "==> Building image: clang format"
 | 
					echo "==> Building image: clang format"
 | 
				
			||||||
| 
						 | 
					@ -24,4 +23,8 @@ echo "==> Building image: leak_sanitizer"
 | 
				
			||||||
cd "$IMAGE_DIR/leak_sanitizer"
 | 
					cd "$IMAGE_DIR/leak_sanitizer"
 | 
				
			||||||
docker build -t leak_sanitizer .
 | 
					docker build -t leak_sanitizer .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "==> Building image: memory_sanitizer"
 | 
				
			||||||
 | 
					cd "$IMAGE_DIR/memory_sanitizer"
 | 
				
			||||||
 | 
					docker build -t memory_sanitizer .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "WOOOOOOOOOOOOOOOOH!!! DONE :D"
 | 
					echo "WOOOOOOOOOOOOOOOOH!!! DONE :D"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue