diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-31 21:32:40 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-31 21:32:40 (GMT) |
commit | f6e5a878fc8de3ac3ef38b144a0a649a9f227682 (patch) | |
tree | ea4927fdd1c147884fc63e19fc417d325f933411 /Source/CTest/cmCTestScriptHandler.cxx | |
parent | f963c406ab2877bb53b66ad60d701b5d7b46f406 (diff) | |
download | CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.zip CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.tar.gz CMake-f6e5a878fc8de3ac3ef38b144a0a649a9f227682.tar.bz2 |
ENH: Add support for writing output file. While doing that, redesign the way ctest does output. There may still be problems with commands failing, but that should be fixed by applying the similar concept to whole CMake
Diffstat (limited to 'Source/CTest/cmCTestScriptHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 1be5907..212c1b8 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -80,7 +80,6 @@ IsFunctionBlocked(const cmListFileFunction& , cmMakefile &) //---------------------------------------------------------------------- cmCTestScriptHandler::cmCTestScriptHandler() { - m_Verbose = false; m_Backup = false; m_EmptyBinDir = false; m_EmptyBinDirOnce = false; @@ -463,13 +462,10 @@ int cmCTestScriptHandler::CheckOutSourceDir() { // we must now checkout the src dir output = ""; - if ( m_Verbose ) - { - std::cerr << "Run cvs: " << m_CVSCheckOut << std::endl; - } + cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run cvs: " << m_CVSCheckOut << std::endl); res = cmSystemTools::RunSingleCommand(m_CVSCheckOut.c_str(), &output, &retVal, m_CTestRoot.c_str(), - m_Verbose, 0 /*m_TimeOut*/); + m_HandlerVerbose, 0 /*m_TimeOut*/); if (!res || retVal != 0) { cmSystemTools::Error("Unable to perform cvs checkout:\n", @@ -543,13 +539,10 @@ int cmCTestScriptHandler::PerformExtraUpdates() fullCommand += cvsArgs[1]; output = ""; retVal = 0; - if ( m_Verbose ) - { - std::cerr << "Run CVS: " << fullCommand.c_str() << std::endl; - } + cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run CVS: " << fullCommand.c_str() << std::endl); res = cmSystemTools::RunSingleCommand(fullCommand.c_str(), &output, &retVal, cvsArgs[0].c_str(), - m_Verbose, 0 /*m_TimeOut*/); + m_HandlerVerbose, 0 /*m_TimeOut*/); if (!res || retVal != 0) { cmSystemTools::Error("Unable to perform extra cvs updates:\n", @@ -592,7 +585,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() { if ( !cmCTestScriptHandler::EmptyBinaryDirectory(m_BinaryDir.c_str()) ) { - std::cerr << "Problem removing the binary directory" << std::endl; + cmCTestLog(m_CTest, ERROR, "Problem removing the binary directory" << std::endl); } } @@ -669,13 +662,10 @@ int cmCTestScriptHandler::RunConfigurationDashboard() output = ""; command += "\""; retVal = 0; - if ( m_Verbose ) - { - std::cerr << "Run cmake command: " << command.c_str() << std::endl; - } + cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run cmake command: " << command.c_str() << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, m_BinaryDir.c_str(), - m_Verbose, 0 /*m_TimeOut*/); + m_HandlerVerbose, 0 /*m_TimeOut*/); if ( !m_CMOutFile.empty() ) { @@ -685,11 +675,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() cmakeOutputFile = m_BinaryDir + "/" + cmakeOutputFile; } - if ( m_Verbose ) - { - std::cerr << "Write CMake output to file: " << cmakeOutputFile.c_str() - << std::endl; - } + cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Write CMake output to file: " << cmakeOutputFile.c_str() + << std::endl); cmGeneratedFileStream fout(cmakeOutputFile.c_str()); if ( fout ) { @@ -697,8 +684,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() } else { - cmSystemTools::Error("Cannot open CMake output file: ", - cmakeOutputFile.c_str(), " for writing"); + cmCTestLog(m_CTest, ERROR, "Cannot open CMake output file: " + << cmakeOutputFile.c_str() << " for writing" << std::endl); } } if (!res || retVal != 0) @@ -718,13 +705,10 @@ int cmCTestScriptHandler::RunConfigurationDashboard() command = ctestCommands[i]; output = ""; retVal = 0; - if ( m_Verbose ) - { - std::cerr << "Run ctest command: " << command.c_str() << std::endl; - } + cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run ctest command: " << command.c_str() << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, m_BinaryDir.c_str(), - m_Verbose, 0 /*m_TimeOut*/); + m_HandlerVerbose, 0 /*m_TimeOut*/); // did something critical fail in ctest if (!res || cmakeFailed || @@ -733,11 +717,12 @@ int cmCTestScriptHandler::RunConfigurationDashboard() this->RestoreBackupDirectories(); if (cmakeFailed) { - cmSystemTools::Error("Unable to run cmake:\n", - cmakeFailedOuput.c_str()); + cmCTestLog(m_CTest, ERROR, "Unable to run cmake:" << std::endl + << cmakeFailedOuput.c_str() << std::endl); return 10; } - cmSystemTools::Error("Unable to run ctest:\n", output.c_str()); + cmCTestLog(m_CTest, ERROR, "Unable to run ctest:" << std::endl + << output.c_str() << std::endl); if (!res) { return 11; |