diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-19 15:16:57 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-19 15:16:57 (GMT) |
commit | 797db515a0ff1eceb993481673fa85e601ae5f6e (patch) | |
tree | 347b5bdc59e09576afa362427505f93f69084e5c | |
parent | 4710c7aef619b34486980c74bf226986550ae3b6 (diff) | |
download | CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.zip CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.tar.gz CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.tar.bz2 |
ENH: fix failing test when valgrind is on
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 30 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 4 | ||||
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 2 |
4 files changed, 25 insertions, 13 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 8249352..fafbdea 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -655,11 +655,11 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, cres.ExecutionTime = (double)(clock_finish - clock_start); cres.FullCommandLine = testCommand; - + std::string reason; if ( !this->CTest->GetShowOnly() ) { bool testFailed = false; - std::vector<cmsys::RegularExpression>::iterator passIt; + std::vector<std::pair<cmsys::RegularExpression,std::string> >::iterator passIt; bool forceFail = false; if ( it->RequiredRegularExpressions.size() > 0 ) { @@ -668,13 +668,17 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, passIt != it->RequiredRegularExpressions.end(); ++ passIt ) { - if ( passIt->find(output.c_str()) ) + if ( passIt->first.find(output.c_str()) ) { found = true; } } if ( !found ) - { + { + reason = "Required regular expression not found."; + reason += "Regex=["; + reason += passIt->second; + reason += "]"; forceFail = true; } } @@ -684,8 +688,12 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, passIt != it->ErrorRegularExpressions.end(); ++ passIt ) { - if ( passIt->find(output.c_str()) ) + if ( passIt->first.find(output.c_str()) ) { + reason = "Error regular expression found in output."; + reason += " Regex=["; + reason += passIt->second; + reason += "]"; forceFail = true; } } @@ -701,7 +709,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, cmCTestLog(this->CTest, HANDLER_OUTPUT, " - But it should fail!"); cres.Status = cmCTestTestHandler::FAILED; testFailed = true; - } + } else { cres.Status = cmCTestTestHandler::COMPLETED; @@ -754,7 +762,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, else { // Force fail will also be here? - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed " << reason); if ( it->WillFail ) { cres.Status = cmCTestTestHandler::COMPLETED; @@ -1729,7 +1737,9 @@ bool cmCTestTestHandler::SetTestsProperties( for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->ErrorRegularExpressions.push_back( - cmsys::RegularExpression(crit->c_str())); + std::pair<cmsys::RegularExpression, std::string>( + cmsys::RegularExpression(crit->c_str()), + std::string(crit->c_str()))); } } if ( key == "MEASUREMENT" ) @@ -1754,7 +1764,9 @@ bool cmCTestTestHandler::SetTestsProperties( for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->RequiredRegularExpressions.push_back( - cmsys::RegularExpression(crit->c_str())); + std::pair<cmsys::RegularExpression, std::string>( + cmsys::RegularExpression(crit->c_str()), + std::string(crit->c_str()))); } } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 457b843..e4f0b98 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -80,8 +80,8 @@ public: cmStdString Name; cmStdString Directory; std::vector<std::string> Args; - std::vector<cmsys::RegularExpression> ErrorRegularExpressions; - std::vector<cmsys::RegularExpression> RequiredRegularExpressions; + std::vector<std::pair<cmsys::RegularExpression,std::string> > ErrorRegularExpressions; + std::vector<std::pair<cmsys::RegularExpression,std::string> > RequiredRegularExpressions; std::map<cmStdString, cmStdString> Measurements; bool IsInBasedOnREOptions; bool WillFail; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 5a65faa..13b884b 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -950,7 +950,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # We expect test to fail SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES WILL_FAIL ON) GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv) - SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed") + SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR_NOT_VALGRIND;FAIL;Test failed") SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed") SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value") MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b31bf6a..f1c13c0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -640,7 +640,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES) ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V + -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -VV --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log" ) # these tests take a long time, make sure they have it |