Merge pull request #54 from jlblancoc/add_make_check_valgrind
add command `make check_valgrind`release/4.3a0
commit
4e19ba4488
|
@ -88,29 +88,36 @@ enable_testing()
|
||||||
|
|
||||||
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
||||||
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
||||||
option(GTSAM_BUILD_TIMING_ALWAYS "Build timing scripts with 'make all' (build with 'make timing' if not" OFF)
|
option(GTSAM_BUILD_TIMING_ALWAYS "Build timing scripts with 'make all' (build with 'make timing' if not" OFF)
|
||||||
|
|
||||||
# Add option for combining unit tests
|
# Add option for combining unit tests
|
||||||
if(MSVC OR XCODE_VERSION)
|
if(MSVC OR XCODE_VERSION)
|
||||||
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" ON)
|
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" ON)
|
||||||
else()
|
else()
|
||||||
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" OFF)
|
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" OFF)
|
||||||
endif()
|
endif()
|
||||||
mark_as_advanced(GTSAM_SINGLE_TEST_EXE)
|
mark_as_advanced(GTSAM_SINGLE_TEST_EXE)
|
||||||
|
|
||||||
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
|
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
|
||||||
if(GTSAM_BUILD_TESTS)
|
if(GTSAM_BUILD_TESTS)
|
||||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
|
||||||
|
# Also add alternative checks using valgrind.
|
||||||
|
# We don't look for valgrind being installed in the system, since these
|
||||||
|
# targets are not invoked unless directly instructed by the user.
|
||||||
|
if (UNIX)
|
||||||
|
# Run all tests using valgrind:
|
||||||
|
add_custom_target(check_valgrind)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add target to build tests without running
|
# Add target to build tests without running
|
||||||
add_custom_target(all.tests)
|
add_custom_target(all.tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add examples target
|
# Add examples target
|
||||||
add_custom_target(examples)
|
add_custom_target(examples)
|
||||||
|
|
||||||
# Add timing target
|
# Add timing target
|
||||||
add_custom_target(timing)
|
add_custom_target(timing)
|
||||||
|
|
||||||
|
|
||||||
# Implementations of this file's macros:
|
# Implementations of this file's macros:
|
||||||
|
@ -168,7 +175,19 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries)
|
||||||
add_dependencies(check ${script_name})
|
add_dependencies(check ${script_name})
|
||||||
add_dependencies(all.tests ${script_name})
|
add_dependencies(all.tests ${script_name})
|
||||||
if(NOT MSVC AND NOT XCODE_VERSION)
|
if(NOT MSVC AND NOT XCODE_VERSION)
|
||||||
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name} DEPENDS ${script_name})
|
# Regular test run:
|
||||||
|
add_custom_target(${script_name}.run
|
||||||
|
COMMAND ${EXECUTABLE_OUTPUT_PATH}${script_name}
|
||||||
|
DEPENDS ${script_name}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Run with valgrind:
|
||||||
|
set(GENERATED_EXE "$<TARGET_FILE:${script_name}>")
|
||||||
|
add_custom_target(${script_name}.valgrind
|
||||||
|
COMMAND "valgrind" "--error-exitcode=1" ${GENERATED_EXE}
|
||||||
|
DEPENDS ${script_name}
|
||||||
|
)
|
||||||
|
add_dependencies(check_valgrind ${script_name}.valgrind)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add TOPSRCDIR
|
# Add TOPSRCDIR
|
||||||
|
|
Loading…
Reference in New Issue