Print valgrind command with options in feature summary
This commit is contained in:
parent
4ece73cd76
commit
3c77b378e6
@ -16,6 +16,7 @@ set(JSON_32bitTest AUTO CACHE STRING "Enable the 32bit unit test (ON/OFF/AUTO/ON
|
||||
cmake_dependent_option(JSON_FastTests "Skip expensive/slow tests." OFF "JSON_BuildTests" OFF)
|
||||
set(JSON_TestDataDirectory "$ENV{JSON_TEST_DATA_DIRECTORY}" CACHE FILEPATH "Test data directory for the unit tests (will be downloaded if not specified).")
|
||||
cmake_dependent_option(JSON_Valgrind "Execute test suite with Valgrind." OFF "JSON_BuildTests" OFF)
|
||||
set(JSON_MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1;--leak-check=full" CACHE STRING "Options passed to the memory check command (valgrind).")
|
||||
|
||||
set(JSON_TestStandards "" CACHE STRING "The list of standards to test explicitly.")
|
||||
|
||||
|
||||
@ -60,7 +60,8 @@ if(JSON_BuildTests)
|
||||
|
||||
json_feature(JSON_Valgrind "Execute test suite with Valgrind?")
|
||||
if(JSON_Valgrind)
|
||||
message(" Valgrind command: ${CMAKE_MEMORYCHECK_COMMAND}" ${CMAKE_MEMORYCHECK_COMMAND_OPTIONS})
|
||||
string (REPLACE ";" " " memcheck_command "${JSON_MEMORYCHECK_COMMAND};${JSON_MEMORYCHECK_COMMAND_OPTIONS}")
|
||||
message(" Valgrind command: ${memcheck_command}")
|
||||
endif()
|
||||
|
||||
set(test_cxx_standards "")
|
||||
|
||||
@ -26,12 +26,11 @@ add_test(NAME "download_test_data" COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINA
|
||||
)
|
||||
set_tests_properties(download_test_data PROPERTIES FIXTURES_SETUP TEST_DATA)
|
||||
|
||||
if(JSON_Valgrind)
|
||||
find_program(CMAKE_MEMORYCHECK_COMMAND valgrind)
|
||||
message(STATUS "Executing test suite with Valgrind (${CMAKE_MEMORYCHECK_COMMAND})")
|
||||
set(memcheck_command "${CMAKE_MEMORYCHECK_COMMAND} ${CMAKE_MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=1 --leak-check=full")
|
||||
separate_arguments(memcheck_command)
|
||||
endif()
|
||||
#############################################################################
|
||||
# locate memory check command
|
||||
#############################################################################
|
||||
|
||||
find_program(JSON_MEMORYCHECK_COMMAND valgrind)
|
||||
|
||||
#############################################################################
|
||||
# detect standard support
|
||||
@ -189,7 +188,8 @@ function(_json_test_add_test test_name file main cxx_standard)
|
||||
|
||||
if(JSON_Valgrind)
|
||||
add_test(NAME ${test_target}_valgrind
|
||||
COMMAND ${memcheck_command} $<TARGET_FILE:${test_target}> ${DOCTEST_TEST_FILTER}
|
||||
COMMAND ${JSON_MEMORYCHECK_COMMAND} ${JSON_MEMORYCHECK_COMMAND_OPTIONS}
|
||||
-- $<TARGET_FILE:${test_target}> ${DOCTEST_TEST_FILTER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
set_tests_properties(${test_target}_valgrind PROPERTIES
|
||||
|
||||
Loading…
Reference in New Issue
Block a user