Skip to content

Commit

Permalink
Thread and Address Sanitizer CI
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Weaver <tylerjw@gmail.com>
  • Loading branch information
tylerjw committed Jun 12, 2022
1 parent 332e35d commit fff8f12
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
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}}
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" OFF)
if(ENABLE_SANITIZER_ADDRESS)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" OFF)
if(ENABLE_SANITIZER_THREAD)
if(ENABLE_SANITIZER_ADDRESS)
message(WARNING "Thread sanitizer does not work with Address sanitizer enabled")
endif()
add_compile_options(-fsanitize=thread)
add_link_options(-fsanitize=thread)
endif()

set(CLASS_LOADER_IGNORE_AMENT FALSE CACHE BOOL
"Do not use ament when building this package.")
if(NOT CLASS_LOADER_IGNORE_AMENT)
Expand Down

0 comments on commit fff8f12

Please sign in to comment.