Skip to content

Commit 2601aea

Browse files
marcomagdybmoffatt
andauthored
Build with ASan and UBSan (#174)
Co-authored-by: Bryan Moffatt <[email protected]>
1 parent 8e98808 commit 2601aea

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ project(aws-lambda-runtime
66

77
option(ENABLE_LTO "Enables link-time optimization, requires compiler support." OFF)
88
option(ENABLE_TESTS "Enables building the test project, requires AWS C++ SDK." OFF)
9+
option(ENABLE_SANITIZERS "Enables ASan and UBSan." OFF)
910

1011
add_library(${PROJECT_NAME}
1112
"src/logging.cpp"
@@ -22,6 +23,11 @@ target_include_directories(${PROJECT_NAME} PUBLIC
2223
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
2324
$<INSTALL_INTERFACE:include>)
2425

26+
if (ENABLE_SANITIZERS)
27+
target_compile_options(${PROJECT_NAME} PUBLIC "-fsanitize=address,undefined")
28+
target_link_libraries(${PROJECT_NAME} PUBLIC "-fsanitize=address,undefined")
29+
endif()
30+
2531
if (ENABLE_LTO)
2632
include(CheckIPOSupported)
2733
check_ipo_supported(RESULT has_lto OUTPUT lto_check_output)

ci/codebuild/arch-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ phases:
44
build:
55
commands:
66
- echo Build started on `date`
7-
- ./ci/codebuild/build.sh -DTEST_RESOURCE_PREFIX=lambda-cpp-archbtw
7+
- ./ci/codebuild/build.sh -DTEST_RESOURCE_PREFIX=lambda-cpp-archbtw -DENABLE_SANITIZERS=ON
88
- ./ci/codebuild/run-tests.sh aws-lambda-package-lambda-test-fun
99
- echo Build completed on `date`

0 commit comments

Comments
 (0)