diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2013-08-07 20:25:48 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2013-08-07 20:25:48 (GMT) |
commit | 6f9aaad150f769cd73df408514cf5dc42c020074 (patch) | |
tree | 3b4f2b157d40db6b8d6ea5af708e01c11cadb060 /Tests/CTestTestMemcheck | |
parent | 7c9f0c664f5782c09c686b8e51fe50245463914b (diff) | |
download | CMake-6f9aaad150f769cd73df408514cf5dc42c020074.zip CMake-6f9aaad150f769cd73df408514cf5dc42c020074.tar.gz CMake-6f9aaad150f769cd73df408514cf5dc42c020074.tar.bz2 |
CTest: create one output file per memcheck (#14303)
The output file used for memory checker runs must be unique for every test run
in parallel, so simply make them unique for every test run. Simply use the test
index to avoid collisions.
Diffstat (limited to 'Tests/CTestTestMemcheck')
-rw-r--r-- | Tests/CTestTestMemcheck/CMakeLists.txt | 21 | ||||
-rw-r--r-- | Tests/CTestTestMemcheck/memtester.cxx.in | 8 |
2 files changed, 16 insertions, 13 deletions
diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 2db9282..86d7385 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -66,6 +66,7 @@ function(gen_mc_test NAME CHECKER) -D PSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify> -D PSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind> -D ERROR_COMMAND=$<TARGET_FILE:memcheck_fail> + ${ARGN} ) endfunction(gen_mc_test) @@ -74,10 +75,11 @@ function(gen_mcnl_test NAME CHECKER) -D PSEUDO_BC=$<TARGET_FILE:pseudonl_BC> -D PSEUDO_PURIFY=$<TARGET_FILE:pseudonl_purify> -D PSEUDO_VALGRIND=$<TARGET_FILE:pseudonl_valgrind> + ${ARGN} ) set_tests_properties(CTestTestMemcheck${NAME} PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake\n") + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake\n") endfunction(gen_mcnl_test) unset(CTEST_EXTRA_CONFIG) @@ -109,14 +111,17 @@ set(CTEST_EXTRA_CONFIG "set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain)\n") set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") gen_mc_test(DummyValgrindIgnoreMemcheck "\${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) +gen_mc_test(DummyValgrindTwoTargets "\${PSEUDO_VALGRIND}" "-VV") + set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\")") unset(CMAKELISTS_EXTRA_CODE) gen_mc_test(DummyValgrindInvalidSupFile "\${PSEUDO_VALGRIND}") -# CTest will add the logfile option as last option. Tell the dummy memcheck -# to ignore that argument. This will cause the logfile to be missing, which -# will be the prove for us that the custom option is indeed used. -set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--\")") +# CTest will add the logfile option before any custom options. Set the logfile +# again, this time to an empty string. This will cause the logfile to be +# missing, which will be the prove for us that the custom option is indeed used. +set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--log-file=\")") gen_mc_test(DummyValgrindCustomOptions "\${PSEUDO_VALGRIND}") unset(CTEST_EXTRA_CONFIG) @@ -161,4 +166,8 @@ set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") + +set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES + PASS_REGULAR_EXPRESSION + "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index da6f5a4..55a34e3 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -28,12 +28,6 @@ main(int argc, char **argv) std::string logfile; for (int i = 1; i < argc; i++) { std::string arg = argv[i]; - // stop processing options, this allows to force - // the logfile to be ignored - if (arg == "--") - { - break; - } if (arg.find(logarg) == 0) { if (nextarg) @@ -46,7 +40,7 @@ main(int argc, char **argv) { logfile = arg.substr(logarg.length()); } - break; + // keep searching, it may be overridden later to provoke an error } } |