Add a valgrind-* counterpart for each target. Note that the valgrind-check-func seems to leak like a sleeve yet I'm suspecting that part of it is due to cmocka :P
Signed-off-by: Emil Velikov <[email protected]> --- Would be nice to have some sort of (valgrind) summary for all tests, but cannot think of anything at the moment. -Emil CMakeLists.txt | 15 ++++++++++++++- src/waffle/CMakeLists.txt | 8 ++++++++ tests/functional/CMakeLists.txt | 9 +++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e62e40..ebe42ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ endif() find_package(PkgConfig) # ------------------------------------------------------------------------------ -# Targets: check, check-func +# Targets: check, check-func, valgrind-check, valgrind-check-func # ------------------------------------------------------------------------------ # @@ -63,6 +63,19 @@ add_custom_target(check-func DEPENDS check ) +find_program(VALGRIND_EXECUTABLE valgrind) +if(VALGRIND_EXECUTABLE) + # Runs the 'check' target under valgrind. + add_custom_target(valgrind-check + DEPENDS check + ) + + # Runs the 'check-func' target under valgrind. + add_custom_target(valgrind-check-func + DEPENDS valgrind-check check-func + ) +endif() + # ------------------------------------------------------------------------------ # Add subdirectories # ------------------------------------------------------------------------------ diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt index 9b89a17..49ff162 100644 --- a/src/waffle/CMakeLists.txt +++ b/src/waffle/CMakeLists.txt @@ -231,6 +231,14 @@ function(add_unittest unittest_name) COMMAND "${CMAKE_BINARY_DIR}/tests/${unittest_name}" ) add_dependencies(check ${unittest_name}_run) + + if(VALGRIND_EXECUTABLE) + add_custom_target(valgrind_${unittest_name}_run + DEPENDS ${unittest_name} + COMMAND ${VALGRIND_EXECUTABLE} ${CMAKE_BINARY_DIR}/tests/${unittest_name} + ) + add_dependencies(valgrind-check valgrind_${unittest_name}_run) + endif() endfunction() add_unittest(wcore_attrib_list_unittest diff --git a/tests/functional/CMakeLists.txt b/tests/functional/CMakeLists.txt index 7a83e39..bc1f9f3 100644 --- a/tests/functional/CMakeLists.txt +++ b/tests/functional/CMakeLists.txt @@ -38,3 +38,12 @@ add_custom_target(gl_basic_test_run ) add_dependencies(check-func gl_basic_test_run) + +if(VALGRIND_EXECUTABLE) + add_custom_target(valgrind_gl_basic_test_run + DEPENDS gl_basic_test + COMMAND ${VALGRIND_EXECUTABLE} ${CMAKE_BINARY_DIR}/tests/functional/gl_basic_test + ) + + add_dependencies(valgrind-check-func valgrind_gl_basic_test_run) +endif() -- 2.1.0 _______________________________________________ waffle mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/waffle

