Skip to content

Commit 02a47e5

Browse files
authored
Merge pull request #154 from djw8605/add-asan-memory-checks
Add cmake option SCITOKENS_WITH_ASAN which enables memory checking
2 parents cee79c1 + a756744 commit 02a47e5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/ccpp.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
matrix:
2020
external-gtest: [ YES, NO ]
2121
os: [ ubuntu-latest, ubuntu-22.04 ]
22+
asan: [ YES, NO ]
2223

2324
runs-on: ${{ matrix.os }}
2425
name: Build with external_gtest=${{ matrix.external-gtest }} on ${{ matrix.os }}
@@ -44,7 +45,7 @@ jobs:
4445
# Note the current convention is to use the -S and -B options here to specify source
4546
# and build directories, but this is only available with CMake 3.13 and higher.
4647
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
47-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSCITOKENS_BUILD_UNITTESTS=yes -DSCITOKENS_EXTERNAL_GTEST=${{ matrix.external-gtest }}
48+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSCITOKENS_BUILD_UNITTESTS=yes -DSCITOKENS_EXTERNAL_GTEST=${{ matrix.external-gtest }} -DSCITOKENS_WITH_ASAN=${{ matrix.asan }}
4849

4950
- name: Build
5051
working-directory: ${{runner.workspace}}/build

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@ project( scitokens-cpp
66
VERSION 1.0.2
77
LANGUAGES CXX)
88

9-
option( SCITOKENS_BUILD_UNITTESTS "Build the scitokens-cpp unit tests" OFF )
10-
option( SCITOKENS_EXTERNAL_GTEST "Use an external/pre-installed copy of GTest" OFF )
9+
option( SCITOKENS_BUILD_UNITTESTS "Build the scitokens-cpp unit tests" ON )
10+
option( SCITOKENS_EXTERNAL_GTEST " Use an external/pre-installed copy of GTest" OFF )
11+
option( SCITOKENS_WITH_ASAN "Build with the address santizier" OFF )
1112

1213
set( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}" )
1314

1415
set( CMAKE_BUILD_TYPE RelWithDebInfo) # -g -O2
1516

1617
set( CMAKE_UNITY_BUILD False)
1718

19+
if( SCITOKENS_WITH_ASAN )
20+
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
21+
add_link_options(-fsanitize=address)
22+
endif()
23+
1824
include(GNUInstallDirs)
1925

2026
find_package( jwt-cpp REQUIRED )

0 commit comments

Comments
 (0)