# HG changeset patch # User Alpar Juttner # Date 2011-03-14 08:56:54 # Node ID 66156a3498ea35da40a6aa7bbfa0d4b5a3564abc # Parent d3b041452dd8fa3107c6326ef73cd7419f813380 Support tests with valgrind (#416) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,6 +7,10 @@ ${PROJECT_BINARY_DIR}/lemon ) +SET(TEST_WITH_VALGRIND "NO" CACHE STRING + "Run the test with valgrind (YES/NO).") +SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.") + SET(TESTS adaptors_test bfs_test @@ -129,6 +133,12 @@ ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) ENDIF() TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) - ADD_TEST(${TEST_NAME} ${TEST_NAME}) + IF(TEST_WITH_VALGRIND) + ADD_TEST(${TEST_NAME} + valgrind --error-exitcode=1 ${VALGRIND_FLAGS} + ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) + ELSE() + ADD_TEST(${TEST_NAME} ${TEST_NAME}) + ENDIF() ADD_DEPENDENCIES(check ${TEST_NAME}) ENDFOREACH()