1name: Sanitizer checks 2 3on: 4 pull_request: 5 paths: 6 - '**' 7 - '!docs/**' 8 - '!.**' 9 - '.github/workflows/sanitizer.yml' 10 push: 11 branches: 12 - v[0-9].* 13 - master 14 15jobs: 16 sanitizers-linux: 17 runs-on: ubuntu-22.04 18 steps: 19 - uses: actions/checkout@v2 20 - name: Setup 21 run: | 22 sudo apt-get install ninja-build 23 - name: Envinfo 24 run: npx envinfo 25 26 - name: ASAN Build 27 run: | 28 mkdir build-asan 29 (cd build-asan && cmake .. -G Ninja -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug) 30 cmake --build build-asan 31 - name: ASAN Test 32 run: | 33 ./build-asan/uv_run_tests_a 34 35 - name: MSAN Build 36 run: | 37 mkdir build-msan 38 (cd build-msan && cmake .. -G Ninja -DBUILD_TESTING=ON -DMSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang) 39 cmake --build build-msan 40 - name: MSAN Test 41 run: | 42 ./build-msan/uv_run_tests_a 43 44 - name: TSAN Build 45 run: | 46 mkdir build-tsan 47 (cd build-tsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release) 48 cmake --build build-tsan 49 - name: TSAN Test 50 # Note: path must be absolute because some tests chdir. 51 # TSan exits with an error when it can't find the file. 52 run: | 53 env TSAN_OPTIONS="suppressions=$PWD/tsansupp.txt" ./build-tsan/uv_run_tests_a 54 55 - name: UBSAN Build 56 run: | 57 mkdir build-ubsan 58 (cd build-ubsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang) 59 cmake --build build-ubsan 60 - name: UBSAN Test 61 run: | 62 ./build-ubsan/uv_run_tests_a 63 64 sanitizers-macos: 65 runs-on: macos-11 66 steps: 67 - uses: actions/checkout@v2 68 69 - name: Envinfo 70 run: npx envinfo 71 72 - name: ASAN Build 73 run: | 74 mkdir build-asan 75 (cd build-asan && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug) 76 cmake --build build-asan 77 - name: ASAN Test 78 run: | 79 ./build-asan/uv_run_tests_a 80 81 - name: TSAN Build 82 run: | 83 mkdir build-tsan 84 (cd build-tsan && cmake .. -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release) 85 cmake --build build-tsan 86 - name: TSAN Test 87 run: | 88 ./build-tsan/uv_run_tests_a 89 90 - name: UBSAN Build 91 run: | 92 mkdir build-ubsan 93 (cd build-ubsan && cmake .. -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug) 94 cmake --build build-ubsan 95 - name: UBSAN Test 96 run: | 97 ./build-ubsan/uv_run_tests_a 98 99 sanitizers-windows: 100 runs-on: windows-2022 101 steps: 102 - uses: actions/checkout@v2 103 - name: Setup 104 run: | 105 choco install ninja 106 107 # Note: clang shipped with VS2022 has an issue where the UBSAN runtime doesn't link. 108 - name: Install LLVM and Clang 109 uses: KyleMayes/install-llvm-action@v1 110 with: 111 version: "17" 112 113 - name: Envinfo 114 run: npx envinfo 115 116 - name: UBSAN Build 117 run: | 118 mkdir build-ubsan 119 cmake -B build-ubsan -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang 120 cmake --build build-ubsan 121 - name: UBSAN Test 122 run: | 123 ./build-ubsan/uv_run_tests_a 124