mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
add dynamic override test on windows
This commit is contained in:
parent
84aadcb087
commit
3e7875066b
2 changed files with 24 additions and 7 deletions
|
@ -705,12 +705,18 @@ if (MI_BUILD_TESTS)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# dynamic override test
|
# dynamic override test
|
||||||
if(MI_BUILD_SHARED AND NOT (WIN32 OR MI_TRACK_ASAN OR MI_DEBUG_TSAN OR MI_DEBUG_UBSAN))
|
if(MI_BUILD_SHARED AND NOT (MI_TRACK_ASAN OR MI_DEBUG_TSAN OR MI_DEBUG_UBSAN))
|
||||||
add_executable(mimalloc-test-stress-dynamic test/test-stress.c)
|
add_executable(mimalloc-test-stress-dynamic test/test-stress.c)
|
||||||
target_compile_definitions(mimalloc-test-stress-dynamic PRIVATE ${mi_defines} "USE_STD_MALLOC=1")
|
target_compile_definitions(mimalloc-test-stress-dynamic PRIVATE ${mi_defines} "USE_STD_MALLOC=1")
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(mimalloc-test-stress-dynamic PRIVATE "MI_LINK_VERSION=1")
|
||||||
|
endif()
|
||||||
target_compile_options(mimalloc-test-stress-dynamic PRIVATE ${mi_cflags})
|
target_compile_options(mimalloc-test-stress-dynamic PRIVATE ${mi_cflags})
|
||||||
target_include_directories(mimalloc-test-stress-dynamic PRIVATE include)
|
target_include_directories(mimalloc-test-stress-dynamic PRIVATE include)
|
||||||
target_link_libraries(mimalloc-test-stress-dynamic PRIVATE ${mi_libraries}) # pthread
|
target_link_libraries(mimalloc-test-stress-dynamic PRIVATE mimalloc ${mi_libraries}) # mi_version
|
||||||
|
if(WIN32)
|
||||||
|
add_test(NAME test-stress-dynamic COMMAND ${CMAKE_COMMAND} -E env MIMALLOC_SHOW_STATS=1 $<TARGET_FILE:mimalloc-test-stress-dynamic>)
|
||||||
|
else()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(LD_PRELOAD "DYLD_INSERT_LIBRARIES")
|
set(LD_PRELOAD "DYLD_INSERT_LIBRARIES")
|
||||||
else()
|
else()
|
||||||
|
@ -719,6 +725,7 @@ if (MI_BUILD_TESTS)
|
||||||
add_test(NAME test-stress-dynamic COMMAND ${CMAKE_COMMAND} -E env MIMALLOC_SHOW_STATS=1 ${LD_PRELOAD}=$<TARGET_FILE:mimalloc> $<TARGET_FILE:mimalloc-test-stress-dynamic>)
|
add_test(NAME test-stress-dynamic COMMAND ${CMAKE_COMMAND} -E env MIMALLOC_SHOW_STATS=1 ${LD_PRELOAD}=$<TARGET_FILE:mimalloc> $<TARGET_FILE:mimalloc-test-stress-dynamic>)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Set override properties
|
# Set override properties
|
||||||
|
|
|
@ -268,7 +268,17 @@ static void test_leak(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_STD_MALLOC) && defined(MI_LINK_VERSION)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
int mi_version(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
#ifdef MI_LINK_VERSION
|
||||||
|
mi_version();
|
||||||
|
#endif
|
||||||
#ifdef HEAP_WALK
|
#ifdef HEAP_WALK
|
||||||
mi_option_enable(mi_option_visit_abandoned);
|
mi_option_enable(mi_option_visit_abandoned);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue