| 1 |
# - MACRO_ADD_VALGRIND_TEST(<args>) |
| 2 |
# |
| 3 |
# Calls add_test() with all the <args> but if on Win32 or Cygwin also adds the |
| 4 |
# directory where the Cgreen library is generated to the path so that it will |
| 5 |
# be used when running the test |
| 6 |
# |
| 7 |
# @thoni56/Thomas Nilefalk 2015-09-13 |
| 8 |
|
| 9 |
macro (macro_add_valgrind_test) |
| 10 |
if (Valgrind_FOUND) |
| 11 |
set( |
| 12 |
libname |
| 13 |
${CMAKE_FIND_LIBRARY_PREFIXES}${ARGN}${CMAKE_SHARED_LIBRARY_SUFFIX} |
| 14 |
) |
| 15 |
add_test( |
| 16 |
NAME valgrind_${libname} |
| 17 |
COMMAND sh -c "LD_LIBRARY_PATH=build/src valgrind --leak-check=full tools/cgreen-runner ${CMAKE_CURRENT_BINARY_DIR}/${libname} 2>1&" |
| 18 |
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
| 19 |
) |
| 20 |
set_tests_properties( |
| 21 |
valgrind_${libname} PROPERTIES |
| 22 |
FAIL_REGULAR_EXPRESSION "(definitely|indirectly|possibly) lost: [1-9]" |
| 23 |
) |
| 24 |
if (CYGWIN OR WIN32) |
| 25 |
set_tests_properties(${ARGV1} PROPERTIES ENVIRONMENT PATH=${PROJECT_BINARY_DIR}/src:$ENV{PATH}) |
| 26 |
endif () |
| 27 |
endif () |
| 28 |
endmacro(macro_add_valgrind_test) |