-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tyler Weaver <[email protected]>
- Loading branch information
Showing
3 changed files
with
105 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,30 @@ | ||
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). | ||
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) | ||
|
||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- ros2 | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
env: | ||
- TARGET_CMAKE_ARGS: -DENABLE_SANITIZER_ADDRESS=ON -DCMAKE_BUILD_TYPE=Debug | ||
NAME: Address Sanitizer | ||
- TARGET_CMAKE_ARGS: -DENABLE_SANITIZER_THREAD=ON -DCMAKE_BUILD_TYPE=Debug | ||
NAME: Thread Sanitizer | ||
env: | ||
ROS_DISTRO: rolling | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.env.NAME }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: 'ros-industrial/industrial_ci@master' | ||
env: ${{matrix.env}} |
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,68 @@ | ||
function(enable_sanitizers project_name) | ||
|
||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") | ||
option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" OFF) | ||
|
||
if(ENABLE_COVERAGE) | ||
target_compile_options(${project_name} INTERFACE --coverage -O0 -g -fno-omit-frame-pointer) | ||
target_link_libraries(${project_name} INTERFACE --coverage) | ||
endif() | ||
|
||
set(SANITIZERS "") | ||
|
||
option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" OFF) | ||
if(ENABLE_SANITIZER_ADDRESS) | ||
list(APPEND SANITIZERS "address") | ||
endif() | ||
|
||
option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" OFF) | ||
if(ENABLE_SANITIZER_LEAK) | ||
list(APPEND SANITIZERS "leak") | ||
endif() | ||
|
||
option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" OFF) | ||
if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR) | ||
list(APPEND SANITIZERS "undefined") | ||
endif() | ||
|
||
option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" OFF) | ||
if(ENABLE_SANITIZER_THREAD) | ||
if("address" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS) | ||
message(WARNING "Thread sanitizer does not work with Address and Leak sanitizer enabled") | ||
else() | ||
list(APPEND SANITIZERS "thread") | ||
endif() | ||
endif() | ||
|
||
option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" OFF) | ||
if(ENABLE_SANITIZER_MEMORY AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") | ||
message(WARNING "Memory sanitizer requires all the code (including libc++) \ | ||
to be MSan-instrumented otherwise it reports false positives") | ||
if("address" IN_LIST SANITIZERS | ||
OR "thread" IN_LIST SANITIZERS | ||
OR "leak" IN_LIST SANITIZERS) | ||
message(WARNING "Memory sanitizer does not work with Address, Thread and Leak sanitizer enabled") | ||
else() | ||
list(APPEND SANITIZERS "memory") | ||
endif() | ||
endif() | ||
|
||
list( | ||
JOIN | ||
SANITIZERS | ||
"," | ||
LIST_OF_SANITIZERS) | ||
|
||
endif() | ||
|
||
if(LIST_OF_SANITIZERS) | ||
if(NOT | ||
"${LIST_OF_SANITIZERS}" | ||
STREQUAL | ||
"") | ||
target_compile_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) | ||
target_link_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) | ||
endif() | ||
endif() | ||
|
||
endfunction() |
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