From ccd748f4f1f4929b0103b399b2bbf747d82062eb Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sun, 10 Apr 2022 14:05:54 +0200 Subject: [PATCH] Add UBSan and ASan to CI --- .github/workflows/clang-sanitizer.yml | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/clang-sanitizer.yml diff --git a/.github/workflows/clang-sanitizer.yml b/.github/workflows/clang-sanitizer.yml new file mode 100644 index 00000000000..6bcc243c517 --- /dev/null +++ b/.github/workflows/clang-sanitizer.yml @@ -0,0 +1,44 @@ +name: Check ASan & UBSan + +on: + push: + branches-ignore: + - master + - staging.tmp + - trying.tmp + - staging-squash-merge.tmp + pull_request: + +jobs: + check-clang-san: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Prepare linux + run: | + sudo apt-get update -y + sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libvulkan-dev glslang-tools spirv-tools -y + - name: Build with ASan and UBSan + run: | + mkdir san + cd san + export CC=clang + export CXX=clang++ + export CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" + export CFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" + cmake -DCMAKE_BUILD_TYPE=Debug -DHEADLESS_CLIENT=ON .. + make -j"$(nproc)" + - name: Run server and headless client with ASan and UBSan + run: | + cd san + export UBSAN_OPTIONS=log_path=./SAN:print_stacktrace=1:halt_on_errors=0 ASAN_OPTIONS=log_path=./SAN:print_stacktrace=1:check_initialization_order=1:detect_leaks=1:halt_on_errors=0 + ./DDNet "cl_download_skins 0;quit" || true + ./DDNet-Server shutdown || true + if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)" + then + cat ./SAN.* + exit 1 + fi