-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable various sanitizer builds in github actions
- Loading branch information
Showing
3 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: sanitizer | ||
|
||
on: | ||
push: {} | ||
pull_request: {} | ||
|
||
env: | ||
CC: clang-3.8 | ||
CXX: clang++-3.8 | ||
EXTRA_CXX_FLAGS: "-stdlib=libc++" | ||
UBSAN_OPTIONS: "print_stacktrace=1" | ||
|
||
jobs: | ||
job: | ||
name: ${{ matrix.sanitizer }}.${{ matrix.build_type }} | ||
runs-on: ubuntu-16.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_type: ['Debug', 'RelWithDebInfo'] | ||
sanitizer: ['asan', 'ubsan', 'msan', 'tsan'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: install clang-3.8 | ||
run: | | ||
sudo apt update | ||
sudo apt -y install clang-3.8 | ||
- name: install libc++ | ||
run: "${GITHUB_WORKSPACE}/.libcxx-setup.sh" | ||
|
||
|
||
- 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 | ||
- 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 | ||
- name: create build environment | ||
run: cmake -E make_directory ${{ runner.workspace }}/_build | ||
|
||
- name: configure cmake | ||
shell: bash | ||
working-directory: ${{ runner.workspace }}/_build | ||
run: > | ||
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 }} | ||
|
||
- name: test | ||
shell: bash | ||
working-directory: ${{ runner.workspace }}/_build | ||
run: ctest -C ${{ matrix.build_type }} -VV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters