Skip to content

Build with ASan and UBSan #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project(aws-lambda-runtime

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

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

if (ENABLE_SANITIZERS)
target_compile_options(${PROJECT_NAME} PUBLIC "-fsanitize=address,undefined")
target_link_libraries(${PROJECT_NAME} PUBLIC "-fsanitize=address,undefined")
endif()

if (ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT has_lto OUTPUT lto_check_output)
Expand Down
2 changes: 1 addition & 1 deletion ci/codebuild/arch-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ phases:
build:
commands:
- echo Build started on `date`
- ./ci/codebuild/build.sh -DTEST_RESOURCE_PREFIX=lambda-cpp-archbtw
- ./ci/codebuild/build.sh -DTEST_RESOURCE_PREFIX=lambda-cpp-archbtw -DENABLE_SANITIZERS=ON
- ./ci/codebuild/run-tests.sh aws-lambda-package-lambda-test-fun
- echo Build completed on `date`