Skip to content

Commit

Permalink
Add undefined sanitizer to CI (#348)
Browse files Browse the repository at this point in the history
* Add undefined sanitizer to CI

* fixed typo

* Minor fix.
  • Loading branch information
lemire committed Apr 21, 2023
1 parent 38d6eae commit 8517ef6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ubuntu-undef.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ubuntu 22.04 (GCC 12 SANITIZED)

on: [push, pull_request]

permissions:
contents: read

jobs:
ubuntu-build:
if: >-
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
! contains(toJSON(github.event.commits.*.message), '[skip github]')
runs-on: ubuntu-22.04
strategy:
matrix:
shared: [ON, OFF]
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Setup Ninja
run: sudo apt-get install ninja-build
- name: Prepare
run: cmake -D ADA_SANITIZE_UNDEFINED=ON -DADA_DEVELOPMENT_CHECKS=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} -G Ninja -B build
env:
CXX: g++-12
- name: Build
run: cmake --build build -j=2
- name: Test
run: ctest --output-on-failure --test-dir build
1 change: 1 addition & 0 deletions cmake/add-cpp-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function(add_cpp_test TEST_NAME)
endif()
if(ADA_SANITIZE_UNDEFINED)
add_compile_options(-fsanitize=undefined -fno-sanitize-recover=all)
add_link_options(-fsanitize=undefined)
endif()
# Add the compile target
if (ARGS_LIBRARY)
Expand Down

0 comments on commit 8517ef6

Please sign in to comment.