Merge pull request 'Configure address and undefined sanitizers & fix delete UB' (#53) from sanitaze into master
Reviewed-on: https://git.shs.tools/SHS/pip/pulls/53
This commit was merged in pull request #53.
This commit is contained in:
@@ -282,7 +282,7 @@ PIInit::PIInit() {
|
|||||||
|
|
||||||
|
|
||||||
PIInit::~PIInit() {
|
PIInit::~PIInit() {
|
||||||
if (file_charset) delete file_charset;
|
if (file_charset) delete[] file_charset;
|
||||||
file_charset = 0;
|
file_charset = 0;
|
||||||
PIResourcesStorage::instance()->clear();
|
PIResourcesStorage::instance()->clear();
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
include(DownloadGTest)
|
include(DownloadGTest)
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/suppr.txt ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
|
||||||
|
|
||||||
macro(pip_test NAME LIBS)
|
macro(pip_test NAME LIBS)
|
||||||
file(GLOB _CPPS "${NAME}/*.cpp")
|
file(GLOB _CPPS "${NAME}/*.cpp")
|
||||||
file(GLOB _HDRS "${NAME}/*.h")
|
file(GLOB _HDRS "${NAME}/*.h")
|
||||||
set(_target pip_${NAME}_test)
|
set(_target pip_${NAME}_test)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PIP_ROOT_BINARY_DIR}")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PIP_ROOT_BINARY_DIR}")
|
||||||
add_executable(${_target} ${_CPPS} ${_HDRS})
|
add_executable(${_target} ${_CPPS} ${_HDRS})
|
||||||
target_link_libraries(${_target} pip ${LIBS} gtest_main gmock_main)
|
if (NOT WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${_target} PRIVATE -fsanitize=address,undefined)
|
||||||
|
target_link_options(${_target} PRIVATE -fsanitize=address,undefined)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(${_target} pip ${LIBS} gtest_main gmock_main asan)
|
||||||
add_test(NAME ${_target} COMMAND tests)
|
add_test(NAME ${_target} COMMAND tests)
|
||||||
add_custom_target(${_target}_perform ALL COMMAND ${_target})
|
add_custom_target(${_target}_perform ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env "LSAN_OPTIONS=suppressions=suppr.txt" $<TARGET_FILE:${_target}>)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
list(APPEND PIP_TESTS_LIST "${NAME}")
|
list(APPEND PIP_TESTS_LIST "${NAME}")
|
||||||
set(PIP_TESTS_LIST ${PIP_TESTS_LIST} PARENT_SCOPE)
|
set(PIP_TESTS_LIST ${PIP_TESTS_LIST} PARENT_SCOPE)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Concurrent tests
|
|
||||||
pip_test(concurrent "")
|
pip_test(concurrent "")
|
||||||
pip_test(math "")
|
pip_test(math "")
|
||||||
|
|||||||
2
tests/suppr.txt
Normal file
2
tests/suppr.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
leak:ConditionVariable::SetUp
|
||||||
|
leak:ConditionLock_
|
||||||
Reference in New Issue
Block a user