summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx30
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx97
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.h5
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx50
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx49
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx6
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx190
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx103
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx117
12 files changed, 312 insertions, 358 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 5fe8e44..520cd92 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -171,8 +171,8 @@ cmCTestBuildHandler::cmCTestBuildHandler()
}
else
{
- std::cout << "Problem Compiling regular expression: "
- << cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem Compiling regular expression: "
+ << cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl);
}
}
}
@@ -196,17 +196,17 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf)
//functions and commented...
int cmCTestBuildHandler::ProcessHandler()
{
- std::cout << "Build project" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl);
const std::string &makeCommand = m_CTest->GetCTestConfiguration("MakeCommand");
if ( makeCommand.size() == 0 )
{
- std::cerr << "Cannot find MakeCommand key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find MakeCommand key in the DartConfiguration.tcl" << std::endl);
return -1;
}
const std::string &buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
- std::cerr << "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
return -1;
}
@@ -214,7 +214,7 @@ int cmCTestBuildHandler::ProcessHandler()
double elapsed_time_start = cmSystemTools::GetTime();
if ( !m_CTest->OpenOutputFile("Temporary", "LastBuild.log", ofs) )
{
- std::cerr << "Cannot create LastBuild.log file" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot create LastBuild.log file" << std::endl);
}
m_StartBuild = m_CTest->CurrentTime();
@@ -224,18 +224,17 @@ int cmCTestBuildHandler::ProcessHandler()
if ( !m_CTest->GetShowOnly() )
{
res = m_CTest->RunMakeCommand(makeCommand.c_str(), &output,
- &retVal, buildDirectory.c_str(),
- m_Verbose, 0, ofs);
+ &retVal, buildDirectory.c_str(), 0, ofs);
}
else
{
- std::cout << "Build with command: " << makeCommand << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Build with command: " << makeCommand << std::endl);
}
m_EndBuild = m_CTest->CurrentTime();
double elapsed_build_time = cmSystemTools::GetTime() - elapsed_time_start;
if (res != cmsysProcess_State_Exited || retVal )
{
- std::cerr << "Error(s) when building project" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Error(s) when building project" << std::endl);
}
std::vector<cmStdString>::size_type cc;
@@ -382,13 +381,13 @@ int cmCTestBuildHandler::ProcessHandler()
bool found = false;
if ( markedLines[kk] == 1 )
{
- //std::cout << "Error: " << lines[kk] << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Error: " << lines[kk] << std::endl);
errorwarning.m_Error = true;
found = true;
}
else if ( markedLines[kk] > 1 )
{
- //std::cout << "Warning: " << lines[kk] << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Warning: " << lines[kk] << std::endl);
errorwarning.m_Error = false;
found = true;
}
@@ -433,13 +432,12 @@ int cmCTestBuildHandler::ProcessHandler()
}
}
- std::cout << " " << errors << " Compiler errors" << std::endl;
- std::cout << " " << warnings << " Compiler warnings" << std::endl;
-
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << errors << " Compiler errors" << std::endl);
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << warnings << " Compiler warnings" << std::endl);
cmGeneratedFileStream xofs;
if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Build.xml", xofs, true) )
{
- std::cerr << "Cannot create build XML file" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot create build XML file" << std::endl);
return -1;
}
this->GenerateDartBuildOutput(xofs, errorsWarnings, elapsed_build_time);
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index 1f6cc8b..4e8d2db 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -26,7 +26,6 @@
//----------------------------------------------------------------------
cmCTestConfigureHandler::cmCTestConfigureHandler()
{
- m_Verbose = false;
m_CTest = 0;
}
@@ -36,19 +35,19 @@ cmCTestConfigureHandler::cmCTestConfigureHandler()
//functions and commented...
int cmCTestConfigureHandler::ProcessHandler()
{
- std::cout << "Configure project" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
std::string cCommand = m_CTest->GetCTestConfiguration("ConfigureCommand");
if ( cCommand.size() == 0 )
{
- std::cerr << "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
- << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
+ << std::endl);
return -1;
}
std::string buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
- std::cerr << "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
return -1;
}
@@ -61,7 +60,7 @@ int cmCTestConfigureHandler::ProcessHandler()
cmGeneratedFileStream os;
if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Configure.xml", os, true) )
{
- std::cerr << "Cannot open configure file" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open configure file" << std::endl);
return 1;
}
std::string start_time = m_CTest->CurrentTime();
@@ -70,7 +69,7 @@ int cmCTestConfigureHandler::ProcessHandler()
m_CTest->OpenOutputFile("Temporary", "LastConfigure.log", ofs);
res = m_CTest->RunMakeCommand(cCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
- m_Verbose, 0, ofs);
+ 0, ofs);
if ( ofs )
{
@@ -87,7 +86,7 @@ int cmCTestConfigureHandler::ProcessHandler()
os << retVal;
}
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>" << std::endl;
- //std::cout << "End" << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
os << "<Log>" << cmCTest::MakeXMLSafe(output) << "</Log>" << std::endl;
std::string end_time = m_CTest->CurrentTime();
os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n"
@@ -102,11 +101,11 @@ int cmCTestConfigureHandler::ProcessHandler()
}
else
{
- std::cout << "Configure with command: " << cCommand << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand << std::endl);
}
if (! res || retVal )
{
- std::cerr << "Error(s) when updating the project" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Error(s) when updating the project" << std::endl);
return -1;
}
return 0;
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index de42576..7043fbd 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -34,7 +34,6 @@
//----------------------------------------------------------------------
cmCTestCoverageHandler::cmCTestCoverageHandler()
{
- m_Verbose = false;
m_CTest = 0;
}
@@ -43,11 +42,11 @@ bool cmCTestCoverageHandler::StartLogFile(cmGeneratedFileStream& covLogFile, int
{
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
- std::cout << "Open file: " << covLogFilename << std::endl;
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " << covLogFilename << std::endl);
if (!m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(),
covLogFilename, covLogFile, true))
{
- std::cerr << "Cannot open log file: " << covLogFilename << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open log file: " << covLogFilename << std::endl);
return false;
}
std::string local_start_time = m_CTest->CurrentTime();
@@ -66,13 +65,13 @@ void cmCTestCoverageHandler::EndLogFile(cmGeneratedFileStream& ostr, int logFile
m_CTest->EndXML(ostr);
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
- std::cout << "Close file: " << covLogFilename << std::endl;
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " << covLogFilename << std::endl);
ostr.close();
}
//----------------------------------------------------------------------
bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* srcDir,
- const char* binDir, bool verbose)
+ const char* binDir)
{
std::string fSrcDir = cmSystemTools::CollapseFullPath(srcDir);
std::string fBinDir = cmSystemTools::CollapseFullPath(binDir);
@@ -108,10 +107,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
- if ( verbose )
- {
- std::cout << "Found: " << ndc.c_str() << " so skip coverage of " << file << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() << " so skip coverage of " << file << std::endl);
return false;
}
@@ -141,10 +137,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
- if ( verbose )
- {
- std::cout << "Found: " << ndc.c_str() << " so skip coverage of: " << file << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() << " so skip coverage of: " << file << std::endl);
return false;
}
// Ok, nothing in source tree, nothing in binary tree
@@ -171,7 +164,7 @@ int cmCTestCoverageHandler::ProcessHandler()
std::string gcovOutputRex = "[0-9]+\\.[0-9]+% of [0-9]+ (source |)lines executed in file (.*)$";
std::string gcovOutputRex2 = "^Creating (.*\\.gcov)\\.";
- std::cout << "Performing coverage" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl);
double elapsed_time_start = cmSystemTools::GetTime();
std::string coverage_start_time = m_CTest->CurrentTime();
@@ -190,7 +183,7 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( files.size() == 0 )
{
- std::cerr << " Cannot find any coverage files." << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Cannot find any coverage files." << std::endl);
// No coverage files is a valid thing, so the exit code is 0
return 0;
}
@@ -209,10 +202,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir + "\" \"" + *it + "\"";
- if ( m_Verbose )
- {
- std::cout << command.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() << std::endl);
std::string output = "";
int retVal = 0;
int res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
@@ -220,13 +210,13 @@ int cmCTestCoverageHandler::ProcessHandler()
false, 0 /*m_TimeOut*/);
if ( ! res )
{
- std::cerr << "Problem running coverage on file: " << it->c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem running coverage on file: " << it->c_str() << std::endl);
error ++;
continue;
}
if ( retVal != 0 )
{
- std::cerr << "Coverage command returned: " << retVal << " while processing: " << it->c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Coverage command returned: " << retVal << " while processing: " << it->c_str() << std::endl);
}
std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line;
@@ -242,10 +232,7 @@ int cmCTestCoverageHandler::ProcessHandler()
file.substr(0, sourceDir.size()) == sourceDir &&
file[sourceDir.size()] == '/' )
{
- if ( m_Verbose )
- {
- std::cout << " produced s: " << file << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " << file << std::endl);
cfile = file;
}
// Binary dir?
@@ -253,18 +240,15 @@ int cmCTestCoverageHandler::ProcessHandler()
file.substr(0, binaryDir.size()) == binaryDir &&
file[binaryDir.size()] == '/' )
{
- if ( m_Verbose )
- {
- std::cout << " produce b: " << file << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produce b: " << file << std::endl);
cfile = file;
}
if ( cfile.empty() )
{
- std::cerr << "Something went wrong" << std::endl;
- std::cerr << "File: [" << file << "]" << std::endl;
- std::cerr << "s: [" << file.substr(0, sourceDir.size()) << "]" << std::endl;
- std::cerr << "b: [" << file.substr(0, binaryDir.size()) << "]" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Something went wrong" << std::endl);
+ cmCTestLog(m_CTest, ERROR, "File: [" << file << "]" << std::endl);
+ cmCTestLog(m_CTest, ERROR, "s: [" << file.substr(0, sourceDir.size()) << "]" << std::endl);
+ cmCTestLog(m_CTest, ERROR, "b: [" << file.substr(0, binaryDir.size()) << "]" << std::endl);
}
}
else if ( re2.find(line->c_str() ) )
@@ -273,14 +257,11 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( cfile.size() )
{
singleFileCoverageVector* vec = &totalCoverage[cfile];
- if ( m_Verbose )
- {
- std::cout << " in file: " << fname << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " in file: " << fname << std::endl);
std::ifstream ifile(fname.c_str());
if ( ! ifile )
{
- std::cerr << "Cannot open file: " << fname << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open file: " << fname << std::endl);
}
else
{
@@ -317,7 +298,7 @@ int cmCTestCoverageHandler::ProcessHandler()
}
else
{
- std::cerr << "Unknown line: " << line->c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Unknown line: " << line->c_str() << std::endl);
error ++;
}
}
@@ -329,7 +310,8 @@ int cmCTestCoverageHandler::ProcessHandler()
if (!m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(),
"Coverage.xml", covSumFile, true))
{
- std::cerr << "Cannot open coverage summary file: Coverage.xml" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open coverage summary file: Coverage.xml" << std::endl);
+
return -1;
}
@@ -366,30 +348,24 @@ int cmCTestCoverageHandler::ProcessHandler()
const std::string fullFileName = fileIterator->first;
const std::string fileName = cmSystemTools::GetFilenameName(fullFileName.c_str());
std::string fullFilePath = cmSystemTools::GetFilenamePath(fullFileName.c_str());
- if ( m_Verbose )
- {
- std::cerr << "Process file: " << fullFileName << std::endl;
- }
+ cmCTestLog(m_CTest, ERROR, "Process file: " << fullFileName << std::endl);
cmSystemTools::ConvertToUnixSlashes(fullFilePath);
if ( !cmSystemTools::FileExists(fullFileName.c_str()) )
{
- std::cerr << "Cannot find file: " << fullFileName.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find file: " << fullFileName.c_str() << std::endl);
continue;
}
bool shouldIDoCoverage
= this->ShouldIDoCoverage(fullFileName.c_str(),
- sourceDir.c_str(), binaryDir.c_str(), m_Verbose);
+ sourceDir.c_str(), binaryDir.c_str());
if ( !shouldIDoCoverage )
{
- if ( m_Verbose )
- {
- std::cerr << ".NoDartCoverage found, so skip coverage check for: "
- << fullFileName.c_str()
- << std::endl;
- }
+ cmCTestLog(m_CTest, ERROR, ".NoDartCoverage found, so skip coverage check for: "
+ << fullFileName.c_str()
+ << std::endl);
continue;
}
@@ -403,7 +379,7 @@ int cmCTestCoverageHandler::ProcessHandler()
std::ifstream ifs(fullFileName.c_str());
if ( !ifs)
{
- std::cerr << "Cannot open source file: " << fullFileName.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open source file: " << fullFileName.c_str() << std::endl);
error ++;
continue;
}
@@ -417,7 +393,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( !cmSystemTools::GetLineFromStream(ifs, line) )
{
- std::cerr << "Problem reading source file: " << fullFileName.c_str() << " line:" << cc << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem reading source file: " << fullFileName.c_str() << " line:" << cc << std::endl);
error ++;
break;
}
@@ -434,7 +410,7 @@ int cmCTestCoverageHandler::ProcessHandler()
}
if ( cmSystemTools::GetLineFromStream(ifs, line) )
{
- std::cerr << "Looks like there are more lines in the file: " << line << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Looks like there are more lines in the file: " << line << std::endl);
}
float cper = 0;
float cmet = 0;
@@ -492,14 +468,13 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "</Coverage>" << std::endl;
m_CTest->EndXML(covSumFile);
- std::cout << "\tCovered LOC: " << total_tested << std::endl
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "\tCovered LOC: " << total_tested << std::endl
<< "\tNot covered LOC: " << total_untested << std::endl
<< "\tTotal LOC: " << total_lines << std::endl
- << "\tPercentage Coverage: ";
-
- std::cout.setf(std::ios::fixed, std::ios::floatfield);
- std::cout.precision(2);
- std::cout << (percent_coverage) << "%" << std::endl;
+ << "\tPercentage Coverage: "
+ << std::setiosflags(std::ios::fixed)
+ << std::setprecision(2)
+ << (percent_coverage) << "%" << std::endl);
cmSystemTools::ChangeDirectory(currentDirectory.c_str());
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index d303ff1..fc11df6 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -41,7 +41,7 @@ public:
private:
bool ShouldIDoCoverage(const char* file, const char* srcDir,
- const char* binDir, bool verbose);
+ const char* binDir);
bool StartLogFile(cmGeneratedFileStream& ostr, int logFileCount);
void EndLogFile(cmGeneratedFileStream& ostr, int logFileCount);
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 0fa6d07..0f48062 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -19,7 +19,7 @@
cmCTestGenericHandler::cmCTestGenericHandler()
{
- m_Verbose = false;
+ m_HandlerVerbose = false;
m_CTest = 0;
}
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index a40974c..f5b203e 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -34,7 +34,7 @@ public:
/**
* If verbose then more informaiton is printed out
*/
- void SetVerbose(bool val) { m_Verbose = val; }
+ void SetVerbose(bool val) { m_HandlerVerbose = val; }
/**
* Populate internals from CTest custom scripts
@@ -51,6 +51,7 @@ public:
* Set the CTest instance
*/
void SetCTestInstance(cmCTest* ctest) { m_CTest = ctest; }
+ cmCTest* GetCTestInstance() { return m_CTest; }
/**
* Construct handler
@@ -64,7 +65,7 @@ public:
const char* GetOption(const char* op);
protected:
- bool m_Verbose;
+ bool m_HandlerVerbose;
cmCTest *m_CTest;
t_StringToString m_Options;
};
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index ef56428..aea9641 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -100,7 +100,7 @@ int cmCTestMemCheckHandler::PreProcessHandler()
if ( !this->ExecuteCommands(m_CustomPreMemCheck) )
{
- std::cerr << "Problem executing pre-memcheck command(s)." << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem executing pre-memcheck command(s)." << std::endl);
return 0;
}
return 1;
@@ -111,7 +111,7 @@ int cmCTestMemCheckHandler::PostProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPostMemCheck) )
{
- std::cerr << "Problem executing post-memcheck command(s)." << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem executing post-memcheck command(s)." << std::endl);
return 0;
}
return 1;
@@ -130,10 +130,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(std::vector<const char*>& args)
memcheckcommand += " ";
memcheckcommand += cmSystemTools::EscapeSpaces(m_MemoryTesterOptionsParsed[pp].c_str());
}
- if ( m_Verbose )
- {
- std::cout << "Memory check command: " << memcheckcommand << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " << memcheckcommand << std::endl);
}
//----------------------------------------------------------------------
@@ -188,7 +185,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
<< "</Test>" << std::endl;
}
os << "\t</TestList>\n";
- std::cout << "-- Processing memory checking output: ";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "-- Processing memory checking output: ");
unsigned int total = m_TestResults.size();
unsigned int step = total / 10;
unsigned int current = 0;
@@ -244,21 +241,24 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
<< "\t</Test>" << std::endl;
if ( current < cc )
{
- std::cout << "#";
- std::cout.flush();
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "#" << std::flush);
current += step;
}
}
- std::cout << std::endl;
- std::cerr << "Memory checking results:" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl);
os << "\t<DefectList>" << std::endl;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
if ( m_MemoryTesterGlobalResults[cc] )
{
+#ifdef cerr
+# undef cerr
+#endif
std::cerr.width(35);
- std::cerr << cmCTestMemCheckResultLongStrings[cc] << " - "
- << m_MemoryTesterGlobalResults[cc] << std::endl;
+#define cerr no_cerr
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, cmCTestMemCheckResultLongStrings[cc] << " - "
+ << m_MemoryTesterGlobalResults[cc] << std::endl);
os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc] << "\"/>" << std::endl;
}
}
@@ -296,8 +296,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
}
else
{
- std::cerr << "Memory checker (MemoryCheckCommand) not set, or cannot find the specified program."
- << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Memory checker (MemoryCheckCommand) not set, or cannot find the specified program."
+ << std::endl);
return false;
}
@@ -330,8 +330,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
{
if ( !cmSystemTools::FileExists(m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str()) )
{
- std::cerr << "Cannot find memory checker suppression file: "
- << m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find memory checker suppression file: "
+ << m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str() << std::endl);
return false;
}
m_MemoryTesterOptions += " --suppressions=" + cmSystemTools::EscapeSpaces(m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str()) + "";
@@ -349,12 +349,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
else if ( m_MemoryTester.find("boundschecker") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
- std::cerr << "Bounds checker not yet implemented" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Bounds checker not yet implemented" << std::endl);
return false;
}
else
{
- std::cerr << "Do not understand memory checker: " << m_MemoryTester.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Do not understand memory checker: " << m_MemoryTester.c_str() << std::endl);
return false;
}
@@ -409,7 +409,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
if ( !cmSystemTools::FileExists(m_MemoryTesterOutputFile.c_str()) )
{
log = "Cannot find Purify output file: " + m_MemoryTesterOutputFile;
- std::cerr << log.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, log.c_str() << std::endl);
return false;
}
@@ -417,7 +417,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
if ( !ifs )
{
log = "Cannot read Purify output file: " + m_MemoryTesterOutputFile;
- std::cerr << log.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, log.c_str() << std::endl);
return false;
}
@@ -445,7 +445,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT )
{
- std::cerr<< "Unknown Purify memory fault: " << pfW.match(1) << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Unknown Purify memory fault: " << pfW.match(1) << std::endl);
ostr << "*** Unknown Purify memory fault: " << pfW.match(1) << std::endl;
}
}
@@ -508,8 +508,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]");
cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is locked by a different thread");
- //double sttime = cmSystemTools::GetTime();
- //std::cout << "Start test: " << lines.size() << std::endl;
+ double sttime = cmSystemTools::GetTime();
+ cmCTestLog(m_CTest, DEBUG, "Start test: " << lines.size() << std::endl);
for ( cc = 0; cc < lines.size(); cc ++ )
{
if ( valgrindLine.find(lines[cc]) )
@@ -538,7 +538,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
}
}
- //std::cout << "End test (elapsed: " << (cmSystemTools::GetTime() - sttime) << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "End test (elapsed: " << (cmSystemTools::GetTime() - sttime) << std::endl);
log = ostr.str();
if ( defects )
{
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;
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index fe81fd4..096be9e 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -64,15 +64,15 @@ bool cmCTestStartCommand::InitialPass(
this->SetError("binary directory not specified. Specify binary directory as an argument or set CTEST_BINARY_DIRECTORY");
return false;
}
- std::cout << "Run dashboard with model " << smodel
- << " for src dir: " << src_dir << " and binary dir: " << bld_dir << std::endl;
+ cmCTestLog(m_CTest, OUTPUT, "Run dashboard with model " << smodel
+ << " for src dir: " << src_dir << " and binary dir: " << bld_dir << std::endl);
std::string fname = src_dir;
fname += "/CTestConfig.cmake";
cmSystemTools::ConvertToUnixSlashes(fname);
if ( cmSystemTools::FileExists(fname.c_str()) )
{
- std::cout << " Reading ctest configuration file: " << fname.c_str() << std::endl;
+ cmCTestLog(m_CTest, OUTPUT, " Reading ctest configuration file: " << fname.c_str() << std::endl);
bool readit = m_Makefile->ReadListFile(m_Makefile->GetCurrentListFile(),
fname.c_str() );
if(!readit)
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 28f8612..5bb298a 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -33,10 +33,23 @@ PURPOSE. See the above copyright notices for more information.
#include <sys/stat.h>
+typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
+
+static size_t
+cmCTestSubmitHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+ register int realsize = size * nmemb;
+
+ cmCTestSubmitHandlerVectorOfChar *vec = static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
+ const char* chPtr = static_cast<char*>(ptr);
+ vec->insert(vec->end(), chPtr, chPtr + realsize);
+
+ return realsize;
+}
+
//----------------------------------------------------------------------------
cmCTestSubmitHandler::cmCTestSubmitHandler() : m_HTTPProxy(), m_FTPProxy()
{
- m_Verbose = false;
m_HTTPProxy = "";
m_HTTPProxyType = 0;
m_HTTPProxyAuth = "";
@@ -107,11 +120,11 @@ cmCTestSubmitHandler::cmCTestSubmitHandler() : m_HTTPProxy(), m_FTPProxy()
}
if ( m_HTTPProxy.size() > 0 )
{
- std::cout << " Use HTTP Proxy: " << m_HTTPProxy << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " << m_HTTPProxy << std::endl);
}
if ( m_FTPProxy.size() > 0 )
{
- std::cout << " Use FTP Proxy: " << m_FTPProxy << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use FTP Proxy: " << m_FTPProxy << std::endl);
}
}
@@ -168,13 +181,11 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
ftpfile = ::fopen(local_file.c_str(), "rb");
*m_LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << std::endl;
- if ( m_Verbose )
- {
- std::cout << " Upload file: " << local_file.c_str() << " to "
- << upload_as.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file.c_str() << " to "
+ << upload_as.c_str() << std::endl);
- if ( m_Verbose )
+ ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
+ if ( m_HandlerVerbose )
{
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
@@ -187,24 +198,39 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
// and give the size of the upload (optional)
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(st.st_size));
+ // and give curl the buffer for errors
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
+ // specify handler for output
+ ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmCTestSubmitHandlerWriteMemoryCallback);
+
+ /* we pass our 'chunk' struct to the callback function */
+ cmCTestSubmitHandlerVectorOfChar chunk;
+ ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
+
// Now run off and do what you've been told!
res = ::curl_easy_perform(curl);
+
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
+
fclose(ftpfile);
if ( res )
{
- std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl;
- std::cerr << " Error message was: " << error_buffer << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Error when uploading file: " << local_file.c_str() << std::endl);
+ cmCTestLog(m_CTest, ERROR, " Error message was: " << error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl
- << " Error message was: " << error_buffer << std::endl;
+ << " Error message was: " << error_buffer << std::endl
+ << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
+ cmCTestLog(m_CTest, ERROR, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
// always cleanup
::curl_easy_cleanup(curl);
- std::cout << " Uploaded: " + local_file << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file << std::endl);
}
}
::curl_global_cleanup();
@@ -261,7 +287,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, 1);
- if ( m_Verbose )
+ ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
+ if ( m_HandlerVerbose )
{
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
@@ -306,11 +333,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
ftpfile = ::fopen(local_file.c_str(), "rb");
- if ( m_Verbose )
- {
- std::cout << " Upload file: " << local_file.c_str() << " to "
- << upload_as.c_str() << " Size: " << st.st_size << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file.c_str() << " to "
+ << upload_as.c_str() << " Size: " << st.st_size << std::endl);
// specify target
@@ -325,22 +349,36 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
// and give curl the buffer for errors
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
+ // specify handler for output
+ ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmCTestSubmitHandlerWriteMemoryCallback);
+
+ /* we pass our 'chunk' struct to the callback function */
+ cmCTestSubmitHandlerVectorOfChar chunk;
+ ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
+
// Now run off and do what you've been told!
res = ::curl_easy_perform(curl);
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
+
fclose(ftpfile);
if ( res )
{
- std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Error when uploading file: " << local_file.c_str() << std::endl);
+ cmCTestLog(m_CTest, ERROR, " Error message was: " << error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl
- << " Error message was: " << error_buffer << std::endl;
+ << " Error message was: " << error_buffer << std::endl
+ << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
+ cmCTestLog(m_CTest, ERROR, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
// always cleanup
::curl_easy_cleanup(curl);
- std::cout << " Uploaded: " + local_file << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file << std::endl);
}
}
::curl_global_cleanup();
@@ -388,7 +426,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::vector<cmStdString>& file
}
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
- if ( m_Verbose )
+ if ( m_HandlerVerbose )
{
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
@@ -396,6 +434,13 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::vector<cmStdString>& file
// and give curl the buffer for errors
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
+ // specify handler for output
+ ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmCTestSubmitHandlerWriteMemoryCallback);
+
+ /* we pass our 'chunk' struct to the callback function */
+ cmCTestSubmitHandlerVectorOfChar chunk;
+ ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
+
cmStdString file = remoteprefix + files[cc];
cmStdString ofile = "";
for ( kk = 0; kk < file.size(); kk ++ )
@@ -424,26 +469,32 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::vector<cmStdString>& file
= url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&")
+ "xmlfile=" + ofile;
*m_LogFile << "Trigger url: " << turl.c_str() << std::endl;
- if ( m_Verbose )
- {
- std::cout << " Trigger url: " << turl.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " << turl.c_str() << std::endl);
curl_easy_setopt(curl, CURLOPT_URL, turl.c_str());
if ( curl_easy_perform(curl) )
{
- std::cerr << " Error when triggering: " << turl.c_str() << std::endl;
- *m_LogFile << "\tTrigerring failed with error: " << error_buffer << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Error when triggering: " << turl.c_str() << std::endl);
+ cmCTestLog(m_CTest, ERROR, " Error message was: " << error_buffer << std::endl);
+ *m_LogFile << "\tTrigerring failed with error: " << error_buffer << std::endl
+ << " Error message was: " << error_buffer << std::endl
+ << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
+ cmCTestLog(m_CTest, ERROR, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
+
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
+
// always cleanup
::curl_easy_cleanup(curl);
- std::cout << std::endl;
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
}
}
::curl_global_cleanup();
- std::cout << " Dart server triggered..." << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Dart server triggered..." << std::endl);
return true;
}
@@ -486,11 +537,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
argv[1] = lfname.c_str();
std::string rfname = url + "/" + remoteprefix + *it;
argv[2] = rfname.c_str();
- if ( m_Verbose )
- {
- std::cout << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
- << argv[2] << "\"" << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
+ << argv[2] << "\"" << std::endl);
*m_LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl;
cmsysProcess_SetCommand(cp, &*argv.begin());
@@ -499,7 +547,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
int length;
while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
- std::cout.write(data, length);
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLogWrite(data, length));
}
cmsysProcess_WaitForExit(cp, 0);
int result = cmsysProcess_GetState(cp);
@@ -509,10 +557,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
retVal = cmsysProcess_GetExitValue(cp);
if ( retVal != 0 )
{
- if ( m_Verbose )
- {
- std::cout << "\tSCP returned: " << retVal << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: " << retVal << std::endl);
*m_LogFile << "\tSCP returned: " << retVal << std::endl;
problems ++;
}
@@ -520,29 +565,20 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
else if(result == cmsysProcess_State_Exception)
{
retVal = cmsysProcess_GetExitException(cp);
- if ( m_Verbose )
- {
- std::cerr << "\tThere was an exception: " << retVal << std::endl;
- }
+ cmCTestLog(m_CTest, ERROR, "\tThere was an exception: " << retVal << std::endl);
*m_LogFile << "\tThere was an exception: " << retVal << std::endl;
problems ++;
}
else if(result == cmsysProcess_State_Expired)
{
- if ( m_Verbose )
- {
- std::cerr << "\tThere was a timeout" << std::endl;
- }
+ cmCTestLog(m_CTest, ERROR, "\tThere was a timeout" << std::endl);
*m_LogFile << "\tThere was a timeout" << std::endl;
problems ++;
}
else if(result == cmsysProcess_State_Error)
{
- if ( m_Verbose )
- {
- std::cerr << "\tError executing SCP: "
- << cmsysProcess_GetErrorString(cp) << std::endl;
- }
+ cmCTestLog(m_CTest, ERROR, "\tError executing SCP: "
+ << cmsysProcess_GetErrorString(cp) << std::endl);
*m_LogFile << "\tError executing SCP: "
<< cmsysProcess_GetErrorString(cp) << std::endl;
problems ++;
@@ -574,14 +610,14 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
xmlrpc_env_init(&env);
/* Call the famous server at UserLand. */
- std::cout << " Submitting to: " << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submitting to: " << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl);
std::vector<cmStdString>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++it )
{
xmlrpc_value *result;
std::string local_file = localprefix + "/" + *it;
- std::cout << " Submit file: " << local_file.c_str() << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submit file: " << local_file.c_str() << std::endl);
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
{
@@ -613,7 +649,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
if ( env.fault_occurred )
{
- std::cerr << " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl);
xmlrpc_env_clean(&env);
xmlrpc_client_cleanup();
return false;
@@ -637,7 +673,7 @@ int cmCTestSubmitHandler::ProcessHandler()
const std::string &buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
- std::cerr << "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
return -1;
}
@@ -658,20 +694,20 @@ int cmCTestSubmitHandler::ProcessHandler()
std::string gpath = buildDirectory + "/Testing/" + m_CTest->GetCurrentTag();
std::string::size_type glen = gpath.size() + 1;
gpath = gpath + "/CoverageLog*";
- //std::cout << "Globbing for: " << gpath.c_str() << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Globbing for: " << gpath.c_str() << std::endl);
if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) )
{
size_t cc;
for ( cc = 0; cc < gfiles.size(); cc ++ )
{
gfiles[cc] = gfiles[cc].substr(glen);
- //std::cout << "Glob file: " << gfiles[cc].c_str() << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Glob file: " << gfiles[cc].c_str() << std::endl);
files.push_back(gfiles[cc]);
}
}
else
{
- std::cerr << "Problem globbing" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem globbing" << std::endl);
}
}
m_CTest->AddIfExists(files, "DynamicAnalysis.xml");
@@ -689,14 +725,14 @@ int cmCTestSubmitHandler::ProcessHandler()
cnt ++;
}
}
- std::cout << "Submit files (using " << m_CTest->GetCTestConfiguration("DropMethod") << ")"
- << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Submit files (using " << m_CTest->GetCTestConfiguration("DropMethod") << ")"
+ << std::endl);
this->SetLogFile(&ofs);
if ( m_CTest->GetCTestConfiguration("DropMethod") == "" ||
m_CTest->GetCTestConfiguration("DropMethod") == "ftp" )
{
ofs << "Using drop method: FTP" << std::endl;
- std::cout << " Using FTP submit method" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using FTP submit method" << std::endl);
std::string url = "ftp://";
url += cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropSiteUser")) + ":" +
cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropSitePassword")) + "@" +
@@ -705,24 +741,24 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( !this->SubmitUsingFTP(buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(),
files, prefix, url) )
{
- std::cerr << " Problems when submitting via FTP" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when submitting via FTP" << std::endl);
ofs << " Problems when submitting via FTP" << std::endl;
return -1;
}
if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetCTestConfiguration("TriggerSite")) )
{
- std::cerr << " Problems when triggering via HTTP" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when triggering via HTTP" << std::endl);
ofs << " Problems when triggering via HTTP" << std::endl;
return -1;
}
- std::cout << " Submission successful" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
else if ( m_CTest->GetCTestConfiguration("DropMethod") == "http" )
{
ofs << "Using drop method: HTTP" << std::endl;
- std::cout << " Using HTTP submit method" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP submit method" << std::endl);
std::string url = "http://";
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
@@ -736,33 +772,33 @@ int cmCTestSubmitHandler::ProcessHandler()
url += m_CTest->GetCTestConfiguration("DropSite") + m_CTest->GetCTestConfiguration("DropLocation");
if ( !this->SubmitUsingHTTP(buildDirectory +"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
{
- std::cerr << " Problems when submitting via HTTP" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when submitting via HTTP" << std::endl);
ofs << " Problems when submitting via HTTP" << std::endl;
return -1;
}
if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetCTestConfiguration("TriggerSite")) )
{
- std::cerr << " Problems when triggering via HTTP" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when triggering via HTTP" << std::endl);
ofs << " Problems when triggering via HTTP" << std::endl;
return -1;
}
- std::cout << " Submission successful" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
else if ( m_CTest->GetCTestConfiguration("DropMethod") == "xmlrpc" )
{
ofs << "Using drop method: XML-RPC" << std::endl;
- std::cout << " Using XML-RPC submit method" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using XML-RPC submit method" << std::endl);
std::string url = m_CTest->GetCTestConfiguration("DropSite");
prefix = m_CTest->GetCTestConfiguration("DropLocation");
if ( !this->SubmitUsingXMLRPC(buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
{
- std::cerr << " Problems when submitting via XML-RPC" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when submitting via XML-RPC" << std::endl);
ofs << " Problems when submitting via XML-RPC" << std::endl;
return -1;
}
- std::cout << " Submission successful" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
@@ -778,14 +814,14 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( !this->SubmitUsingSCP(m_CTest->GetCTestConfiguration("ScpCommand"),
buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
{
- std::cerr << " Problems when submitting via SCP" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Problems when submitting via SCP" << std::endl);
ofs << " Problems when submitting via SCP" << std::endl;
return -1;
}
- std::cout << " Submission successful" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
ofs << " Submission successful" << std::endl;
}
- std::cout << " Unknown submission method: \"" << m_CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Unknown submission method: \"" << m_CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl);
return -1;
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 4c6e1da..8b65c32 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -177,7 +177,7 @@ int cmCTestTestHandler::PreProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPreTest) )
{
- std::cerr << "Problem executing pre-test command(s)." << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem executing pre-test command(s)." << std::endl);
return 0;
}
return 1;
@@ -188,7 +188,7 @@ int cmCTestTestHandler::PostProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPostTest) )
{
- std::cerr << "Problem executing post-test command(s)." << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem executing post-test command(s)." << std::endl);
return 0;
}
return 1;
@@ -218,7 +218,7 @@ int cmCTestTestHandler::ProcessHandler()
m_TestResults.clear();
- std::cout << (m_MemCheck ? "Memory check" : "Test") << " project" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, (m_MemCheck ? "Memory check" : "Test") << " project" << std::endl);
if ( ! this->PreProcessHandler() )
{
return -1;
@@ -236,19 +236,19 @@ int cmCTestTestHandler::ProcessHandler()
{
if ( !m_CTest->GetShowOnly() )
{
- std::cerr << "No tests were found!!!\n";
+ cmCTestLog(m_CTest, ERROR, "No tests were found!!!" << std::endl);
}
}
else
{
- if (m_Verbose && passed.size() &&
+ if (m_HandlerVerbose && passed.size() &&
(m_UseIncludeRegExp || m_UseExcludeRegExp))
{
- std::cerr << "\nThe following tests passed:\n";
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl << "The following tests passed:" << std::endl);
for(std::vector<cmStdString>::iterator j = passed.begin();
j != passed.end(); ++j)
{
- std::cerr << "\t" << *j << "\n";
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j << std::endl);
}
}
@@ -257,14 +257,16 @@ int cmCTestTestHandler::ProcessHandler()
{
percent = 99;
}
- fprintf(stderr,"\n%.0f%% tests passed, %i tests failed out of %i\n",
- percent, int(failed.size()), total);
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl << std::setprecision(0) << percent << "% tests passed, "
+ << failed.size() << " tests failed out of " << total << std::endl);
+ //fprintf(stderr,"\n%.0f%% tests passed, %i tests failed out of %i\n",
+ // percent, int(failed.size()), total);
if (failed.size())
{
cmGeneratedFileStream ofs;
- std::cerr << "\nThe following tests FAILED:\n";
+ cmCTestLog(m_CTest, ERROR, std::endl << "The following tests FAILED:" << std::endl);
m_CTest->OpenOutputFile("Temporary", "LastTestsFailed.log", ofs);
std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator ftit;
@@ -274,8 +276,9 @@ int cmCTestTestHandler::ProcessHandler()
if ( ftit->m_Status != cmCTestTestHandler::COMPLETED )
{
ofs << ftit->m_TestCount << ":" << ftit->m_Name << std::endl;
- fprintf(stderr, "\t%3d - %s (%s)\n", ftit->m_TestCount, ftit->m_Name.c_str(),
- this->GetTestStatus(ftit->m_Status));
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->m_TestCount << " - " << ftit->m_Name.c_str() << " (" << this->GetTestStatus(ftit->m_Status) << ")" << std::endl);
+ //fprintf(stderr, "\t%3d - %s (%s)\n", ftit->m_TestCount, ftit->m_Name.c_str(),
+ // this->GetTestStatus(ftit->m_Status));
}
}
@@ -288,8 +291,8 @@ int cmCTestTestHandler::ProcessHandler()
if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(),
(m_MemCheck ? "DynamicAnalysis.xml" : "Test.xml"), xmlfile, true) )
{
- std::cerr << "Cannot create " << (m_MemCheck ? "memory check" : "testing")
- << " XML file" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot create " << (m_MemCheck ? "memory check" : "testing")
+ << " XML file" << std::endl);
return 1;
}
this->GenerateDartOutput(xmlfile);
@@ -374,11 +377,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
if (!(last_directory == it->m_Directory))
{
- if ( m_Verbose )
- {
- std::cerr << "Changing directory into "
- << it->m_Directory.c_str() << "\n";
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Changing directory into "
+ << it->m_Directory.c_str() << "\n");
last_directory = it->m_Directory;
cmSystemTools::ChangeDirectory(it->m_Directory.c_str());
}
@@ -405,25 +405,22 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
continue;
}
}
-
- std::cerr.width(3);
- std::cerr << cnt << "/";
- std::cerr.width(3);
- std::cerr << tmsize << " Testing ";
+
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::setw(3) << cnt << "/");
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::setw(3) << tmsize << " Testing ");
std::string outname = testname;
outname.resize(30, ' ');
if ( m_CTest->GetShowOnly() )
{
- std::cerr << outname.c_str() << "\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, outname.c_str() << std::endl);
}
else
{
- std::cerr << outname.c_str();
- std::cerr.flush();
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, outname.c_str());
}
- //std::cerr << "Testing " << args[0] << " ... ";
+ cmCTestLog(m_CTest, DEBUG, "Testing " << args[0].Value.c_str() << " ... ");
// find the test executable
std::string actualCommand = this->FindTheExecutable(args[1].Value.c_str());
std::string testCommand = cmSystemTools::ConvertToOutputPath(actualCommand.c_str());
@@ -431,8 +428,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
// continue if we did not find the executable
if (testCommand == "")
{
- std::cerr << "Unable to find executable: " <<
- args[1].Value.c_str() << "\n";
+ cmCTestLog(m_CTest, ERROR, "Unable to find executable: "
+ << args[1].Value.c_str() << std::endl);
if ( !m_CTest->GetShowOnly() )
{
cres.m_FullCommandLine = actualCommand;
@@ -464,10 +461,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
int retVal = 0;
- if ( m_Verbose )
- {
- std::cout << std::endl << (m_MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl << (m_MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl);
if ( olog )
{
*olog << cnt << "/" << tmsize
@@ -524,7 +518,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
{
if (res == cmsysProcess_State_Exited && retVal == 0)
{
- std::cerr << " Passed\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Passed" << std::endl);
passed.push_back(testname);
cres.m_Status = cmCTestTestHandler::COMPLETED;
}
@@ -533,44 +527,44 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
cres.m_Status = cmCTestTestHandler::FAILED;
if ( res == cmsysProcess_State_Expired )
{
- std::cerr << "***Timeout\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Timeout" << std::endl);
cres.m_Status = cmCTestTestHandler::TIMEOUT;
}
else if ( res == cmsysProcess_State_Exception )
{
- std::cerr << "***Exception: ";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Exception: ");
switch ( retVal )
{
case cmsysProcess_Exception_Fault:
- std::cerr << "SegFault";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "SegFault");
cres.m_Status = cmCTestTestHandler::SEGFAULT;
break;
case cmsysProcess_Exception_Illegal:
- std::cerr << "Illegal";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Illegal");
cres.m_Status = cmCTestTestHandler::ILLEGAL;
break;
case cmsysProcess_Exception_Interrupt:
- std::cerr << "Interrupt";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Interrupt");
cres.m_Status = cmCTestTestHandler::INTERRUPT;
break;
case cmsysProcess_Exception_Numerical:
- std::cerr << "Numerical";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Numerical");
cres.m_Status = cmCTestTestHandler::NUMERICAL;
break;
default:
- std::cerr << "Other";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Other");
cres.m_Status = cmCTestTestHandler::OTHER_FAULT;
}
- std::cerr << "\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
}
else if ( res == cmsysProcess_State_Error )
{
- std::cerr << "***Bad command " << res << "\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Bad command " << res << std::endl);
cres.m_Status = cmCTestTestHandler::BAD_COMMAND;
}
else
{
- std::cerr << "***Failed\n";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Failed" << std::endl);
}
failed.push_back(testname);
}
@@ -707,14 +701,11 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
for ( it = vec.begin(); it != vec.end(); ++it )
{
int retVal = 0;
- if ( m_Verbose )
- {
- std::cout << "Run command: " << *it << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it << std::endl);
if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, true /*m_Verbose*/) ||
retVal != 0 )
{
- std::cerr << "Problem running command: " << *it << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Problem running command: " << *it << std::endl);
return 0;
}
}
@@ -874,10 +865,7 @@ void cmCTestTestHandler::GetListOfTests(tm_ListOfTests* testlist)
}
if ( found )
{
- if ( m_Verbose )
- {
- std::cout << "Ignore memcheck: " << *it << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: " << *it << std::endl);
continue;
}
}
@@ -896,10 +884,7 @@ void cmCTestTestHandler::GetListOfTests(tm_ListOfTests* testlist)
}
if ( found )
{
- if ( m_Verbose )
- {
- std::cout << "Ignore test: " << *it << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " << *it << std::endl);
continue;
}
}
@@ -1181,7 +1166,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
<< " text=\"text/string\""
<< "><Value>File " << filename.c_str() << " not found</Value></NamedMeasurement>"
<< std::endl;
- std::cout << "File \"" << filename.c_str() << "\" not found." << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "File \"" << filename.c_str() << "\" not found." << std::endl);
}
cxml.erase(measurementfile.start(), measurementfile.end() - measurementfile.start());
}
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index bbbca97..41261d6 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -51,7 +51,7 @@ public:
std::string m_Message;
};
cmCTestUpdateHandlerSVNXMLParser(cmCTestUpdateHandler* up)
- : cmXMLParser(), m_UpdateHandler(up), m_MinRevision(-1), m_MaxRevision(-1), m_Verbose(false)
+ : cmXMLParser(), m_UpdateHandler(up), m_MinRevision(-1), m_MaxRevision(-1)
{
}
@@ -73,8 +73,6 @@ public:
int GetMinRevision() { return m_MinRevision; }
int GetMaxRevision() { return m_MaxRevision; }
- void SetVerbose(bool v) { m_Verbose = v; }
-
protected:
void StartElement(const char* name, const char** atts)
{
@@ -101,13 +99,10 @@ protected:
{
if ( strcmp(name, "logentry") == 0 )
{
- if ( m_Verbose )
- {
- std::cout << "\tRevision: " << m_CommitLog.m_Revision<< std::endl;
- std::cout << "\tAuthor: " << m_CommitLog.m_Author.c_str() << std::endl;
- std::cout << "\tDate: " << m_CommitLog.m_Date.c_str() << std::endl;
- std::cout << "\tMessage: " << m_CommitLog.m_Message.c_str() << std::endl;
- }
+ cmCTestLog(m_UpdateHandler->GetCTestInstance(), HANDLER_VERBOSE_OUTPUT, "\tRevision: " << m_CommitLog.m_Revision<< std::endl
+ << "\tAuthor: " << m_CommitLog.m_Author.c_str() << std::endl
+ << "\tDate: " << m_CommitLog.m_Date.c_str() << std::endl
+ << "\tMessage: " << m_CommitLog.m_Message.c_str() << std::endl);
m_Commits.push_back(m_CommitLog);
}
else if ( strcmp(name, "author") == 0 )
@@ -154,7 +149,6 @@ private:
t_VectorOfCommits m_Commits;
int m_MinRevision;
int m_MaxRevision;
- bool m_Verbose;
};
//**********************************************************************
//----------------------------------------------------------------------
@@ -162,7 +156,6 @@ private:
//----------------------------------------------------------------------
cmCTestUpdateHandler::cmCTestUpdateHandler()
{
- m_Verbose = false;
m_CTest = 0;
}
@@ -211,11 +204,11 @@ int cmCTestUpdateHandler::ProcessHandler()
const char* sourceDirectory = this->GetOption("SourceDirectory");
if ( !sourceDirectory )
{
- std::cerr << "Cannot find SourceDirectory key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find SourceDirectory key in the DartConfiguration.tcl" << std::endl);
return -1;
}
- std::cout << "Updating the repository: " << sourceDirectory << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "Updating the repository: " << sourceDirectory << std::endl);
// Get update command
std::string updateCommand = m_CTest->GetCTestConfiguration("UpdateCommand");
@@ -227,7 +220,7 @@ int cmCTestUpdateHandler::ProcessHandler()
updateCommand = m_CTest->GetCTestConfiguration("SVNCommand");
if ( updateCommand.empty() )
{
- std::cerr << "Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the DartConfiguration.tcl" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the DartConfiguration.tcl" << std::endl);
return -1;
}
else
@@ -264,8 +257,8 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string extra_update_opts;
if ( m_CTest->GetTestModel() == cmCTest::NIGHTLY )
{
- struct tm* t = cmCTest::GetNightlyTime(m_CTest->GetCTestConfiguration("NightlyStartTime"),
- m_Verbose, m_CTest->GetTomorrowTag());
+ struct tm* t = m_CTest->GetNightlyTime(m_CTest->GetCTestConfiguration("NightlyStartTime"),
+ m_CTest->GetTomorrowTag());
char current_time[1024];
sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d",
t->tm_year + 1900,
@@ -324,15 +317,12 @@ int cmCTestUpdateHandler::ProcessHandler()
//
if ( !command.empty() )
{
- if ( m_Verbose )
- {
- std::cout << "* Get repository information: " << command.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* Get repository information: " << command.c_str() << std::endl);
if ( !m_CTest->GetShowOnly() )
{
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
&retVal, sourceDirectory,
- m_Verbose, 0 /*m_TimeOut*/);
+ m_HandlerVerbose, 0 /*m_TimeOut*/);
if ( ofs )
{
ofs << "--- Update information ---" << std::endl;
@@ -350,7 +340,7 @@ int cmCTestUpdateHandler::ProcessHandler()
{
std::string currentRevisionString = current_revision_regex.match(1);
svn_current_revision = atoi(currentRevisionString.c_str());
- std::cout << " Old revision of repository is: " << svn_current_revision << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Old revision of repository is: " << svn_current_revision << std::endl);
}
}
break;
@@ -358,7 +348,7 @@ int cmCTestUpdateHandler::ProcessHandler()
}
else
{
- std::cout << "Update with command: " << command << std::endl;
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Update with command: " << command << std::endl);
}
}
@@ -369,15 +359,12 @@ int cmCTestUpdateHandler::ProcessHandler()
cmGeneratedFileStream os;
if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os, true) )
{
- std::cerr << "Cannot open log file" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Cannot open log file" << std::endl);
}
std::string start_time = m_CTest->CurrentTime();
double elapsed_time_start = cmSystemTools::GetTime();
- if ( m_Verbose )
- {
- std::cout << "* Update repository: " << command.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: " << command.c_str() << std::endl);
if ( !m_CTest->GetShowOnly() )
{
command = "";
@@ -388,7 +375,7 @@ int cmCTestUpdateHandler::ProcessHandler()
" " + extra_update_opts;
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
&retVal, sourceDirectory,
- m_Verbose, 0 /*m_TimeOut*/);
+ m_HandlerVerbose, 0 /*m_TimeOut*/);
break;
case cmCTestUpdateHandler::e_SVN:
{
@@ -397,11 +384,11 @@ int cmCTestUpdateHandler::ProcessHandler()
" " + extra_update_opts;
bool res1 = cmSystemTools::RunSingleCommand(command.c_str(), &partialOutput,
&retVal, sourceDirectory,
- m_Verbose, 0 /*m_TimeOut*/);
+ m_HandlerVerbose, 0 /*m_TimeOut*/);
command = updateCommand + " status";
res = cmSystemTools::RunSingleCommand(command.c_str(), &partialOutput,
&retVal, sourceDirectory,
- m_Verbose, 0 /*m_TimeOut*/);
+ m_HandlerVerbose, 0 /*m_TimeOut*/);
goutput += partialOutput;
res = res && res1;
}
@@ -465,26 +452,21 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( updateType == cmCTestUpdateHandler::e_SVN )
{
- std::cout << " Current revision of repository is: " << svn_latest_revision << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Current revision of repository is: " << svn_latest_revision << std::endl);
}
- std::cout << " Gathering version information (each . represents one updated file):" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Gathering version information (each . represents one updated file):" << std::endl);
int file_count = 0;
for ( cc= 0 ; cc < lines.size(); cc ++ )
{
const char* line = lines[cc].c_str();
if ( file_update_line.find(line) )
{
- if ( !m_Verbose )
+ if ( file_count == 0 )
{
- if ( file_count == 0 )
- {
- std::cout << " ";
- std::cout.flush();
- }
- std::cout << ".";
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << std::flush);
}
- std::cout.flush();
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, "." << std::flush);
std::string upChar = file_update_line.match(1);
std::string upFile = file_update_line.match(2);
char mod = upChar[0];
@@ -495,7 +477,7 @@ int cmCTestUpdateHandler::ProcessHandler()
modifiedOrConflict = true;
}
const char* file = upFile.c_str();
- //std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "Line" << cc << ": " << mod << " - " << file << std::endl);
std::string output;
if ( modifiedOrConflict )
@@ -521,14 +503,11 @@ int cmCTestUpdateHandler::ProcessHandler()
}
break;
}
- //std::cout << "Do log: " << logcommand << std::endl;
- if ( m_Verbose )
- {
- std::cout << "* Get file update information: " << logcommand.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, DEBUG, "Do log: " << logcommand << std::endl);
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* Get file update information: " << logcommand.c_str() << std::endl);
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
&retVal, sourceDirectory,
- m_Verbose, 0 /*m_TimeOut*/);
+ m_HandlerVerbose, 0 /*m_TimeOut*/);
if ( ofs )
{
ofs << output << std::endl;
@@ -536,7 +515,7 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( res && retVal == 0)
{
- //std::cout << output << std::endl;
+ cmCTestLog(m_CTest, DEBUG, output << std::endl);
std::string::size_type sline = 0;
std::string srevision1 = "Unknown";
std::string sdate1 = "Unknown";
@@ -618,11 +597,11 @@ int cmCTestUpdateHandler::ProcessHandler()
srevision1 = str.str();
if (!svn_status_line_regex.find(output))
{
- std::cerr << "Bad output from SVN status command: " << output << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Bad output from SVN status command: " << output << std::endl);
}
else if ( svn_status_line_regex.match(4) != file )
{
- std::cerr << "Bad output from SVN status command. The file name returned: \"" << svn_status_line_regex.match(4) << "\" was different than the file specified: \"" << file << "\"" << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Bad output from SVN status command. The file name returned: \"" << svn_status_line_regex.match(4) << "\" was different than the file specified: \"" << file << "\"" << std::endl);
}
else
{
@@ -638,7 +617,6 @@ int cmCTestUpdateHandler::ProcessHandler()
else
{
cmCTestUpdateHandlerSVNXMLParser parser(this);
- parser.SetVerbose(m_Verbose);
if ( parser.Parse(output.c_str()) )
{
int minrev = parser.GetMinRevision();
@@ -719,12 +697,9 @@ int cmCTestUpdateHandler::ProcessHandler()
{
srevision2 = srevision1;
}
- if ( m_Verbose )
- {
- std::cout << "File: " << path.c_str() << " / " << fname.c_str() << " was updated by "
- << sauthor1.c_str() << " to revision: " << srevision1.c_str()
- << " from revision: " << srevision2.c_str() << std::endl;
- }
+ cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: " << path.c_str() << " / " << fname.c_str() << " was updated by "
+ << sauthor1.c_str() << " to revision: " << srevision1.c_str()
+ << " from revision: " << srevision2.c_str() << std::endl);
os << "\t\t<File Directory=\"" << cmCTest::MakeXMLSafe(path) << "\">" << cmCTest::MakeXMLSafe(fname)
<< "</File>\n"
<< "\t\t<Directory>" << cmCTest::MakeXMLSafe(path) << "</Directory>\n"
@@ -785,25 +760,25 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( file_count )
{
- std::cout << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
}
if ( num_updated )
{
- std::cout << " Found " << num_updated << " updated files" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_updated << " updated files" << std::endl);
}
if ( num_modified )
{
- std::cout << " Found " << num_modified << " locally modified files"
- << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_modified << " locally modified files"
+ << std::endl);
}
if ( num_conflicting )
{
- std::cout << " Found " << num_conflicting << " conflicting files"
- << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_conflicting << " conflicting files"
+ << std::endl);
}
if ( num_modified == 0 && num_conflicting == 0 && num_updated == 0 )
{
- std::cout << " Project is up-to-date" << std::endl;
+ cmCTestLog(m_CTest, HANDLER_OUTPUT, " Project is up-to-date" << std::endl);
}
if ( !first_file )
{
@@ -826,7 +801,7 @@ int cmCTestUpdateHandler::ProcessHandler()
os << "\t</Author>" << std::endl;
}
- //std::cout << "End" << std::endl;
+ cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
std::string end_time = m_CTest->CurrentTime();
os << "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "<ElapsedMinutes>" <<
@@ -836,13 +811,13 @@ int cmCTestUpdateHandler::ProcessHandler()
if ( num_modified > 0 || num_conflicting > 0 )
{
os << "Update error: There are modified or conflicting files in the repository";
- std::cerr << " There are modified or conflicting files in the repository" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " There are modified or conflicting files in the repository" << std::endl);
}
if ( updateProducedError )
{
os << "Update error: ";
os << m_CTest->MakeXMLSafe(goutput);
- std::cerr << " Update with command: " << command << " failed" << std::endl;
+ cmCTestLog(m_CTest, ERROR, " Update with command: " << command << " failed" << std::endl);
}
os << "</UpdateReturnStatus>" << std::endl;
os << "</Update>" << std::endl;
@@ -854,8 +829,8 @@ int cmCTestUpdateHandler::ProcessHandler()
if (! res || retVal )
{
- std::cerr << "Error(s) when updating the project" << std::endl;
- std::cerr << "Output: " << goutput << std::endl;
+ cmCTestLog(m_CTest, ERROR, "Error(s) when updating the project" << std::endl);
+ cmCTestLog(m_CTest, ERROR, "Output: " << goutput << std::endl);
return -1;
}
return count;