From be7dd2db903c64827752cf162a18483c05b73e8c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 13 Feb 2009 03:30:42 -0500 Subject: Add valgrind tests to CMake --- test.cmake | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'test.cmake') diff --git a/test.cmake b/test.cmake index c1aaadb6..527816fa 100644 --- a/test.cmake +++ b/test.cmake @@ -4,7 +4,7 @@ IF (TESTING) ENABLE_TESTING() ENDIF (TESTING) -MACRO (MAKE_TEST variable libraries class) +MACRO (MAKE_TEST testvariable valgrindvariable libraries class) KDE4_ADD_UNIT_TEST(test-${class} Test${class}.cpp ) @@ -17,6 +17,26 @@ MACRO (MAKE_TEST variable libraries class) ${${variable}} test-${class} ) + IF (UNIX) + ADD_CUSTOM_TARGET(valgrind-${class} + COMMAND + valgrind + --leak-check=full + --show-reachable=yes + --log-file=${EXECUTABLE_OUTPUT_PATH}/${class}.valgrind + bin/test-${class} + DEPENDS + test-${class} + WORKING_DIRECTORY + ${CMAKE_BINARY_DIR} + COMMENT + "Running valgrind on ${class}" + ) + SET(${valgrindvariable} + ${${valgrindvariable}} + valgrind-${class} + ) + ENDIF (UNIX) ENDMACRO (MAKE_TEST) MACRO (MAKE_TEST_GROUP groupname tests) @@ -25,3 +45,12 @@ MACRO (MAKE_TEST_GROUP groupname tests) ${${tests}} ) ENDMACRO (MAKE_TEST_GROUP) + +MACRO (MAKE_VALGRIND_GROUP groupname tests) + IF (UNIX) + ADD_CUSTOM_TARGET(valgrind-${groupname} + DEPENDS + ${${tests}} + ) + ENDIF (UNIX) +ENDMACRO (MAKE_VALGRIND_GROUP) -- cgit