2021-06-03 18:45:02 +00:00
|
|
|
name: sanitizer
|
|
|
|
|
|
|
|
on:
|
|
|
|
push: {}
|
|
|
|
pull_request: {}
|
|
|
|
|
|
|
|
env:
|
|
|
|
UBSAN_OPTIONS: "print_stacktrace=1"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
job:
|
2023-05-03 15:55:45 +00:00
|
|
|
name: ${{ matrix.sanitizer }}.${{ matrix.build_type }}
|
2021-06-04 10:06:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-06-03 18:45:02 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
build_type: ['Debug', 'RelWithDebInfo']
|
2023-05-03 15:55:45 +00:00
|
|
|
sanitizer: ['asan', 'ubsan', 'tsan', 'msan']
|
|
|
|
|
2021-06-03 18:45:02 +00:00
|
|
|
steps:
|
2023-02-09 15:52:03 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-03 18:45:02 +00:00
|
|
|
|
|
|
|
- name: configure msan env
|
|
|
|
if: matrix.sanitizer == 'msan'
|
|
|
|
run: |
|
|
|
|
echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins" >> $GITHUB_ENV
|
|
|
|
echo "LIBCXX_SANITIZER=MemoryWithOrigins" >> $GITHUB_ENV
|
2021-06-04 10:06:38 +00:00
|
|
|
|
2021-06-03 18:45:02 +00:00
|
|
|
- name: configure ubsan env
|
|
|
|
if: matrix.sanitizer == 'ubsan'
|
|
|
|
run: |
|
|
|
|
echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" >> $GITHUB_ENV
|
|
|
|
echo "LIBCXX_SANITIZER=Undefined" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: configure asan env
|
|
|
|
if: matrix.sanitizer == 'asan'
|
|
|
|
run: |
|
|
|
|
echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=address -fno-sanitize-recover=all" >> $GITHUB_ENV
|
|
|
|
echo "LIBCXX_SANITIZER=Address" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: configure tsan env
|
|
|
|
if: matrix.sanitizer == 'tsan'
|
|
|
|
run: |
|
|
|
|
echo "EXTRA_FLAGS=-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" >> $GITHUB_ENV
|
|
|
|
echo "LIBCXX_SANITIZER=Thread" >> $GITHUB_ENV
|
|
|
|
|
2023-02-09 15:29:10 +00:00
|
|
|
- name: fine-tune asan options
|
2023-05-03 15:55:45 +00:00
|
|
|
# in asan we get an error from std::regex. ignore it.
|
|
|
|
if: matrix.sanitizer == 'asan'
|
2023-02-09 15:29:10 +00:00
|
|
|
run: |
|
|
|
|
echo "ASAN_OPTIONS=alloc_dealloc_mismatch=0" >> $GITHUB_ENV
|
|
|
|
|
2022-07-05 09:41:38 +00:00
|
|
|
- name: setup clang
|
|
|
|
uses: egor-tensin/setup-clang@v1
|
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
platform: x64
|
|
|
|
|
2021-07-01 09:02:54 +00:00
|
|
|
- name: configure clang
|
|
|
|
run: |
|
2022-07-05 09:41:38 +00:00
|
|
|
echo "CC=cc" >> $GITHUB_ENV
|
|
|
|
echo "CXX=c++" >> $GITHUB_ENV
|
2021-07-01 09:02:54 +00:00
|
|
|
|
2023-05-03 15:55:45 +00:00
|
|
|
- name: build libc++ (non-asan)
|
|
|
|
if: matrix.sanitizer != 'asan'
|
2021-07-01 09:02:54 +00:00
|
|
|
run: |
|
2023-02-09 15:29:10 +00:00
|
|
|
"${GITHUB_WORKSPACE}/.github/libcxx-setup.sh"
|
2023-05-03 15:55:45 +00:00
|
|
|
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
|
2021-06-03 18:45:02 +00:00
|
|
|
|
|
|
|
- name: create build environment
|
|
|
|
run: cmake -E make_directory ${{ runner.workspace }}/_build
|
|
|
|
|
|
|
|
- name: configure cmake
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ runner.workspace }}/_build
|
|
|
|
run: >
|
2022-07-05 09:41:38 +00:00
|
|
|
VERBOSE=1
|
2021-06-03 18:45:02 +00:00
|
|
|
cmake $GITHUB_WORKSPACE
|
|
|
|
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF
|
|
|
|
-DBENCHMARK_ENABLE_LIBPFM=OFF
|
|
|
|
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
|
|
|
|
-DCMAKE_C_COMPILER=${{ env.CC }}
|
|
|
|
-DCMAKE_CXX_COMPILER=${{ env.CXX }}
|
|
|
|
-DCMAKE_C_FLAGS="${{ env.EXTRA_FLAGS }}"
|
|
|
|
-DCMAKE_CXX_FLAGS="${{ env.EXTRA_FLAGS }} ${{ env.EXTRA_CXX_FLAGS }}"
|
|
|
|
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ runner.workspace }}/_build
|
|
|
|
run: cmake --build . --config ${{ matrix.build_type }}
|
2021-06-04 10:06:38 +00:00
|
|
|
|
2021-06-03 18:45:02 +00:00
|
|
|
- name: test
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ runner.workspace }}/_build
|
|
|
|
run: ctest -C ${{ matrix.build_type }} -VV
|