Skip to content

Commit

Permalink
Merge remote-tracking branch 'benma/sanitizer'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Apr 4, 2023
2 parents 6f94c6f + 048e740 commit d178b97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# This makefile is used as a command runner and not for tracking dependencies between recipies

.DEFAULT_GOAL := firmware
SANITIZE ?= ON

bootstrap:
git submodule update --init --recursive
Expand All @@ -26,7 +27,7 @@ build/Makefile:

build-build/Makefile:
mkdir -p build-build
cd build-build && cmake .. -DCOVERAGE=ON -DSANITIZE_ADDRESS=ON -DSANITIZE_UNDEFINED=ON
cd build-build && cmake .. -DCOVERAGE=ON -DSANITIZE_ADDRESS=$(SANITIZE) -DSANITIZE_UNDEFINED=$(SANITIZE)
$(MAKE) -C py/bitbox02

# Should only be used for rust unit tests since we didn't add support to
Expand Down
12 changes: 6 additions & 6 deletions test/unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ foreach(I RANGE 0 ${TEST_LIST_LEN} 2)
add_executable(${EXE} test_${TEST_NAME}.c framework/eh_personality.c)
# asan must be first library in linking order
target_link_libraries(${EXE} PRIVATE
$<$<BOOL:SANITIZE_ADDRESS>:asan>
$<$<BOOL:SANITIZE_UNDEFINED>:-fsanitize=undefined>
$<$<BOOL:${SANITIZE_ADDRESS}>:asan>
$<$<BOOL:${SANITIZE_UNDEFINED}>:-fsanitize=undefined>
-Wl,--start-group
c-unit-tests_rust_c
bitbox
Expand All @@ -281,8 +281,8 @@ foreach(TEST_NAME ${U2F_TESTS})
# This tests link to our code
add_executable(${EXE} test_${TEST_NAME}.c framework/mock_hidapi.c framework/eh_personality.c)
target_link_libraries(${EXE} PRIVATE
$<$<BOOL:SANITIZE_ADDRESS>:asan>
$<$<BOOL:SANITIZE_UNDEFINED>:-fsanitize=undefined>
$<$<BOOL:${SANITIZE_ADDRESS}>:asan>
$<$<BOOL:${SANITIZE_UNDEFINED}>:-fsanitize=undefined>
-Wl,--start-group
c-unit-tests_rust_c
bitbox
Expand All @@ -298,8 +298,8 @@ foreach(TEST_NAME ${U2F_TESTS})
add_executable(${EXE} test_${TEST_NAME}.c)
# asan must be first library in linking order
target_link_libraries(${EXE} PRIVATE
$<$<BOOL:SANITIZE_ADDRESS>:asan>
$<$<BOOL:SANITIZE_UNDEFINED>:-fsanitize=undefined>
$<$<BOOL:${SANITIZE_ADDRESS}>:asan>
$<$<BOOL:${SANITIZE_UNDEFINED}>:-fsanitize=undefined>
u2f-util
hidapi-hidraw
${CMOCKA_LIBRARIES}
Expand Down

0 comments on commit d178b97

Please sign in to comment.