diff --git a/CMakeLists.txt b/CMakeLists.txt index 73f468352c..76b604e7a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -461,8 +461,8 @@ set(LUAJIT_TEST_INIT "${PROJECT_SOURCE_DIR}/test/luajit-test-init.lua" CACHE STR # directory root (hence, in this CMakeLists.txt). if(LUAJIT_USE_TEST) enable_testing() + add_subdirectory(test) endif() -add_subdirectory(test) # --- Benchmarks source tree --------------------------------------------------- diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt index c1dbde35b7..313316ce1c 100644 --- a/test/LuaJIT-tests/CMakeLists.txt +++ b/test/LuaJIT-tests/CMakeLists.txt @@ -24,21 +24,24 @@ if(LUAJIT_USE_ASAN) # "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0) # This is a workaround suggested at # https://github.com/google/sanitizers/issues/934. - LibRealPath(LIB_STDCPP libstdc++.so) - # XXX: GCC requires both. Clang requires only libstdc++. - # Be aware, ASAN runtime in Clang on Linux was offered only in - # the form of a library with differ name from libasan.so (e.g. - # libclang_rt.asan-x86_64.a). - # See also: - # https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso. - if(CMAKE_C_COMPILER_ID STREQUAL "GNU") - LibRealPath(LIB_ASAN libasan.so) - # XXX: The items of the list in LD_PRELOAD can be separated - # by spaces or colons, and there is no support for escaping - # either separator, see ld.so(8). - list(APPEND LUAJIT_TESTS_ENV LD_PRELOAD=${LIB_ASAN}:${LIB_STDCPP}) - else() - list(APPEND LUAJIT_TESTS_ENV LD_PRELOAD=${LIB_STDCPP}) + # FreeBSD uses libc++ and doesn't need this workaround. + if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + LibRealPath(LIB_STDCPP libstdc++.so) + # XXX: GCC requires both. Clang requires only libstdc++. + # Be aware, ASAN runtime in Clang on Linux was offered only in + # the form of a library with differ name from libasan.so (e.g. + # libclang_rt.asan-x86_64.a). + # See also: + # https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso. + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + LibRealPath(LIB_ASAN libasan.so) + # XXX: The items of the list in LD_PRELOAD can be separated + # by spaces or colons, and there is no support for escaping + # either separator, see ld.so(8). + list(APPEND LUAJIT_TESTS_ENV LD_PRELOAD=${LIB_ASAN}:${LIB_STDCPP}) + else() + list(APPEND LUAJIT_TESTS_ENV LD_PRELOAD=${LIB_STDCPP}) + endif() endif() endif()