reenable msan sanitizer workflow (#1589)
diff --git a/.github/libcxx-setup.sh b/.github/libcxx-setup.sh
index e39e310..8773b9c 100755
--- a/.github/libcxx-setup.sh
+++ b/.github/libcxx-setup.sh
@@ -1,27 +1,26 @@
#!/usr/bin/env bash
-# Checkout LLVM sources
-#git clone --depth=1 https://github.com/llvm/llvm-project.git llvm-project
-#
-## Setup libc++ options
-#if [ -z "$BUILD_32_BITS" ]; then
-# export BUILD_32_BITS=OFF && echo disabling 32 bit build
-#fi
-#
-## Build and install libc++ (Use unstable ABI for better sanitizer coverage)
-#cd ./llvm-project
-#cmake -DCMAKE_C_COMPILER=${CC} \
-# -DCMAKE_CXX_COMPILER=${CXX} \
-# -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-# -DCMAKE_INSTALL_PREFIX=/usr \
-# -DLIBCXX_ABI_UNSTABLE=OFF \
-# -DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \
-# -DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \
-# -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \
-# -S llvm -B llvm-build -G "Unix Makefiles"
-#make -C llvm-build -j3 cxx cxxabi
-#sudo make -C llvm-build install-cxx install-cxxabi
-#cd ..
+set -e
-sudo apt update
-sudo apt -y install libc++-dev libc++abi-dev
+# Checkout LLVM sources
+git clone --depth=1 https://github.com/llvm/llvm-project.git llvm-project
+
+## Setup libc++ options
+if [ -z "$BUILD_32_BITS" ]; then
+ export BUILD_32_BITS=OFF && echo disabling 32 bit build
+fi
+
+## Build and install libc++ (Use unstable ABI for better sanitizer coverage)
+mkdir llvm-build && cd llvm-build
+cmake -DCMAKE_C_COMPILER=${CC} \
+ -DCMAKE_CXX_COMPILER=${CXX} \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DLIBCXX_ABI_UNSTABLE=OFF \
+ -DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \
+ -DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \
+ -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
+ -G "Unix Makefiles" \
+ ../llvm-project/runtimes/
+make -j cxx cxxabi unwind
+cd ..
diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml
index 4cb93f4..86cccf4 100644
--- a/.github/workflows/sanitizer.yml
+++ b/.github/workflows/sanitizer.yml
@@ -9,15 +9,14 @@
jobs:
job:
- name: ${{ matrix.sanitizer }}.${{ matrix.build_type }}.${{ matrix.compiler }}
+ name: ${{ matrix.sanitizer }}.${{ matrix.build_type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_type: ['Debug', 'RelWithDebInfo']
- sanitizer: ['asan', 'ubsan', 'tsan']
- compiler: ['clang', 'gcc']
- # TODO: add 'msan' above. currently failing and needs investigation.
+ sanitizer: ['asan', 'ubsan', 'tsan', 'msan']
+
steps:
- uses: actions/checkout@v3
@@ -46,36 +45,27 @@
echo "LIBCXX_SANITIZER=Thread" >> $GITHUB_ENV
- name: fine-tune asan options
- # in clang+asan we get an error from std::regex. ignore it.
- if: matrix.sanitizer == 'asan' && matrix.compiler == 'clang'
+ # in asan we get an error from std::regex. ignore it.
+ if: matrix.sanitizer == 'asan'
run: |
echo "ASAN_OPTIONS=alloc_dealloc_mismatch=0" >> $GITHUB_ENV
- name: setup clang
- if: matrix.compiler == 'clang'
uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64
- name: configure clang
- if: matrix.compiler == 'clang'
run: |
echo "CC=cc" >> $GITHUB_ENV
echo "CXX=c++" >> $GITHUB_ENV
- - name: configure gcc
- if: matrix.compiler == 'gcc'
- run: |
- sudo apt update && sudo apt -y install gcc-10 g++-10
- echo "CC=gcc-10" >> $GITHUB_ENV
- echo "CXX=g++-10" >> $GITHUB_ENV
-
- - name: install llvm stuff
- if: matrix.compiler == 'clang'
+ - name: build libc++ (non-asan)
+ if: matrix.sanitizer != 'asan'
run: |
"${GITHUB_WORKSPACE}/.github/libcxx-setup.sh"
- echo "EXTRA_CXX_FLAGS=\"-stdlib=libc++\"" >> $GITHUB_ENV
+ echo "EXTRA_CXX_FLAGS=-stdlib=libc++ -L ${GITHUB_WORKSPACE}/llvm-build/lib -lc++abi -Isystem${GITHUB_WORKSPACE}/llvm-build/include -Isystem${GITHUB_WORKSPACE}/llvm-build/include/c++/v1 -Wl,-rpath,${GITHUB_WORKSPACE}/llvm-build/lib" >> $GITHUB_ENV
- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build