diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-16 17:18:21 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-16 17:18:21 (GMT) |
commit | 2cc5ed49d17e5a26308d3af288767e7ef405903b (patch) | |
tree | a918403b8c04e6058785876c71e8b79cffd36948 /Source/CTest/cmCTestUpdateHandler.cxx | |
parent | b156314ab3cedc7fa1c8198a320be4a05dd6ff8d (diff) | |
download | CMake-2cc5ed49d17e5a26308d3af288767e7ef405903b.zip CMake-2cc5ed49d17e5a26308d3af288767e7ef405903b.tar.gz CMake-2cc5ed49d17e5a26308d3af288767e7ef405903b.tar.bz2 |
ENH: Several improvements to CTest:
1. Support for showing line numbers when debugging ctest --show-line-numbers
2. Modify the ctest initialization code, so that it can be delayed
3. Handlers now have corresponding command if they were invoked from the command (so far only update actually use that)
4. Start command is simplified and the functionality is moved to CTest
5. Update can perform initial checkout if CTEST_CHECKOUT_COMMAND is set
6. Add test that checks out kwsys and perform tests on the fresh checkout
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8b34ecb..4758436 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -198,7 +198,11 @@ int cmCTestUpdateHandler::ProcessHandler() int updateType = e_CVS; std::string::size_type cc, kk; bool updateProducedError = false; + std::string goutput; + std::string errors; + std::string checkoutErrorMessages; + int retVal = 0; // Get source dir const char* sourceDirectory = this->GetOption("SourceDirectory"); @@ -208,7 +212,50 @@ int cmCTestUpdateHandler::ProcessHandler() return -1; } - cmCTestLog(m_CTest, HANDLER_OUTPUT, "Updating the repository: " << sourceDirectory << std::endl); + cmGeneratedFileStream ofs; + if ( !m_CTest->GetShowOnly() ) + { + m_CTest->OpenOutputFile("Temporary", "LastUpdate.log", ofs); + } + + cmCTestLog(m_CTest, HANDLER_OUTPUT, "Updating the repository" << std::endl); + + const char* initialCheckoutCommand = this->GetOption("InitialCheckout"); + if ( initialCheckoutCommand ) + { + cmCTestLog(m_CTest, HANDLER_OUTPUT, " First perform the initil checkout: " << initialCheckoutCommand << std::endl); + cmStdString parent = cmSystemTools::GetParentDirectory(sourceDirectory); + if ( parent.empty() ) + { + cmCTestLog(m_CTest, ERROR_MESSAGE, + "Something went wrong when trying to determine the parent directory of " << sourceDirectory << std::endl); + return -1; + } + cmCTestLog(m_CTest, HANDLER_OUTPUT, " Perform checkout in directory: " << parent.c_str() << std::endl); + if ( !cmSystemTools::MakeDirectory(parent.c_str()) ) + { + cmCTestLog(m_CTest, ERROR_MESSAGE, + "Cannot create parent directory: " << parent.c_str() << " of the source directory: " << sourceDirectory << std::endl); + return -1; + } + ofs << "* Run initial checkout" << std::endl; + ofs << " Command: " << initialCheckoutCommand << std::endl; + cmCTestLog(m_CTest, DEBUG, " Before: " << initialCheckoutCommand << std::endl); + bool retic = m_CTest->RunCommand(initialCheckoutCommand, &goutput, &errors, &retVal, parent.c_str(), 0 /* Timeout */); + cmCTestLog(m_CTest, DEBUG, " After: " << initialCheckoutCommand << std::endl); + ofs << " Output: " << goutput.c_str() << std::endl; + ofs << " Errors: " << errors.c_str() << std::endl; + if ( !retic || retVal ) + { + cmOStringStream ostr; + ostr << "Problem running initial checkout Output [" << goutput << "] Errors [" << errors << "]"; + cmCTestLog(m_CTest, HANDLER_OUTPUT, ostr.str().c_str() << std::endl); + checkoutErrorMessages += ostr.str(); + updateProducedError = true; + } + m_CTest->InitializeFromCommand(m_Command); + } + cmCTestLog(m_CTest, HANDLER_OUTPUT, " Updating the repository: " << sourceDirectory << std::endl); // Get update command std::string updateCommand = m_CTest->GetCTestConfiguration("UpdateCommand"); @@ -295,21 +342,12 @@ int cmCTestUpdateHandler::ProcessHandler() break; } - cmGeneratedFileStream ofs; - if ( !m_CTest->GetShowOnly() ) - { - m_CTest->OpenOutputFile("Temporary", "LastUpdate.log", ofs); - } - // CVS variables // SVN variables int svn_current_revision = 0; int svn_latest_revision = 0; int svn_use_status = 0; - std::string goutput; - std::string errors; - int retVal = 0; bool res = true; @@ -416,6 +454,7 @@ int cmCTestUpdateHandler::ProcessHandler() if ( !res || retVal ) { updateProducedError = true; + checkoutErrorMessages += " " + goutput; } os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" @@ -833,7 +872,7 @@ int cmCTestUpdateHandler::ProcessHandler() if ( updateProducedError ) { os << "Update error: "; - os << m_CTest->MakeXMLSafe(goutput); + os << m_CTest->MakeXMLSafe(checkoutErrorMessages); cmCTestLog(m_CTest, ERROR_MESSAGE, " Update with command: " << command << " failed" << std::endl); } os << "</UpdateReturnStatus>" << std::endl; |