From bcc0f3fb05276c58387e6ea43c1cf913790db0ed Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 5 May 2013 17:00:24 +0200 Subject: [PATCH 01/10] Tests: create output files for all memory checkers The dummy memory tester implementation now understands the command line switches for all memory checkers to redirect the output to a file. This avoids triggering the error cases for BoundsChecker and Purify because the output file does not exist. --- Tests/CTestTestMemcheck/CMakeLists.txt | 34 +++++++++------- Tests/CTestTestMemcheck/memtester.cxx.in | 52 ++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 Tests/CTestTestMemcheck/memtester.cxx.in diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 2730a6140..b05d96b0b 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -1,10 +1,13 @@ foreach (_retval 0 1) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.c" "int main(){return ${_retval};}\n") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) endforeach () +include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source) + # create binaries that we will use as a pseudo memory checker -add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) +target_link_libraries(pseudo_valgrind CMakeLib) # Xcode 2.x forgets to create the output directory before linking # the individual architectures. @@ -14,13 +17,19 @@ if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]" ) endif() -add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) -add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +target_link_libraries(pseudo_purify CMakeLib) +add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") set_target_properties(pseudo_BC PROPERTIES OUTPUT_NAME BC) +target_link_libraries(pseudo_BC CMakeLib) # binary to be used as pre- and post-memcheck command that fails -add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.c") +add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.cxx") +target_link_libraries(memcheck_fail CMakeLib) + +set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") +set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") foreach (_test IN ITEMS Unknown UnknownQuoted NotExist DummyValgrind DummyValgrindPrePost @@ -55,13 +64,13 @@ endforeach () set_tests_properties(CTestTestMemcheckNotExist PROPERTIES PASS_REGULAR_EXPRESSION "Memory checker \\(MemoryCheckCommand\\) not set, or cannot find the specified program.") -set(NORMAL_CTEST_OUTPUT "\n-- Processing memory checking output: \nMemory checking results:\n(BullseyeCoverage[^\n]*\n)?") - # It is a valid result if valgrind does not output any files (can e.g. happen # if you have not compiled in debug mode), so these tests will not fail. -set_tests_properties(CTestTestMemcheckDummyValgrind CTestTestMemcheckDummyValgrindPrePost +set_tests_properties(CTestTestMemcheckDummyValgrind + CTestTestMemcheckDummyValgrindPrePost + CTestTestMemcheckDummyPurify PROPERTIES - PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}") + PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") foreach (_pp Pre Post) string(TOLOWER ${_pp} _pp_lower) @@ -72,10 +81,7 @@ endforeach () set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PROPERTIES - PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*\n1/1 MemCheck #1: RunCMake .*${NORMAL_CTEST_OUTPUT}") - -set_tests_properties(CTestTestMemcheckDummyPurify PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/test.cmake\n") + PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error parsing XML in stream at line 1: no element found\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/test.cmake\n") + PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in new file mode 100644 index 000000000..64b72d313 --- /dev/null +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -0,0 +1,52 @@ +#include +#include + +#define RETVAL @_retval@ + +int +main(int argc, char **argv) +{ + std::string exename = argv[0]; + std::string logarg; + bool nextarg = false; + + if (exename.find("valgrind") != exename.npos) + logarg = "--log-file="; + else if (exename.find("purify") != exename.npos) +#ifdef _WIN32 + logarg = "/SAVETEXTDATA="; +#else + logarg = "-log-file="; +#endif + else if (exename.find("BC") != exename.npos) + { + nextarg = true; + logarg = "/X"; + } + + if (!logarg.empty()) { + std::string logfile; + for (int i = 1; i < argc; i++) { + std::string arg = argv[i]; + if (arg.find(logarg) == 0) + { + if (nextarg) + { + if (i == argc - 1) + return 1; // invalid command line + logfile = argv[i + 1]; + } + else + { + logfile = arg.substr(logarg.length()); + } + break; + } + } + + if (!logfile.empty()) + cmSystemTools::Touch(logfile.c_str(), true); + } + + return RETVAL; +} From dde6306a48e0eac9783737ca2dab3ce28e27c869 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 4 May 2013 19:03:26 +0200 Subject: [PATCH 02/10] CTest: use an output file for Valgrind (#14110) This makes sure Valgrind output will not screw up tests that match on the output. --- Source/CTest/cmCTestMemCheckHandler.cxx | 20 ++++++++++++++++++++ Source/CTest/cmCTestMemCheckHandler.h | 4 ++++ Source/CTest/cmCTestRunTest.cxx | 18 ++++++++++++------ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 80218ad38..b32060576 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -491,6 +491,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() switch ( this->MemoryTesterStyle ) { case cmCTestMemCheckHandler::VALGRIND: + { if ( this->MemoryTesterOptions.empty() ) { this->MemoryTesterOptions.push_back("-q"); @@ -516,7 +517,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); this->MemoryTesterOptions.push_back(suppressions); } + std::string outputFile = "--log-file=" + + this->MemoryTesterOutputFile; + this->MemoryTesterOptions.push_back(outputFile); break; + } case cmCTestMemCheckHandler::PURIFY: { std::string outputFile; @@ -948,6 +953,21 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res) cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " << res.Name.c_str() << std::endl); + appendMemTesterOutput(res); +} + +void +cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res) +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "PostProcessValgrindTest for : " + << res.Name.c_str() << std::endl); + appendMemTesterOutput(res); +} + +void +cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res) +{ if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) ) { std::string log = "Cannot find memory tester output file: " diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 1e81c893b..0a8c1b3f0 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -119,6 +119,10 @@ private: void PostProcessPurifyTest(cmCTestTestResult& res); void PostProcessBoundsCheckerTest(cmCTestTestResult& res); + void PostProcessValgrindTest(cmCTestTestResult& res); + + ///! append MemoryTesterOutputFile to the test log + void appendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res); }; #endif diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 5eabf3fbe..aa27f1982 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -384,13 +384,19 @@ void cmCTestRunTest::MemCheckPostProcess() << this->TestResult.Name.c_str() << std::endl); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); - if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER) + switch ( handler->MemoryTesterStyle ) { - handler->PostProcessBoundsCheckerTest(this->TestResult); - } - else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY) - { - handler->PostProcessPurifyTest(this->TestResult); + case cmCTestMemCheckHandler::VALGRIND: + handler->PostProcessValgrindTest(this->TestResult); + break; + case cmCTestMemCheckHandler::PURIFY: + handler->PostProcessPurifyTest(this->TestResult); + break; + case cmCTestMemCheckHandler::BOUNDS_CHECKER: + handler->PostProcessBoundsCheckerTest(this->TestResult); + break; + default: + break; } } From f4994223bb84bfe98e0113a8a5ccac67435c13d3 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 6 May 2013 14:39:05 +0200 Subject: [PATCH 03/10] CTest: remove unreachable code and CTestTestMemcheckUnknown test The memory checker command can't be quoted at this point, because previously it has been tested that the given file exists, which will fail if the name is quoted. The CTestTestMemcheckUnknown test aimed to test this case, has always failed to do so and serves no useful purpose therefore. --- Source/CTest/cmCTestMemCheckHandler.cxx | 7 ------- Tests/CTestTestMemcheck/CMakeLists.txt | 8 +++----- .../UnknownQuoted/CMakeLists.txt | 5 ----- .../UnknownQuoted/CTestConfig.cmake | 7 ------- .../UnknownQuoted/test.cmake.in | 19 ------------------- 5 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index b32060576..280faa0a5 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -461,13 +461,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - if ( this->MemoryTester[0] == '\"' && - this->MemoryTester[this->MemoryTester.size()-1] == '\"' ) - { - this->MemoryTester - = this->MemoryTester.substr(1, this->MemoryTester.size()-2); - } - // Setup the options std::string memoryTesterOptions; if ( this->CTest->GetCTestConfiguration( diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index b05d96b0b..d2f3a8745 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -31,7 +31,7 @@ target_link_libraries(memcheck_fail CMakeLib) set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") -foreach (_test IN ITEMS Unknown UnknownQuoted NotExist +foreach (_test IN ITEMS Unknown NotExist DummyValgrind DummyValgrindPrePost DummyValgrindFailPre DummyValgrindFailPost DummyPurify DummyBC @@ -56,10 +56,8 @@ string(REPLACE "(" "\\(" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") string(REPLACE ")" "\\)" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") string(REPLACE "+" "\\+" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") -foreach (_unkn Unknown UnknownQuoted) - set_tests_properties(CTestTestMemcheck${_unkn} PROPERTIES - PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/${_unkn}/test.cmake\n") -endforeach () +set_tests_properties(CTestTestMemcheckUnknown PROPERTIES + PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/Unknown/test.cmake\n") set_tests_properties(CTestTestMemcheckNotExist PROPERTIES PASS_REGULAR_EXPRESSION "Memory checker \\(MemoryCheckCommand\\) not set, or cannot find the specified program.") diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt b/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt deleted file mode 100644 index 6f49c6144..000000000 --- a/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckUnknownQuoted) -include(CTest) - -add_test (RunCMake "\"${CMAKE_COMMAND}\"") diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake b/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake deleted file mode 100644 index f0233a7a4..000000000 --- a/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknownQuoted") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in b/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in deleted file mode 100644 index 1b1f7023a..000000000 --- a/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckUnknownQuoted") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/UnknownQuoted") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/UnknownQuoted") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -set(CTEST_MEMORYCHECK_COMMAND "@CMAKE_COMMAND@") - -CTEST_START(Experimental) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) From abf1df48fc966efc8c2d489acbea24dc0312c84c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 5 May 2013 20:44:07 +0200 Subject: [PATCH 04/10] Tests: remove code duplication in CTestTestMemCheck tests The code for the tests is basically the same for all those subtests, so have one template and configure that for as many tests as possible to make it easier maintainable. --- Tests/CTestTestMemcheck/CMakeLists.txt | 53 ++++++++++++++----- Tests/CTestTestMemcheck/CMakeLists.txt.in | 7 +++ ...CTestConfig.cmake => CTestConfig.cmake.in} | 4 +- .../CTestTestMemcheck/DummyBC/CMakeLists.txt | 5 -- .../DummyBC/CTestConfig.cmake | 7 --- .../DummyPurify/CMakeLists.txt | 5 -- .../DummyPurify/CTestConfig.cmake | 7 --- .../DummyPurify/test.cmake.in | 25 --------- .../DummyValgrind/CMakeLists.txt | 5 -- .../DummyValgrind/CTestConfig.cmake | 7 --- .../DummyValgrind/test.cmake.in | 25 --------- .../DummyValgrindFailPost/CMakeLists.txt | 5 -- .../DummyValgrindFailPost/CTestConfig.cmake | 7 --- .../DummyValgrindFailPost/test.cmake.in | 27 ---------- .../DummyValgrindFailPre/CMakeLists.txt | 5 -- .../DummyValgrindFailPre/CTestConfig.cmake | 7 --- .../DummyValgrindFailPre/test.cmake.in | 27 ---------- .../CMakeLists.txt | 6 --- .../CTestConfig.cmake | 9 ---- .../DummyValgrindIgnoreMemcheck/test.cmake.in | 25 --------- .../DummyValgrindPrePost/CMakeLists.txt | 5 -- .../DummyValgrindPrePost/test.cmake.in | 28 ---------- .../CTestTestMemcheck/NotExist/CMakeLists.txt | 5 -- .../NotExist/CTestConfig.cmake | 7 --- .../CTestTestMemcheck/NotExist/test.cmake.in | 19 ------- .../CTestTestMemcheck/Unknown/CMakeLists.txt | 5 -- .../Unknown/CTestConfig.cmake | 7 --- Tests/CTestTestMemcheck/Unknown/test.cmake.in | 19 ------- .../{DummyBC => }/test.cmake.in | 11 ++-- 29 files changed, 55 insertions(+), 319 deletions(-) create mode 100644 Tests/CTestTestMemcheck/CMakeLists.txt.in rename Tests/CTestTestMemcheck/{DummyValgrindPrePost/CTestConfig.cmake => CTestConfig.cmake.in} (75%) delete mode 100644 Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyPurify/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/NotExist/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/NotExist/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/Unknown/CMakeLists.txt delete mode 100644 Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake delete mode 100644 Tests/CTestTestMemcheck/Unknown/test.cmake.in rename Tests/CTestTestMemcheck/{DummyBC => }/test.cmake.in (77%) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index d2f3a8745..3d6d8f337 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -31,25 +31,52 @@ target_link_libraries(memcheck_fail CMakeLib) set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") -foreach (_test IN ITEMS Unknown NotExist - DummyValgrind DummyValgrindPrePost - DummyValgrindFailPre DummyValgrindFailPost - DummyPurify DummyBC - DummyValgrindIgnoreMemcheck) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/${_test}/test.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/${_test}/test.cmake" - @ONLY ESCAPE_QUOTES) - add_test(NAME CTestTestMemcheck${_test} +function(gen_mc_test NAME CHECKER) + set(SUBTEST_NAME "${NAME}") + set(CHECKER_COMMAND "${CHECKER}") + foreach(_file IN ITEMS CMakeLists.txt CTestConfig.cmake test.cmake) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${_file}.in" + "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${_file}" @ONLY) + endforeach() + add_test(NAME CTestTestMemcheck${NAME} COMMAND ${CMAKE_CTEST_COMMAND} - -S "${CMAKE_CURRENT_BINARY_DIR}/${_test}/test.cmake" -V - --output-log "${CMAKE_CURRENT_BINARY_DIR}/${_test}/testOutput.log" + -C $ + -S "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake" -V + --output-log "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/testOutput.log" -D PSEUDO_BC=$ -D PSEUDO_PURIFY=$ -D PSEUDO_VALGRIND=$ -D ERROR_COMMAND=$ ) -endforeach () +endfunction(gen_mc_test) + +unset(CTEST_EXTRA_CONFIG) +unset(CTEST_EXTRA_CODE) +unset(CMAKELISTS_EXTRA_CODE) + +gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") +gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") +gen_mc_test(DummyBC "\${PSEUDO_BC}") + +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")\nset(CTEST_CUSTOM_POST_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")") +gen_mc_test(DummyValgrindPrePost "\${PSEUDO_VALGRIND}") + +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"\${ERROR_COMMAND}\")") +gen_mc_test(DummyValgrindFailPost "\${PSEUDO_VALGRIND}") + +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${ERROR_COMMAND}\")") +gen_mc_test(DummyValgrindFailPre "\${PSEUDO_VALGRIND}") + +unset(CTEST_EXTRA_CODE) +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) +unset(CMAKELISTS_EXTRA_CODE) +gen_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") + +gen_mc_test(Unknown "${CMAKE_COMMAND}") string(REPLACE "\\" "\\\\" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND}") string(REPLACE "(" "\\(" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt.in b/Tests/CTestTestMemcheck/CMakeLists.txt.in new file mode 100644 index 000000000..e28e56a9a --- /dev/null +++ b/Tests/CTestTestMemcheck/CMakeLists.txt.in @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheck@SUBTEST_NAME@) +include(CTest) + +add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) + +@CMAKELISTS_EXTRA_CODE@ diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake b/Tests/CTestTestMemcheck/CTestConfig.cmake.in similarity index 75% rename from Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake rename to Tests/CTestTestMemcheck/CTestConfig.cmake.in index 6e4c2e86c..6cf37828f 100644 --- a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake +++ b/Tests/CTestTestMemcheck/CTestConfig.cmake.in @@ -1,7 +1,9 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrindPrePost") +set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) + +@CTEST_EXTRA_CONFIG@ diff --git a/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt deleted file mode 100644 index aa0e495da..000000000 --- a/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyBC) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake deleted file mode 100644 index 39cdd88cc..000000000 --- a/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyBC") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt deleted file mode 100644 index dfd93fde4..000000000 --- a/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyPurify) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake deleted file mode 100644 index 40b960867..000000000 --- a/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyPurify") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in b/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in deleted file mode 100644 index 0c8795cf5..000000000 --- a/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyPurify") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyPurify") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyPurify") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_PURIFY}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt deleted file mode 100644 index 822966ade..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyValgrind) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake deleted file mode 100644 index 4ca59a42e..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in deleted file mode 100644 index c3941c1f9..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrind") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrind") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrind") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt deleted file mode 100644 index 8185071af..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyValgrindFailPost) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake deleted file mode 100644 index 4ca59a42e..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in deleted file mode 100644 index 90e2ac528..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindFailPost") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindFailPost") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindFailPost") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") - -set(CTEST_CUSTOM_POST_MEMCHECK "${ERROR_COMMAND}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt deleted file mode 100644 index 3714cd6a3..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyValgrindFailPre) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake deleted file mode 100644 index 4ca59a42e..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in deleted file mode 100644 index fd17f638b..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindFailPre") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindFailPre") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindFailPre") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") - -set(CTEST_CUSTOM_PRE_MEMCHECK "${ERROR_COMMAND}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt deleted file mode 100644 index 5d437d1b7..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyValgrindIgnoreMemcheck) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") -add_test (RunCMakeAgain "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake deleted file mode 100644 index 6eee3e602..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrindIgnoreMemcheck") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) - -set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain) diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in deleted file mode 100644 index 37aaaeb26..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindIgnoreMemcheck") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindIgnoreMemcheck") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindIgnoreMemcheck") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt deleted file mode 100644 index bc1563212..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckDummyValgrindPrePost) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in deleted file mode 100644 index 11f14a950..000000000 --- a/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindPrePost") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindPrePost") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindPrePost") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") - -set(CTEST_CUSTOM_PRE_MEMCHECK "${CTEST_MEMORYCHECK_COMMAND}") -set(CTEST_CUSTOM_POST_MEMCHECK "${CTEST_MEMORYCHECK_COMMAND}") - -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt b/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt deleted file mode 100644 index 4d905de9e..000000000 --- a/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckNotExist) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake b/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake deleted file mode 100644 index 3ed84aab9..000000000 --- a/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknown") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/NotExist/test.cmake.in b/Tests/CTestTestMemcheck/NotExist/test.cmake.in deleted file mode 100644 index 43f754272..000000000 --- a/Tests/CTestTestMemcheck/NotExist/test.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckNotExist") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/NotExist") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/NotExist") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -set(CTEST_MEMORYCHECK_COMMAND "${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") - -CTEST_START(Experimental) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt b/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt deleted file mode 100644 index 3fd3103ba..000000000 --- a/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheckUnknown) -include(CTest) - -add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake b/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake deleted file mode 100644 index 3ed84aab9..000000000 --- a/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknown") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/Unknown/test.cmake.in b/Tests/CTestTestMemcheck/Unknown/test.cmake.in deleted file mode 100644 index 0830bf056..000000000 --- a/Tests/CTestTestMemcheck/Unknown/test.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckUnknown") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/Unknown") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/Unknown") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -set(CTEST_MEMORYCHECK_COMMAND "@CMAKE_COMMAND@") - -CTEST_START(Experimental) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyBC/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in similarity index 77% rename from Tests/CTestTestMemcheck/DummyBC/test.cmake.in rename to Tests/CTestTestMemcheck/test.cmake.in index 1b16433fb..6c388c52c 100644 --- a/Tests/CTestTestMemcheck/DummyBC/test.cmake.in +++ b/Tests/CTestTestMemcheck/test.cmake.in @@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 2.8.9) # Settings: set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyBC") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_NAME@") -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyBC") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyBC") +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") @@ -14,12 +14,11 @@ set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_BC}") +set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") -#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) +@CTEST_EXTRA_CODE@ CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) From 775225319295c08d2d6d7bb84010e4494d1bc5d0 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 6 May 2013 13:09:22 +0200 Subject: [PATCH 05/10] Tests: verify that memory checker output files are always present All supported memory checkers now write their output to a file. Use a dummy checker that ignores the given filename and ensure that the missing file is reported as error. --- Tests/CTestTestMemcheck/CMakeLists.txt | 27 ++++++++++++++++++- .../NoLogDummyChecker/CMakeLists.txt | 17 ++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 3d6d8f337..65557c3eb 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -28,10 +28,15 @@ target_link_libraries(pseudo_BC CMakeLib) add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.cxx") target_link_libraries(memcheck_fail CMakeLib) +# Binaries that are used as memchecker that do not write the expected +# output file. Need to be in their own subdirectory as they have the +# same filenames. +add_subdirectory(NoLogDummyChecker) + set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") -function(gen_mc_test NAME CHECKER) +function(gen_mc_test_internal NAME CHECKER) set(SUBTEST_NAME "${NAME}") set(CHECKER_COMMAND "${CHECKER}") foreach(_file IN ITEMS CMakeLists.txt CTestConfig.cmake test.cmake) @@ -43,6 +48,12 @@ function(gen_mc_test NAME CHECKER) -C $ -S "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake" -V --output-log "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/testOutput.log" + ${ARGN} + ) +endfunction(gen_mc_test_internal) + +function(gen_mc_test NAME CHECKER) + gen_mc_test_internal(${NAME} "${CHECKER}" -D PSEUDO_BC=$ -D PSEUDO_PURIFY=$ -D PSEUDO_VALGRIND=$ @@ -50,6 +61,17 @@ function(gen_mc_test NAME CHECKER) ) endfunction(gen_mc_test) +function(gen_mcnl_test NAME CHECKER) + gen_mc_test_internal(${NAME} ${CHECKER} + -D PSEUDO_BC=$ + -D PSEUDO_PURIFY=$ + -D PSEUDO_VALGRIND=$ + ) + set_tests_properties(CTestTestMemcheck${NAME} + PROPERTIES + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/${NAME}/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake\n") +endfunction(gen_mcnl_test) + unset(CTEST_EXTRA_CONFIG) unset(CTEST_EXTRA_CODE) unset(CMAKELISTS_EXTRA_CODE) @@ -57,6 +79,9 @@ unset(CMAKELISTS_EXTRA_CODE) gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") +gen_mcnl_test(DummyPurifyNoLogfile "\${PSEUDO_PURIFY}") +gen_mcnl_test(DummyValgrindNoLogfile "\${PSEUDO_VALGRIND}") +gen_mcnl_test(DummyBCNoLogfile "\${PSEUDO_BC}") set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")\nset(CTEST_CUSTOM_POST_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")") gen_mc_test(DummyValgrindPrePost "\${PSEUDO_VALGRIND}") diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt new file mode 100644 index 000000000..c5aa2cdbd --- /dev/null +++ b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt @@ -0,0 +1,17 @@ +# A dummy checker implementation that does not write the requested output file +# so it triggers an error for every checker. + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" "int main(){return 0;}\n") + +foreach(_pseudo IN ITEMS valgrind purify BC) + add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") + set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) +endforeach() + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command(TARGET pseudonl_valgrind + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif() From 3b5b758915125f19cb57994601cc0cd68293fe2b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 6 May 2013 22:04:30 +0200 Subject: [PATCH 06/10] CTest: drop suppression for gcc 2.9.6 errors from default Valgrind flags The --workaround-gcc296-bugs has been part of the default Valgrind flags since Valgrind support was added in commit 5b232ded151fc22144978b74cdaf7031d466e527 (ENH: Add initial memory check support which works for Valgrind, 2003-12-15). The Valgrind manpage says that this option should be avoided if not really needed as it may cause real errors to get ignored. If someone uses a compiler that really needs the flag this flag should be set by the user explicitely. Most users will never set any flags and probably never notice that they use a flag they shouldn't. --- Source/CTest/cmCTestMemCheckHandler.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 280faa0a5..19c156ece 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -491,7 +491,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("--tool=memcheck"); this->MemoryTesterOptions.push_back("--leak-check=yes"); this->MemoryTesterOptions.push_back("--show-reachable=yes"); - this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes"); this->MemoryTesterOptions.push_back("--num-callers=50"); } if ( this->CTest->GetCTestConfiguration( From cbdfcb0e61ad0fe3c61743111594f90c160f526d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 7 May 2013 00:03:16 +0200 Subject: [PATCH 07/10] Tests: add test for non-existent Valgrind suppression file --- Tests/CTestTestMemcheck/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 65557c3eb..fc3b01e7d 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -97,8 +97,11 @@ 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) +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}") + +unset(CTEST_EXTRA_CONFIG) gen_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") gen_mc_test(Unknown "${CMAKE_COMMAND}") @@ -135,3 +138,6 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") + +set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES + PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") From 61ddb9319b8b0d7182d9812df03b88b5d8e57c1d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 9 May 2013 12:09:02 +0200 Subject: [PATCH 08/10] CTest: fix comment documenting cmBoundsCheckerParser class This was obviously copied from Source/cmGlobalXCodeGenerator.cxx during implementation but the comment was forgotten. --- Source/CTest/cmCTestMemCheckHandler.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 19c156ece..8baa673e7 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -43,8 +43,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = { {0,0} }; -// parse the xml file storing the installed version of Xcode on -// the machine +// parse the xml file containing the results of last BoundsChecker run class cmBoundsCheckerParser : public cmXMLParser { public: From 159c3e91ac0abc386ff363ed3382105de7143339 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 9 May 2013 12:24:09 +0200 Subject: [PATCH 09/10] Tests: add a test with custom options passed to valgrind --- Tests/CTestTestMemcheck/CMakeLists.txt | 9 +++++++++ Tests/CTestTestMemcheck/memtester.cxx.in | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index fc3b01e7d..1c0c3b2e1 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -101,6 +101,12 @@ set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRE 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 \"--\")") +gen_mc_test(DummyValgrindCustomOptions "\${PSEUDO_VALGRIND}") + unset(CTEST_EXTRA_CONFIG) gen_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") @@ -141,3 +147,6 @@ set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") + +set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index 64b72d313..4609fa341 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -28,6 +28,12 @@ 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) From 10bc50eacf2263719161cab19d4e576dcff2589b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 13 May 2013 12:23:32 +0200 Subject: [PATCH 10/10] Tests: ignore Guard Malloc messages in MemChecker tests --- Tests/CTestTestMemcheck/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 1c0c3b2e1..59d681680 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -33,7 +33,13 @@ target_link_libraries(memcheck_fail CMakeLib) # same filenames. add_subdirectory(NoLogDummyChecker) -set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") +if (XCODE) + # filter out additional messages by Guard Malloc integrated in Xcode + set(GUARD_MALLOC_MSG "(ctest\([0-9]+\) malloc: [^\n]*\n)*") + set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n${GUARD_MALLOC_MSG}\n${GUARD_MALLOC_MSG}100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \n${GUARD_MALLOC_MSG}Memory checking results:\n${GUARD_MALLOC_MSG}") +else () + set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") +endif () set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") function(gen_mc_test_internal NAME CHECKER)