Skip to content

Commit 9fc045c

Browse files
committed
cmake: support ASAN/UBSan in lapi tests
1 parent c1b889f commit 9fc045c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmake/BuildLuzer.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif()
2626

2727
ExternalProject_Add(bundled-luzer
2828
GIT_REPOSITORY https://github.com/ligurio/luzer
29-
GIT_TAG 82d41c5f350296ca351e785a24c914165a0e8033
29+
GIT_TAG ligurio/gh-xxxx-build-sanitizer-libs
3030
GIT_PROGRESS TRUE
3131
GIT_SHALLOW FALSE
3232
SOURCE_DIR ${LUZER_DIR}/source

tests/lapi/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,20 @@ lapi_tests_make_lua_path(LUA_PATH
1616
${CMAKE_CURRENT_SOURCE_DIR}/?.lua
1717
)
1818

19+
set(DSO_SANITIZER_PATH "${PROJECT_BINARY_DIR}/luzer/build/luzer")
20+
set(DSO_ASAN_PATH "${DSO_SANITIZER_PATH}/asan_with_fuzzer.so")
21+
set(DSO_UBSAN_PATH "${DSO_SANITIZER_PATH}/ubsan_with_fuzzer.so")
22+
23+
if(ENABLE_ASAN OR ENABLE_UBSAN)
24+
set(LD_PRELOAD_LIBS "${DSO_ASAN_PATH}:${DSO_UBSAN_PATH}")
25+
endif()
26+
1927
list(APPEND TEST_ENV
2028
"LUA_PATH=${LUA_PATH};"
2129
"LUA_CPATH=${LUA_CPATH};"
2230
"ASAN_OPTIONS=detect_odr_violation=0;"
2331
"LD_DYNAMIC_WEAK=1;"
32+
"LD_PRELOAD=${LD_PRELOAD_LIBS};"
2433
)
2534

2635
function(create_test)

0 commit comments

Comments
 (0)