# HG changeset patch # User Alpar Juttner # Date 2011-03-17 18:12:03 # Node ID 78b9fb1f4454f03e1ff76bba1d7eded99945d968 # Parent a07b6b27fe6938c9883dd542f0791417e6e6258c # Parent 66156a3498ea35da40a6aa7bbfa0d4b5a3564abc Merge #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 bellman_ford_test @@ -136,6 +140,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()