Skip to content

Commit

Permalink
ci: add ktls + asan build (#4213)
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart authored Oct 4, 2023
1 parent b15a1ba commit 76fb286
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,17 @@ if (BUILD_TESTING)
endif()
set(UNIT_TEST_ENVS ${UNIT_TEST_ENVS} TSAN_OPTIONS=${TSAN_OPTIONS})
endif()
if(ASAN)
# "detect_odr_violation" detects violations of the "one definition rule",
# ensuring that symbols are only defined once.
# But some of our unit tests intentionally include *.c files for testing,
# resulting in duplicate global values.
set(ASAN_OPTIONS detect_odr_violation=0)
if(DEFINED ENV{ASAN_OPTIONS})
set(ASAN_OPTIONS "${ASAN_OPTIONS} $ENV{ASAN_OPTIONS}")
endif()
set(UNIT_TEST_ENVS ${UNIT_TEST_ENVS} ASAN_OPTIONS=${ASAN_OPTIONS})
endif()
message(STATUS "Running tests with environment: ${UNIT_TEST_ENVS}")

file(GLOB UNITTESTS_SRC "tests/unit/*.c")
Expand Down
8 changes: 8 additions & 0 deletions codebuild/spec/buildspec_generalbatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,11 @@ batch:
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
privileged-mode: true
- identifier: ktlsASAN
buildspec: codebuild/spec/buildspec_ktls.yml
env:
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
privileged-mode: true
variables:
S2N_CMAKE_OPTIONS: "-DASAN=ON"
12 changes: 8 additions & 4 deletions codebuild/spec/buildspec_ktls.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
version: 0.2
env:
variables:
S2N_KTLS_TESTING_EXPECTED: true
phases:
install:
commands:
Expand All @@ -17,4 +14,11 @@ phases:
build:
commands:
- codebuild-breakpoint
- ssh -p 2222 codebuild@localhost "cd s2n-tls; sudo modprobe tls; nix develop .#openssl111 --command bash -c 'source ./nix/shell.sh && clean && configure && build && unit'"
- |
ssh -p 2222 codebuild@localhost " \
cd s2n-tls; sudo modprobe tls; \
export S2N_CMAKE_OPTIONS=${S2N_CMAKE_OPTIONS}; \
export S2N_KTLS_TESTING_EXPECTED=1; \
nix develop .#openssl111 --command bash -c \
'source ./nix/shell.sh && clean && configure && build && unit' \
"

0 comments on commit 76fb286

Please sign in to comment.