STYLE: Fix some style issues

This commit is contained in:
Andy Cedilnik 2006-03-09 11:17:10 -05:00
parent 10d1b20790
commit 6503a0eecc
32 changed files with 1500 additions and 937 deletions

View File

@ -55,9 +55,9 @@ int cmCTestBuildAndTestHandler::ProcessHandler()
}
//----------------------------------------------------------------------
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, cmOStringStream &out,
std::string &cmakeOutString, std::string &cwd,
cmake *cm)
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
cmOStringStream &out, std::string &cmakeOutString, std::string &cwd,
cmake *cm)
{
unsigned int k;
std::vector<std::string> args;
@ -71,7 +71,8 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, cmOStringStream
}
if ( m_CTest->GetConfigType().size() > 0 )
{
std::string btype = "-DCMAKE_BUILD_TYPE:STRING=" + m_CTest->GetConfigType();
std::string btype
= "-DCMAKE_BUILD_TYPE:STRING=" + m_CTest->GetConfigType();
args.push_back(btype);
}
@ -396,7 +397,8 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "--build-and-test must have source and binary dir" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"--build-and-test must have source and binary dir" << std::endl);
return 0;
}
}
@ -433,7 +435,8 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
idx++;
m_BuildProject = allArgs[idx];
}
if(currentArg.find("--build-makeprogram",0) == 0 && idx < allArgs.size() - 1)
if(currentArg.find("--build-makeprogram",0) == 0 &&
idx < allArgs.size() - 1)
{
idx++;
m_BuildMakeProgram = allArgs[idx];
@ -450,7 +453,8 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
{
m_BuildOptions.push_back(allArgs[idx]);
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" || allArgs[idx+1] == "--test-command"))
&& (allArgs[idx+1] == "--build-target" ||
allArgs[idx+1] == "--test-command"))
{
done = true;
}

View File

@ -63,7 +63,8 @@ bool cmCTestBuildCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
this->SetError("called with incorrect number of arguments. "
"RETURN_VALUE specified twice.");
return false;
}
havereturn_variable = true;
@ -72,7 +73,8 @@ bool cmCTestBuildCommand::InitialPass(
{
if ( build_dir )
{
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
this->SetError("called with incorrect number of arguments. "
"BUILD specified twice.");
return false;
}
havesource = true;
@ -80,7 +82,8 @@ bool cmCTestBuildCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
@ -98,17 +101,22 @@ bool cmCTestBuildCommand::InitialPass(
return false;
}
const char* ctestBuildCommand = m_Makefile->GetDefinition("CTEST_BUILD_COMMAND");
const char* ctestBuildCommand
= m_Makefile->GetDefinition("CTEST_BUILD_COMMAND");
if ( ctestBuildCommand && *ctestBuildCommand )
{
m_CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand);
}
else
{
const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName = m_Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration = m_Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags = m_Makefile->GetDefinition("CTEST_BUILD_FLAGS");
const char* cmakeGeneratorName
= m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName
= m_Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration
= m_Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags
= m_Makefile->GetDefinition("CTEST_BUILD_FLAGS");
if ( cmakeGeneratorName && *cmakeGeneratorName &&
cmakeProjectName && *cmakeProjectName )
{
@ -127,19 +135,25 @@ bool cmCTestBuildCommand::InitialPass(
if ( !m_GlobalGenerator )
{
m_GlobalGenerator =
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(cmakeGeneratorName);
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGeneratorName);
}
m_GlobalGenerator->FindMakeProgram(m_Makefile);
const char* cmakeMakeProgram = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
const char* cmakeMakeProgram
= m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram, cmakeProjectName,
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram,
cmakeProjectName,
cmakeBuildAdditionalFlags, 0, cmakeBuildConfiguration, true);
m_CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str());
}
else
{
cmOStringStream ostr;
ostr << "CTEST_BUILD_COMMAND or CTEST_CMAKE_GENERATOR not specified. Please specify the CTEST_CMAKE_GENERATOR and CTEST_PROJECT_NAME if this is a CMake project, or specify the CTEST_BUILD_COMMAND for cmake or any other project.";
ostr << "CTEST_BUILD_COMMAND or CTEST_CMAKE_GENERATOR not specified. "
"Please specify the CTEST_CMAKE_GENERATOR and CTEST_PROJECT_NAME if "
"this is a CMake project, or specify the CTEST_BUILD_COMMAND for "
"cmake or any other project.";
this->SetError(ostr.str().c_str());
return false;
}

View File

@ -125,9 +125,9 @@ static const char* cmCTestWarningMatches[] = {
};
static const char* cmCTestWarningExceptions[] = {
"/usr/openwin/include/X11/Xlib\\.h:[0-9]+: warning: ANSI C\\+\\+ forbids declaration",
"/usr/openwin/include/X11/Xutil\\.h:[0-9]+: warning: ANSI C\\+\\+ forbids declaration",
"/usr/openwin/include/X11/XResource\\.h:[0-9]+: warning: ANSI C\\+\\+ forbids declaration",
"/usr/.*/X11/Xlib\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration",
"/usr/.*/X11/Xutil\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration",
"/usr/.*/X11/XResource\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration",
"WARNING 84 :",
"WARNING 47 :",
"makefile:",
@ -244,7 +244,9 @@ int cmCTestBuildHandler::ProcessHandler()
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl);
int entry;
for ( entry = 0; cmCTestWarningErrorFileLine[entry].m_RegularExpressionString; ++ entry )
for ( entry = 0;
cmCTestWarningErrorFileLine[entry].m_RegularExpressionString;
++ entry )
{
cmCTestBuildHandler::cmCTestCompileErrorWarningRex r;
if ( r.m_RegularExpression.compile(
@ -256,22 +258,30 @@ int cmCTestBuildHandler::ProcessHandler()
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[entry].m_RegularExpressionString << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[entry].m_RegularExpressionString
<< std::endl);
}
}
// Determine build command and build directory
const std::string &makeCommand = m_CTest->GetCTestConfiguration("MakeCommand");
const std::string &makeCommand
= m_CTest->GetCTestConfiguration("MakeCommand");
if ( makeCommand.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find MakeCommand key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find MakeCommand key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
const std::string &buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
const std::string &buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
@ -280,7 +290,8 @@ int cmCTestBuildHandler::ProcessHandler()
double elapsed_time_start = cmSystemTools::GetTime();
if ( !this->StartLogFile("Build", ofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build log file" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build log file"
<< std::endl);
}
// Create lists of regular expression strings for errors, error exceptions,
@ -312,10 +323,14 @@ int cmCTestBuildHandler::ProcessHandler()
{ \
regexes.push_back(it->c_str()); \
}
cmCTestBuildHandlerPopulateRegexVector(m_CustomErrorMatches, m_ErrorMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(m_CustomErrorExceptions, m_ErrorExceptionRegex);
cmCTestBuildHandlerPopulateRegexVector(m_CustomWarningMatches, m_WarningMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(m_CustomWarningExceptions, m_WarningExceptionRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomErrorMatches, m_ErrorMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomErrorExceptions, m_ErrorExceptionRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomWarningMatches, m_WarningMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomWarningExceptions, m_WarningExceptionRegex);
// Determine source and binary tree substitutions to simplify the output.
@ -323,7 +338,8 @@ int cmCTestBuildHandler::ProcessHandler()
m_SimplifyBuildDir = "";
if ( m_CTest->GetCTestConfiguration("SourceDirectory").size() > 20 )
{
std::string srcdir = m_CTest->GetCTestConfiguration("SourceDirectory") + "/";
std::string srcdir
= m_CTest->GetCTestConfiguration("SourceDirectory") + "/";
std::string srcdirrep;
for ( cc = srcdir.size()-2; cc > 0; cc -- )
{
@ -339,7 +355,8 @@ int cmCTestBuildHandler::ProcessHandler()
}
if ( m_CTest->GetCTestConfiguration("BuildDirectory").size() > 20 )
{
std::string bindir = m_CTest->GetCTestConfiguration("BuildDirectory") + "/";
std::string bindir
= m_CTest->GetCTestConfiguration("BuildDirectory") + "/";
std::string bindirrep;
for ( cc = bindir.size()-2; cc > 0; cc -- )
{
@ -363,11 +380,13 @@ int cmCTestBuildHandler::ProcessHandler()
int res = cmsysProcess_State_Exited;
if ( !m_CTest->GetShowOnly() )
{
res = this->RunMakeCommand(makeCommand.c_str(), &retVal, buildDirectory.c_str(), 0, ofs);
res = this->RunMakeCommand(makeCommand.c_str(), &retVal,
buildDirectory.c_str(), 0, ofs);
}
else
{
cmCTestLog(m_CTest, DEBUG, "Build with command: " << makeCommand << std::endl);
cmCTestLog(m_CTest, DEBUG, "Build with command: " << makeCommand
<< std::endl);
}
// Remember end build time and calculate elapsed time
@ -375,28 +394,39 @@ int cmCTestBuildHandler::ProcessHandler()
double elapsed_build_time = cmSystemTools::GetTime() - elapsed_time_start;
if (res != cmsysProcess_State_Exited || retVal )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when building project" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when building project"
<< std::endl);
}
// Cleanups strings in the errors and warnings list.
t_ErrorsAndWarningsVector::iterator evit;
if ( !m_SimplifySourceDir.empty() )
{
for ( evit = m_ErrorsAndWarnings.begin(); evit != m_ErrorsAndWarnings.end(); ++ evit )
for ( evit = m_ErrorsAndWarnings.begin();
evit != m_ErrorsAndWarnings.end();
++ evit )
{
cmSystemTools::ReplaceString(evit->m_Text, m_SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(evit->m_PreContext, m_SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(evit->m_PostContext, m_SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_Text, m_SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PreContext, m_SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PostContext, m_SimplifySourceDir.c_str(), "/.../");
}
}
if ( !m_SimplifyBuildDir.empty() )
{
for ( evit = m_ErrorsAndWarnings.begin(); evit != m_ErrorsAndWarnings.end(); ++ evit )
for ( evit = m_ErrorsAndWarnings.begin();
evit != m_ErrorsAndWarnings.end();
++ evit )
{
cmSystemTools::ReplaceString(evit->m_Text, m_SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(evit->m_PreContext, m_SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(evit->m_PostContext, m_SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_Text, m_SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PreContext, m_SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PostContext, m_SimplifyBuildDir.c_str(), "/.../");
}
}
@ -412,10 +442,12 @@ int cmCTestBuildHandler::ProcessHandler()
cmGeneratedFileStream xofs;
if( !this->StartResultingXML("Build", xofs))
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build XML file" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build XML file"
<< std::endl);
return -1;
}
this->GenerateDartBuildOutput(xofs, m_ErrorsAndWarnings, elapsed_build_time);
this->GenerateDartBuildOutput(
xofs, m_ErrorsAndWarnings, elapsed_build_time);
return 0;
}
@ -478,14 +510,17 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
std::string::size_type p = cm->m_SourceFile.find("/");
if(p != cm->m_SourceFile.npos)
{
cm->m_SourceFile = cm->m_SourceFile.substr(p+1, cm->m_SourceFile.size()-p);
cm->m_SourceFile = cm->m_SourceFile.substr(
p+1, cm->m_SourceFile.size()-p);
}
}
else
{
// make sure it is a full path with the correct case
cm->m_SourceFile = cmSystemTools::CollapseFullPath(cm->m_SourceFile.c_str());
cmSystemTools::ReplaceString(cm->m_SourceFile, srcdir.c_str(), "");
cm->m_SourceFile = cmSystemTools::CollapseFullPath(
cm->m_SourceFile.c_str());
cmSystemTools::ReplaceString(
cm->m_SourceFile, srcdir.c_str(), "");
}
cm->m_LineNumber = atoi(re->match(rit->m_LineIndex).c_str());
break;
@ -513,7 +548,8 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
if (cm->m_Error && !numErrorsAllowed ||
!cm->m_Error && !numWarningsAllowed)
{
os << "\nThe maximum number of reported warnings or errors has been reached!!!\n";
os << "\nThe maximum number of reported warnings or errors has been "
"reached!!!\n";
}
os << "</PostContext>\n"
<< "\t\t<RepeatCount>0</RepeatCount>\n"
@ -577,7 +613,8 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
char* data;
int length;
cmCTestLog(m_CTest, HANDLER_OUTPUT,
" Each symbol represents " << tick_len << " bytes of output." << std::endl
" Each symbol represents " << tick_len << " bytes of output."
<< std::endl
<< " '!' represents an error and '*' a warning." << std::endl
<< " " << std::flush);
@ -609,16 +646,19 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
// Process the chunk of data
if ( res == cmsysProcess_Pipe_STDERR )
{
this->ProcessBuffer(data, length, tick, tick_len, ofs, &m_BuildProcessingErrorQueue);
this->ProcessBuffer(data, length, tick, tick_len, ofs,
&m_BuildProcessingErrorQueue);
}
else
{
this->ProcessBuffer(data, length, tick, tick_len, ofs, &m_BuildProcessingQueue);
this->ProcessBuffer(data, length, tick, tick_len, ofs,
&m_BuildProcessingQueue);
}
}
this->ProcessBuffer(0, 0, tick, tick_len, ofs, &m_BuildProcessingQueue);
this->ProcessBuffer(0, 0, tick, tick_len, ofs, &m_BuildProcessingErrorQueue);
this->ProcessBuffer(0, 0, tick, tick_len, ofs,
&m_BuildProcessingErrorQueue);
cmCTestLog(m_CTest, OUTPUT, " Size of output: "
<< int(m_BuildOutputLogSize / 1024.0) << "K" << std::endl);
@ -629,12 +669,14 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
if(result == cmsysProcess_State_Exited)
{
*retVal = cmsysProcess_GetExitValue(cp);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Command exited with the value: " << *retVal << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"Command exited with the value: " << *retVal << std::endl);
}
else if(result == cmsysProcess_State_Exception)
{
*retVal = cmsysProcess_GetExitException(cp);
cmCTestLog(m_CTest, WARNING, "There was an exception: " << *retVal << std::endl);
cmCTestLog(m_CTest, WARNING, "There was an exception: " << *retVal
<< std::endl);
}
else if(result == cmsysProcess_State_Expired)
{
@ -652,7 +694,8 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
errorwarning.m_Error = true;
m_ErrorsAndWarnings.push_back(errorwarning);
m_TotalErrors ++;
cmCTestLog(m_CTest, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "There was an error: "
<< cmsysProcess_GetErrorString(cp) << std::endl);
}
cmsysProcess_Delete(cp);
@ -666,8 +709,9 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
//######################################################################
//----------------------------------------------------------------------
void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, size_t& tick, size_t tick_len,
std::ofstream& ofs, t_BuildProcessingQueueType* queue)
void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
size_t& tick, size_t tick_len, std::ofstream& ofs,
t_BuildProcessingQueueType* queue)
{
#undef cerr
const std::string::size_type tick_line_len = 50;
@ -693,7 +737,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, size_t& ti
}
}
// Once certain number of errors or warnings reached, ignore future errors or warnings.
// Once certain number of errors or warnings reached, ignore future errors
// or warnings.
if ( m_TotalWarnings >= m_MaxWarnings )
{
m_WarningQuotaReached = true;
@ -750,7 +795,9 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, size_t& ti
// Copy pre-context to report
std::deque<cmStdString>::iterator pcit;
for ( pcit = m_PreContext.begin(); pcit != m_PreContext.end(); ++pcit )
for ( pcit = m_PreContext.begin();
pcit != m_PreContext.end();
++pcit )
{
errorwarning.m_PreContext += *pcit + "\n";
}
@ -765,7 +812,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, size_t& ti
{
// This is not an error or warning.
// So, figure out if this is a post-context line
if ( m_LastErrorOrWarning != m_ErrorsAndWarnings.end() && m_PostContextCount < m_MaxPostContext )
if ( m_LastErrorOrWarning != m_ErrorsAndWarnings.end() &&
m_PostContextCount < m_MaxPostContext )
{
m_PostContextCount ++;
m_LastErrorOrWarning->m_PostContext += line;
@ -780,7 +828,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, size_t& ti
m_PreContext.push_back(line);
if ( m_PreContext.size() > m_MaxPreContext )
{
m_PreContext.erase(m_PreContext.begin(), m_PreContext.end()-m_MaxPreContext);
m_PreContext.erase(m_PreContext.begin(),
m_PreContext.end()-m_MaxPreContext);
}
}
}
@ -833,7 +882,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data)
if ( !m_ErrorQuotaReached )
{
// Errors
for ( it = m_ErrorMatchRegex.begin(); it != m_ErrorMatchRegex.end(); ++ it )
for ( it = m_ErrorMatchRegex.begin();
it != m_ErrorMatchRegex.end();
++ it )
{
if ( it->find(data) )
{
@ -843,12 +894,15 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data)
}
}
// Error exceptions
for ( it = m_ErrorExceptionRegex.begin(); it != m_ErrorExceptionRegex.end(); ++ it )
for ( it = m_ErrorExceptionRegex.begin();
it != m_ErrorExceptionRegex.end();
++ it )
{
if ( it->find(data) )
{
errorLine = 0;
cmCTestLog(m_CTest, DEBUG, " Not an error Line: " << data << std::endl);
cmCTestLog(m_CTest, DEBUG, " Not an error Line: " << data
<< std::endl);
break;
}
}
@ -856,7 +910,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data)
if ( !m_WarningQuotaReached )
{
// Warnings
for ( it = m_WarningMatchRegex.begin(); it != m_WarningMatchRegex.end(); ++ it )
for ( it = m_WarningMatchRegex.begin();
it != m_WarningMatchRegex.end();
++ it )
{
if ( it->find(data) )
{
@ -867,12 +923,15 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data)
}
// Warning exceptions
for ( it = m_WarningExceptionRegex.begin(); it != m_WarningExceptionRegex.end(); ++ it )
for ( it = m_WarningExceptionRegex.begin();
it != m_WarningExceptionRegex.end();
++ it )
{
if ( it->find(data) )
{
warningLine = 0;
cmCTestLog(m_CTest, DEBUG, " Not a warning Line: " << data << std::endl);
cmCTestLog(m_CTest, DEBUG, " Not a warning Line: " << data
<< std::endl);
break;
}
}

View File

@ -105,8 +105,8 @@ private:
typedef std::deque<char> t_BuildProcessingQueueType;
void ProcessBuffer(const char* data, int length, size_t& tick, size_t tick_len,
std::ofstream& ofs, t_BuildProcessingQueueType* queue);
void ProcessBuffer(const char* data, int length, size_t& tick,
size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
t_BuildProcessingQueueType m_BuildProcessingQueue;

View File

@ -50,7 +50,8 @@ bool cmCTestConfigureCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
this->SetError("called with incorrect number of arguments. "
"RETURN_VALUE specified twice.");
return false;
}
havereturn_variable = true;
@ -59,7 +60,8 @@ bool cmCTestConfigureCommand::InitialPass(
{
if ( source_dir )
{
this->SetError("called with incorrect number of arguments. SOURCE specified twice.");
this->SetError("called with incorrect number of arguments. "
"SOURCE specified twice.");
return false;
}
havesource = true;
@ -68,7 +70,8 @@ bool cmCTestConfigureCommand::InitialPass(
{
if ( build_dir )
{
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
this->SetError("called with incorrect number of arguments. "
"BUILD specified twice.");
return false;
}
havebuild = true;
@ -76,7 +79,8 @@ bool cmCTestConfigureCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
@ -100,20 +104,24 @@ bool cmCTestConfigureCommand::InitialPass(
build_dir = m_Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
if ( !build_dir )
{
this->SetError("Build directory not specified. Either use BUILD argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY variable");
this->SetError("Build directory not specified. Either use BUILD "
"argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
"variable");
return false;
}
}
const char* ctestConfigureCommand = m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
const char* ctestConfigureCommand
= m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
if ( ctestConfigureCommand && *ctestConfigureCommand )
{
m_CTest->SetCTestConfiguration("ConfigureCommand", ctestConfigureCommand);
}
else
{
const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeGeneratorName
= m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
if ( cmakeGeneratorName && *cmakeGeneratorName )
{
std::string cmakeConfigureCommand = "\"";
@ -123,19 +131,24 @@ bool cmCTestConfigureCommand::InitialPass(
cmakeConfigureCommand += "\" \"";
cmakeConfigureCommand += source_dir;
cmakeConfigureCommand += "\"";
m_CTest->SetCTestConfiguration("ConfigureCommand", cmakeConfigureCommand.c_str());
m_CTest->SetCTestConfiguration("ConfigureCommand",
cmakeConfigureCommand.c_str());
}
else
{
this->SetError("Configure command is not specified. If this is a CMake project, specify CTEST_CMAKE_GENERATOR, or if this is not CMake project, specify CTEST_CONFIGURE_COMMAND.");
this->SetError("Configure command is not specified. If this is a CMake "
"project, specify CTEST_CMAKE_GENERATOR, or if this is not CMake "
"project, specify CTEST_CONFIGURE_COMMAND.");
return false;
}
}
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("configure");
cmCTestGenericHandler* handler
= m_CTest->GetInitializedHandler("configure");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate configure handler");
this->SetError(
"internal CTest error. Cannot instantiate configure handler");
return false;
}
int res = handler->ProcessHandler();

View File

@ -67,8 +67,9 @@ public:
{
return
" CTEST_CONFIGURE(BUILD build_dir RETURN_VALUE res)\n"
"Configures the given build directory and stores results in Configure.xml. The "
"second argument is a variable that will hold return value.";
"Configures the given build directory and stores results in "
"Configure.xml. The second argument is a variable that will hold "
"return value.";
}
cmTypeMacro(cmCTestConfigureCommand, cmCTestCommand);

View File

@ -43,15 +43,19 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string cCommand = m_CTest->GetCTestConfiguration("ConfigureCommand");
if ( cCommand.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
<< std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find ConfigureCommand key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
std::string buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
std::string buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
@ -64,14 +68,16 @@ int cmCTestConfigureHandler::ProcessHandler()
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Configure", os) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open configure file" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open configure file"
<< std::endl);
return 1;
}
std::string start_time = m_CTest->CurrentTime();
cmGeneratedFileStream ofs;
this->StartLogFile("Configure", ofs);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " << cCommand.c_str() << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
<< cCommand.c_str() << std::endl);
res = m_CTest->RunMakeCommand(cCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
0, ofs);
@ -85,12 +91,14 @@ int cmCTestConfigureHandler::ProcessHandler()
{
m_CTest->StartXML(os);
os << "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>" << std::endl;
<< "\t<StartDateTime>" << start_time << "</StartDateTime>"
<< std::endl;
if ( res == cmsysProcess_State_Exited && retVal )
{
os << retVal;
}
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>" << std::endl;
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>"
<< std::endl;
cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
os << "<Log>" << cmCTest::MakeXMLSafe(output) << "</Log>" << std::endl;
std::string end_time = m_CTest->CurrentTime();
@ -106,11 +114,13 @@ int cmCTestConfigureHandler::ProcessHandler()
}
else
{
cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand << std::endl);
cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand
<< std::endl);
}
if (! res || retVal )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project"
<< std::endl);
return -1;
}
return 0;

View File

@ -43,7 +43,8 @@ bool cmCTestCoverageCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
this->SetError("called with incorrect number of arguments. "
"RETURN_VALUE specified twice.");
return false;
}
havereturn_variable = true;
@ -52,7 +53,8 @@ bool cmCTestCoverageCommand::InitialPass(
{
if ( build_dir )
{
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
this->SetError("called with incorrect number of arguments. "
"BUILD specified twice.");
return false;
}
havesource = true;
@ -60,7 +62,8 @@ bool cmCTestCoverageCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
@ -81,7 +84,8 @@ bool cmCTestCoverageCommand::InitialPass(
return false;
}
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
cmSystemTools::ChangeDirectory(
m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
int res = handler->ProcessHandler();
if ( res_var )
{

View File

@ -67,8 +67,9 @@ public:
{
return
" CTEST_COVERAGE([BUILD build_dir] [RETURN_VALUE res])\n"
"Perform the coverage of the given build directory and stores results in "
"Coverage.xml. The second argument is a variable that will hold value.";
"Perform the coverage of the given build directory and stores results "
"in Coverage.xml. The second argument is a variable that will hold "
"value.";
}
cmTypeMacro(cmCTestCoverageCommand, cmCTestCommand);

View File

@ -44,25 +44,30 @@ void cmCTestCoverageHandler::Initialize()
}
//----------------------------------------------------------------------
bool cmCTestCoverageHandler::StartCoverageLogFile(cmGeneratedFileStream& covLogFile, int logFileCount)
bool cmCTestCoverageHandler::StartCoverageLogFile(
cmGeneratedFileStream& covLogFile, int logFileCount)
{
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " << covLogFilename << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " << covLogFilename
<< std::endl);
if (!this->StartResultingXML(covLogFilename, covLogFile) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open log file: " << covLogFilename << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open log file: "
<< covLogFilename << std::endl);
return false;
}
std::string local_start_time = m_CTest->CurrentTime();
m_CTest->StartXML(covLogFile);
covLogFile << "<CoverageLog>" << std::endl
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>" << std::endl;
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>"
<< std::endl;
return true;
}
//----------------------------------------------------------------------
void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, int logFileCount)
void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
int logFileCount)
{
std::string local_end_time = m_CTest->CurrentTime();
ostr << "\t<EndDateTime>" << local_end_time << "</EndDateTime>" << std::endl
@ -70,12 +75,14 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, int
m_CTest->EndXML(ostr);
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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,
bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
const char* srcDir,
const char* binDir)
{
std::vector<cmsys::RegularExpression>::iterator sit;
@ -93,8 +100,10 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src
std::string fSrcDir = cmSystemTools::CollapseFullPath(srcDir);
std::string fBinDir = cmSystemTools::CollapseFullPath(binDir);
std::string fFile = cmSystemTools::CollapseFullPath(file);
bool sourceSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), fSrcDir.c_str());
bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), fBinDir.c_str());
bool sourceSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(),
fSrcDir.c_str());
bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(),
fBinDir.c_str());
// Always check parent directory of the file.
std::string fileDir = cmSystemTools::GetFilenamePath(fFile.c_str());
std::string checkDir;
@ -124,7 +133,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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;
}
@ -154,7 +164,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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
@ -176,7 +187,8 @@ int cmCTestCoverageHandler::ProcessHandler()
double elapsed_time_start = cmSystemTools::GetTime();
if ( !this->StartLogFile("Coverage", ofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create LastCoverage.log file" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create LastCoverage.log file"
<< std::endl);
}
ofs << "Performing coverage: " << elapsed_time_start << std::endl;
@ -189,7 +201,8 @@ int cmCTestCoverageHandler::ProcessHandler()
// Style 1
std::string st1gcovOutputRex1 = "[0-9]+\\.[0-9]+% of [0-9]+ (source |)lines executed in file (.*)$";
std::string st1gcovOutputRex1
= "[0-9]+\\.[0-9]+% of [0-9]+ (source |)lines executed in file (.*)$";
std::string st1gcovOutputRex2 = "^Creating (.*\\.gcov)\\.";
cmsys::RegularExpression st1re1(st1gcovOutputRex1.c_str());
cmsys::RegularExpression st1re2(st1gcovOutputRex2.c_str());
@ -197,11 +210,13 @@ int cmCTestCoverageHandler::ProcessHandler()
// Style 2
std::string st2gcovOutputRex1 = "^File *[`'](.*)'$";
std::string st2gcovOutputRex2 = "Lines executed: *[0-9]+\\.[0-9]+% of [0-9]+$";
std::string st2gcovOutputRex2
= "Lines executed: *[0-9]+\\.[0-9]+% of [0-9]+$";
std::string st2gcovOutputRex3 = "^(.*):creating [`'](.*\\.gcov)'";
std::string st2gcovOutputRex4 = "^(.*):unexpected EOF *$";
std::string st2gcovOutputRex5 = "^(.*):cannot open source file*$";
std::string st2gcovOutputRex6 = "^(.*):source file is newer than graph file `(.*)'$";
std::string st2gcovOutputRex6
= "^(.*):source file is newer than graph file `(.*)'$";
cmsys::RegularExpression st2re1(st2gcovOutputRex1.c_str());
cmsys::RegularExpression st2re2(st2gcovOutputRex2.c_str());
cmsys::RegularExpression st2re3(st2gcovOutputRex3.c_str());
@ -232,7 +247,8 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( files.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find any coverage files." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find any coverage files."
<< std::endl);
// No coverage files is a valid thing, so the exit code is 0
return 0;
}
@ -243,7 +259,8 @@ int cmCTestCoverageHandler::ProcessHandler()
rexIt != m_CustomCoverageExclude.end();
++ rexIt )
{
m_CustomCoverageExcludeRegex.push_back(cmsys::RegularExpression(rexIt->c_str()));
m_CustomCoverageExcludeRegex.push_back(
cmsys::RegularExpression(rexIt->c_str()));
}
typedef std::vector<int> singleFileCoverageVector;
@ -256,14 +273,16 @@ int cmCTestCoverageHandler::ProcessHandler()
std::set<std::string> missingFiles;
std::string actualSourceFile = "";
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Processing coverage (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT,
" Processing coverage (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
int file_count = 0;
for ( it = files.begin(); it != files.end(); ++ it )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "." << std::flush);
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir + "\" \"" + *it + "\"";
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir
+ "\" \"" + *it + "\"";
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() << std::endl);
std::string output = "";
std::string errors = "";
@ -277,20 +296,26 @@ int cmCTestCoverageHandler::ProcessHandler()
ofs << " Errors: " << errors.c_str() << std::endl;
if ( ! res )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem running coverage on file: " << it->c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Command produced error: " << errors << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem running coverage on file: "
<< it->c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Command produced error: " << errors
<< std::endl);
error ++;
continue;
}
if ( retVal != 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Coverage command returned: " << retVal << " while processing: " << it->c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Command produced error: " << error << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Coverage command returned: "
<< retVal << " while processing: " << it->c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Command produced error: " << error
<< std::endl);
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"--------------------------------------------------------------" << std::endl
"--------------------------------------------------------------"
<< std::endl
<< output << std::endl
<< "--------------------------------------------------------------" << std::endl);
<< "--------------------------------------------------------------"
<< std::endl);
std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line;
@ -301,7 +326,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
std::string sourceFile;
std::string gcovFile;
cmCTestLog(m_CTest, DEBUG, "Line: [" << line->c_str() << "]" << std::endl);
cmCTestLog(m_CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl);
if ( line->size() == 0 )
{
// Ignore empty line; probably style 2
@ -312,7 +338,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -328,7 +355,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -343,7 +371,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -359,7 +388,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -372,7 +402,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -387,14 +418,16 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
gcovStyle = 2;
}
cmCTestLog(m_CTest, WARNING, "Warning: " << st2re4.match(1) << " had unexpected EOF" << std::endl);
cmCTestLog(m_CTest, WARNING, "Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl);
}
else if ( st2re5.find(line->c_str() ) )
{
@ -402,14 +435,16 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
gcovStyle = 2;
}
cmCTestLog(m_CTest, WARNING, "Warning: Cannot open file: " << st2re5.match(1) << std::endl);
cmCTestLog(m_CTest, WARNING, "Warning: Cannot open file: "
<< st2re5.match(1) << std::endl);
}
else if ( st2re6.find(line->c_str() ) )
{
@ -417,7 +452,8 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
}
@ -429,18 +465,21 @@ int cmCTestCoverageHandler::ProcessHandler()
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown line: [" << line->c_str() << "]" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown line: [" << line->c_str()
<< "]" << std::endl);
error ++;
//abort();
}
if ( !gcovFile.empty() && actualSourceFile.size() )
{
singleFileCoverageVector* vec = &totalCoverage[actualSourceFile];
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " in file: " << gcovFile << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " in file: "
<< gcovFile << std::endl);
std::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open file: " << gcovFile << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open file: "
<< gcovFile << std::endl);
}
else
{
@ -464,15 +503,18 @@ int cmCTestCoverageHandler::ProcessHandler()
continue;
}
// Read the coverage count from the beginning of the gcov output line
// Read the coverage count from the beginning of the gcov output
// line
std::string prefix = nl.substr(0, 12);
int cov = atoi(prefix.c_str());
// Read the line number starting at the 10th character of the gcov output line
// Read the line number starting at the 10th character of the gcov
// output line
std::string lineNumber = nl.substr(10, 5);
int lineIdx = atoi(lineNumber.c_str())-1;
if ( lineIdx >= 0 )
{
while ( vec->size() <= static_cast<singleFileCoverageVector::size_type>(lineIdx) )
while ( vec->size() <=
static_cast<singleFileCoverageVector::size_type>(lineIdx) )
{
vec->push_back(-1);
}
@ -499,28 +541,39 @@ int cmCTestCoverageHandler::ProcessHandler()
sourceFile.substr(0, sourceDir.size()) == sourceDir &&
sourceFile[sourceDir.size()] == '/' )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " << sourceFile.c_str() << std::endl);
ofs << " produced in source dir: " << sourceFile.c_str() << std::endl;
actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str());
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
<< sourceFile.c_str() << std::endl);
ofs << " produced in source dir: " << sourceFile.c_str()
<< std::endl;
actualSourceFile
= cmSystemTools::CollapseFullPath(sourceFile.c_str());
}
// Binary dir?
if ( sourceFile.size() > binaryDir.size() &&
sourceFile.substr(0, binaryDir.size()) == binaryDir &&
sourceFile[binaryDir.size()] == '/' )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " << sourceFile.c_str() << std::endl);
ofs << " produced in binary dir: " << sourceFile.c_str() << std::endl;
actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str());
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
<< sourceFile.c_str() << std::endl);
ofs << " produced in binary dir: " << sourceFile.c_str()
<< std::endl;
actualSourceFile
= cmSystemTools::CollapseFullPath(sourceFile.c_str());
}
if ( actualSourceFile.empty() )
{
if ( missingFiles.find(actualSourceFile) == missingFiles.end() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Something went wrong" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: [" << sourceFile.c_str() << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "s: [" << sourceFile.substr(0, sourceDir.size()) << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "b: [" << sourceFile.substr(0, binaryDir.size()) << "]" << std::endl);
ofs << " Something went wrong. Cannot find: " << sourceFile.c_str()
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Something went wrong"
<< std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: ["
<< sourceFile.c_str() << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "s: ["
<< sourceFile.substr(0, sourceDir.size()) << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "b: ["
<< sourceFile.substr(0, binaryDir.size()) << "]" << std::endl);
ofs << " Something went wrong. Cannot find: "
<< sourceFile.c_str()
<< " in source dir: " << sourceDir.c_str()
<< " or binary dir: " << binaryDir.c_str() << std::endl;
missingFiles.insert(actualSourceFile);
@ -531,7 +584,8 @@ int cmCTestCoverageHandler::ProcessHandler()
file_count ++;
if ( file_count % 50 == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count << " out of " << files.size() << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count
<< " out of " << files.size() << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
}
}
@ -541,7 +595,8 @@ int cmCTestCoverageHandler::ProcessHandler()
if (!this->StartResultingXML("Coverage", covSumFile))
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open coverage summary file." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open coverage summary file."
<< std::endl);
return -1;
}
@ -550,7 +605,8 @@ int cmCTestCoverageHandler::ProcessHandler()
// Produce output xml files
covSumFile << "<Coverage>" << std::endl
<< "\t<StartDateTime>" << coverage_start_time << "</StartDateTime>" << std::endl;
<< "\t<StartDateTime>" << coverage_start_time << "</StartDateTime>"
<< std::endl;
int logFileCount = 0;
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
{
@ -563,7 +619,8 @@ int cmCTestCoverageHandler::ProcessHandler()
//std::string fullSourceDir = sourceDir + "/";
//std::string fullBinaryDir = binaryDir + "/";
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Acumulating results (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT,
" Acumulating results (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
std::vector<std::string> errorsWhileAccumulating;
@ -577,7 +634,8 @@ int cmCTestCoverageHandler::ProcessHandler()
file_count ++;
if ( file_count % 50 == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count << " out of "
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count
<< " out of "
<< totalCoverage.size() << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
}
@ -591,15 +649,19 @@ 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());
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Process file: " << fullFileName << std::endl);
const std::string fileName
= cmSystemTools::GetFilenameName(fullFileName.c_str());
std::string fullFilePath
= cmSystemTools::GetFilenamePath(fullFileName.c_str());
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Process file: "
<< fullFileName << std::endl);
cmSystemTools::ConvertToUnixSlashes(fullFilePath);
if ( !cmSystemTools::FileExists(fullFileName.c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find file: " << fullFileName.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find file: "
<< fullFileName.c_str() << std::endl);
continue;
}
@ -608,7 +670,8 @@ int cmCTestCoverageHandler::ProcessHandler()
sourceDir.c_str(), binaryDir.c_str());
if ( !shouldIDoCoverage )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: "
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
".NoDartCoverage found, so skip coverage check for: "
<< fullFileName.c_str()
<< std::endl);
continue;
@ -641,12 +704,14 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( !cmSystemTools::GetLineFromStream(ifs, line) )
{
cmOStringStream ostr;
ostr << "Problem reading source file: " << fullFileName.c_str() << " line:" << cc;
ostr << "Problem reading source file: " << fullFileName.c_str()
<< " line:" << cc;
errorsWhileAccumulating.push_back(ostr.str());
error ++;
break;
}
covLogFile << "\t\t<Line Number=\"" << cc << "\" Count=\"" << fcov[cc] << "\">"
covLogFile << "\t\t<Line Number=\"" << cc << "\" Count=\"" << fcov[cc]
<< "\">"
<< m_CTest->MakeXMLSafe(line.c_str()) << "</Line>" << std::endl;
if ( fcov[cc] == 0 )
{
@ -698,7 +763,8 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( errorsWhileAccumulating.size() > 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) while acumulating results:" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) while acumulating results:"
<< std::endl);
std::vector<std::string>::iterator erIt;
for ( erIt = errorsWhileAccumulating.begin();
erIt != errorsWhileAccumulating.end();
@ -732,7 +798,8 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "</Coverage>" << std::endl;
m_CTest->EndXML(covSumFile);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "\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: "
@ -760,7 +827,8 @@ int cmCTestCoverageHandler::ProcessHandler()
//----------------------------------------------------------------------
void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude regular expressions." << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
" Add coverage exclude regular expressions." << std::endl);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
m_CustomCoverageExclude);
std::vector<cmStdString>::iterator it;
@ -768,6 +836,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
it != m_CustomCoverageExclude.end();
++ it )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " << it->c_str() << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: "
<< it->c_str() << std::endl);
}
}

View File

@ -36,7 +36,8 @@ public:
*/
virtual cmCommand* Clone()
{
cmCTestEmptyBinaryDirectoryCommand* ni = new cmCTestEmptyBinaryDirectoryCommand;
cmCTestEmptyBinaryDirectoryCommand* ni
= new cmCTestEmptyBinaryDirectoryCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
return ni;

View File

@ -72,11 +72,14 @@ const char* cmCTestGenericHandler::GetOption(const char* op)
}
//----------------------------------------------------------------------
bool cmCTestGenericHandler::StartResultingXML(const char* name, cmGeneratedFileStream& xofs)
bool cmCTestGenericHandler::StartResultingXML(const char* name,
cmGeneratedFileStream& xofs)
{
if ( !name )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create resulting XML file without providing the name" << std::endl;);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot create resulting XML file without providing the name"
<< std::endl;);
return false;
}
cmOStringStream ostr;
@ -86,9 +89,11 @@ bool cmCTestGenericHandler::StartResultingXML(const char* name, cmGeneratedFileS
ostr << "_" << m_SubmitIndex;
}
ostr << ".xml";
if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), ostr.str().c_str(), xofs, true) )
if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), ostr.str().c_str(),
xofs, true) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create resulting XML file: " << ostr.str().c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create resulting XML file: "
<< ostr.str().c_str() << std::endl);
return false;
}
m_CTest->AddSubmitFile(ostr.str().c_str());
@ -96,11 +101,13 @@ bool cmCTestGenericHandler::StartResultingXML(const char* name, cmGeneratedFileS
}
//----------------------------------------------------------------------
bool cmCTestGenericHandler::StartLogFile(const char* name, cmGeneratedFileStream& xofs)
bool cmCTestGenericHandler::StartLogFile(const char* name,
cmGeneratedFileStream& xofs)
{
if ( !name )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create log file without providing the name" << std::endl;);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot create log file without providing the name" << std::endl;);
return false;
}
cmOStringStream ostr;
@ -116,7 +123,8 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, cmGeneratedFileStream
ostr << ".log";
if( !m_CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create log file: " << ostr.str().c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create log file: "
<< ostr.str().c_str() << std::endl);
return false;
}
return true;

View File

@ -38,7 +38,8 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
bool cmCTestHandlerCommand::InitialPass(
std::vector<std::string> const& args)
{
if ( !this->ProcessArguments(args, m_Last, &*m_Arguments.begin(), m_Values) )
if ( !this->ProcessArguments(args, m_Last, &*m_Arguments.begin(),
m_Values) )
{
return false;
}
@ -58,8 +59,11 @@ bool cmCTestHandlerCommand::InitialPass(
{
if ( m_CTest->GetDartVersion() <= 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Dart before version 2.0 does not support collecting submissions." << std::endl
<< "Please upgrade the server to Dart 2 or higher, or do not use SUBMIT_INDEX." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Dart before version 2.0 does not support collecting submissions."
<< std::endl
<< "Please upgrade the server to Dart 2 or higher, or do not use "
"SUBMIT_INDEX." << std::endl);
}
else
{
@ -69,7 +73,8 @@ bool cmCTestHandlerCommand::InitialPass(
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
cmSystemTools::ChangeDirectory(
m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
int res = handler->ProcessHandler();
if ( m_Values[ct_RETURN_VALUE] && *m_Values[ct_RETURN_VALUE])
{
@ -81,8 +86,9 @@ bool cmCTestHandlerCommand::InitialPass(
return true;
}
bool cmCTestHandlerCommand::ProcessArguments(std::vector<std::string> const& args,
int last, const char** strings, std::vector<const char*>& values)
bool cmCTestHandlerCommand::ProcessArguments(
std::vector<std::string> const& args, int last, const char** strings,
std::vector<const char*>& values)
{
int state = 0;
int cc;
@ -98,7 +104,8 @@ bool cmCTestHandlerCommand::ProcessArguments(std::vector<std::string> const& arg
{
values[state] = args[i].c_str();
#undef cerr
cmCTestLog(m_CTest, DEBUG, "Set " << strings[state] << " to " << args[i].c_str() << std::endl);
cmCTestLog(m_CTest, DEBUG, "Set " << strings[state] << " to "
<< args[i].c_str() << std::endl);
state = 0;
}
else
@ -112,7 +119,8 @@ bool cmCTestHandlerCommand::ProcessArguments(std::vector<std::string> const& arg
if ( values[state] )
{
cmOStringStream ostr;
ostr << "called with incorrect number of arguments. " << strings[state] << " specified twice.";
ostr << "called with incorrect number of arguments. "
<< strings[state] << " specified twice.";
this->SetError(ostr.str().c_str());
return false;
}
@ -123,7 +131,9 @@ bool cmCTestHandlerCommand::ProcessArguments(std::vector<std::string> const& arg
if ( !found )
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str
<< "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}

View File

@ -64,8 +64,8 @@ public:
return
" CTEST_MEMCHECK([BUILD build_dir] [RETURN_VALUE res])\n"
"Performs a memory checking of tests in the given build directory and "
"stores results in MemCheck.xml. The second argument is a variable that "
"will hold value.";
"stores results in MemCheck.xml. The second argument is a variable "
"that will hold value.";
}
cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand);

View File

@ -117,7 +117,8 @@ int cmCTestMemCheckHandler::PreProcessHandler()
if ( !this->ExecuteCommands(m_CustomPreMemCheck) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem executing pre-memcheck command(s)." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem executing pre-memcheck command(s)." << std::endl);
return 0;
}
return 1;
@ -128,14 +129,16 @@ int cmCTestMemCheckHandler::PostProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPostMemCheck) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem executing post-memcheck command(s)." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem executing post-memcheck command(s)." << std::endl);
return 0;
}
return 1;
}
//----------------------------------------------------------------------
void cmCTestMemCheckHandler::GenerateTestCommand(std::vector<const char*>& args)
void cmCTestMemCheckHandler::GenerateTestCommand(
std::vector<const char*>& args)
{
std::vector<cmStdString>::size_type pp;
args.push_back(m_MemoryTester.c_str());
@ -145,9 +148,11 @@ void cmCTestMemCheckHandler::GenerateTestCommand(std::vector<const char*>& args)
{
args.push_back(m_MemoryTesterOptionsParsed[pp].c_str());
memcheckcommand += " ";
memcheckcommand += cmSystemTools::EscapeSpaces(m_MemoryTesterOptionsParsed[pp].c_str());
memcheckcommand += cmSystemTools::EscapeSpaces(
m_MemoryTesterOptionsParsed[pp].c_str());
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " << memcheckcommand << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
<< memcheckcommand << std::endl);
}
//----------------------------------------------------------------------
@ -202,7 +207,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
<< "</Test>" << std::endl;
}
os << "\t</TestList>\n";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "-- 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;
@ -212,7 +218,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
std::string memcheckstr;
int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT];
int kk;
bool res = this->ProcessMemCheckOutput(result->m_Output, memcheckstr, memcheckresults);
bool res = this->ProcessMemCheckOutput(result->m_Output, memcheckstr,
memcheckresults);
if ( res && result->m_Status == cmCTestMemCheckHandler::COMPLETED )
{
continue;
@ -245,7 +252,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
{
if ( memcheckresults[kk] )
{
os << "\t\t\t<Defect type=\"" << cmCTestMemCheckResultLongStrings[kk] << "\">"
os << "\t\t\t<Defect type=\"" << cmCTestMemCheckResultLongStrings[kk]
<< "\">"
<< memcheckresults[kk]
<< "</Defect>" << std::endl;
}
@ -263,7 +271,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Memory checking results:"
<< std::endl);
os << "\t<DefectList>" << std::endl;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
@ -274,9 +283,11 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
#endif
std::cerr.width(35);
#define cerr no_cerr
cmCTestLog(m_CTest, HANDLER_OUTPUT, cmCTestMemCheckResultLongStrings[cc] << " - "
cmCTestLog(m_CTest, HANDLER_OUTPUT, cmCTestMemCheckResultLongStrings[cc]
<< " - "
<< m_MemoryTesterGlobalResults[cc] << std::endl);
os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc] << "\"/>" << std::endl;
os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc]
<< "\"/>" << std::endl;
}
}
os << "\t</DefectList>" << std::endl;
@ -296,29 +307,37 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
bool cmCTestMemCheckHandler::InitializeMemoryChecking()
{
// Setup the command
if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration("MemoryCheckCommand").c_str()) )
if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
"MemoryCheckCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration("MemoryCheckCommand").c_str());
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
"MemoryCheckCommand").c_str());
}
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration("PurifyCommand").c_str()) )
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
"PurifyCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration("PurifyCommand").c_str());
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
"PurifyCommand").c_str());
}
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration("ValgrindCommand").c_str()) )
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
"ValgrindCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration("ValgrindCommand").c_str());
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
"ValgrindCommand").c_str());
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Memory checker (MemoryCheckCommand) not set, or cannot find the specified program."
cmCTestLog(m_CTest, ERROR_MESSAGE, "Memory checker (MemoryCheckCommand) "
"not set, or cannot find the specified program."
<< std::endl);
return false;
}
if ( m_MemoryTester[0] == '\"' && m_MemoryTester[m_MemoryTester.size()-1] == '\"' )
if ( m_MemoryTester[0] == '\"' &&
m_MemoryTester[m_MemoryTester.size()-1] == '\"' )
{
m_MemoryTester = m_MemoryTester.substr(1, m_MemoryTester.size()-2);
}
@ -326,32 +345,42 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
// Setup the options
if ( m_CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size() )
{
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration("MemoryCheckCommandOptions");
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration(
"MemoryCheckCommandOptions");
}
else if ( m_CTest->GetCTestConfiguration("ValgrindCommandOptions").size() )
{
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration("ValgrindCommandOptions");
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration(
"ValgrindCommandOptions");
}
m_MemoryTesterOutputFile = m_CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
m_MemoryTesterOutputFile = cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str());
m_MemoryTesterOutputFile
= m_CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
m_MemoryTesterOutputFile
= cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str());
if ( m_MemoryTester.find("valgrind") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
if ( !m_MemoryTesterOptions.size() )
{
m_MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes --show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=100";
m_MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes "
"--show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=100";
}
if ( m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").size() )
{
if ( !cmSystemTools::FileExists(m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str()) )
if ( !cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find memory checker suppression file: "
<< m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"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()) + "";
m_MemoryTesterOptions += " --suppressions=" +
cmSystemTools::EscapeSpaces(m_CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").c_str()) + "";
}
}
else if ( m_MemoryTester.find("purify") != std::string::npos )
@ -366,16 +395,19 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
else if ( m_MemoryTester.find("boundschecker") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
cmCTestLog(m_CTest, ERROR_MESSAGE, "Bounds checker not yet implemented" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Bounds checker not yet implemented"
<< std::endl);
return false;
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Do not understand memory checker: " << m_MemoryTester.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Do not understand memory checker: "
<< m_MemoryTester.c_str() << std::endl);
return false;
}
m_MemoryTesterOptionsParsed = cmSystemTools::ParseArguments(m_MemoryTesterOptions.c_str());
m_MemoryTesterOptionsParsed
= cmSystemTools::ParseArguments(m_MemoryTesterOptions.c_str());
std::vector<cmStdString>::size_type cc;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
@ -462,8 +494,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown Purify memory fault: " << pfW.match(1) << std::endl);
ostr << "*** Unknown Purify memory fault: " << pfW.match(1) << std::endl;
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown Purify memory fault: "
<< pfW.match(1) << std::endl);
ostr << "*** Unknown Purify memory fault: " << pfW.match(1)
<< std::endl;
}
}
if ( failure != NO_MEMORY_FAULT )
@ -517,13 +551,15 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
" in loss record [0-9][0-9]* of [0-9]");
cmsys::RegularExpression vgUMC(
"== .*Conditional jump or move depends on uninitialised value\\(s\\)");
cmsys::RegularExpression vgUMR1("== .*Use of uninitialised value of size [0-9][0-9]*");
cmsys::RegularExpression vgUMR1(
"== .*Use of uninitialised value of size [0-9][0-9]*");
cmsys::RegularExpression vgUMR2("== .*Invalid read of size [0-9][0-9]*");
cmsys::RegularExpression vgUMR3("== .*Jump to the invalid address ");
cmsys::RegularExpression vgUMR4(
"== .*Syscall param .* contains uninitialised or unaddressable byte\\(s\\)");
cmsys::RegularExpression vgUMR4("== .*Syscall param .* contains "
"uninitialised or unaddressable byte\\(s\\)");
cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]");
cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is locked by a different thread");
cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is "
"locked by a different thread");
double sttime = cmSystemTools::GetTime();
cmCTestLog(m_CTest, DEBUG, "Start test: " << lines.size() << std::endl);
@ -532,19 +568,58 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
if ( valgrindLine.find(lines[cc]) )
{
int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
if ( vgFIM.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::FIM; }
else if ( vgFMM.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::FMM; }
else if ( vgMLK.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::MLK; }
else if ( vgPAR.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::PAR; }
else if ( vgMPK1.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::MPK; }
else if ( vgMPK2.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::MPK; }
else if ( vgUMC.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::UMC; }
else if ( vgUMR1.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::UMR; }
else if ( vgUMR2.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::UMR; }
else if ( vgUMR3.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::UMR; }
else if ( vgUMR4.find(lines[cc]) ){ failure = cmCTestMemCheckHandler::UMR; }
else if ( vgIPW.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::IPW; }
else if ( vgABR.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::ABR; }
if ( vgFIM.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::FIM;
}
else if ( vgFMM.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::FMM;
}
else if ( vgMLK.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::MLK;
}
else if ( vgPAR.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::PAR;
}
else if ( vgMPK1.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::MPK;
}
else if ( vgMPK2.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::MPK;
}
else if ( vgUMC.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::UMC;
}
else if ( vgUMR1.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::UMR;
}
else if ( vgUMR2.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::UMR;
}
else if ( vgUMR3.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::UMR;
}
else if ( vgUMR4.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::UMR;
}
else if ( vgIPW.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::IPW;
}
else if ( vgABR.find(lines[cc]) )
{
failure = cmCTestMemCheckHandler::ABR;
}
if ( failure != cmCTestMemCheckHandler::NO_MEMORY_FAULT )
{
@ -555,7 +630,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
}
}
cmCTestLog(m_CTest, DEBUG, "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 )
{

View File

@ -18,7 +18,8 @@
#include "cmCTestScriptHandler.h"
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args)
bool cmCTestRunScriptCommand::InitialPass(
std::vector<std::string> const& args)
{
if(args.size() < 1 )
{

View File

@ -322,13 +322,16 @@ int cmCTestScriptHandler::ExtractVariables()
m_CTestEnv = m_Makefile->GetSafeDefinition("CTEST_ENVIRONMENT");
m_InitCache = m_Makefile->GetSafeDefinition("CTEST_INITIAL_CACHE");
m_CMakeCmd = m_Makefile->GetSafeDefinition("CTEST_CMAKE_COMMAND");
m_CMOutFile = m_Makefile->GetSafeDefinition("CTEST_CMAKE_OUTPUT_FILE_NAME");
m_CMOutFile
= m_Makefile->GetSafeDefinition("CTEST_CMAKE_OUTPUT_FILE_NAME");
m_Backup = m_Makefile->IsOn("CTEST_BACKUP_AND_RESTORE");
m_EmptyBinDir = m_Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY");
m_EmptyBinDirOnce = m_Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE");
m_EmptyBinDirOnce
= m_Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE");
minInterval = m_Makefile->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL");
minInterval
= m_Makefile->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL");
contDuration = m_Makefile->GetDefinition("CTEST_CONTINUOUS_DURATION");
char updateVar[40];
@ -341,7 +344,8 @@ int cmCTestScriptHandler::ExtractVariables()
{
if ( m_CVSCmd.empty() )
{
cmSystemTools::Error(updateVar, " specified without specifying CTEST_CVS_COMMAND.");
cmSystemTools::Error(updateVar,
" specified without specifying CTEST_CVS_COMMAND.");
return 12;
}
m_ExtraUpdates.push_back(updateVal);
@ -408,7 +412,8 @@ void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait)
//----------------------------------------------------------------------
// run a specific script
int cmCTestScriptHandler::RunConfigurationScript(const std::string& total_script_arg)
int cmCTestScriptHandler::RunConfigurationScript(
const std::string& total_script_arg)
{
int result;
@ -510,7 +515,8 @@ int cmCTestScriptHandler::CheckOutSourceDir()
{
// we must now checkout the src dir
output = "";
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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_HandlerVerbose, 0 /*m_TimeOut*/);
@ -587,7 +593,8 @@ int cmCTestScriptHandler::PerformExtraUpdates()
fullCommand += cvsArgs[1];
output = "";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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_HandlerVerbose, 0 /*m_TimeOut*/);
@ -633,7 +640,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
{
if ( !cmCTestScriptHandler::EmptyBinaryDirectory(m_BinaryDir.c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem removing the binary directory" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem removing the binary directory" << std::endl);
}
}
@ -658,7 +666,11 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// make sure we have the required info
if (m_CVSCheckOut.empty())
{
cmSystemTools::Error("You have specified the source and binary directories to be the same (an in source build). You have also specified that the binary directory is to be erased. This means that the source will have to be checked out from CVS. But you have not specified CTEST_CVS_CHECKOUT");
cmSystemTools::Error("You have specified the source and binary "
"directories to be the same (an in source build). You have also "
"specified that the binary directory is to be erased. This means "
"that the source will have to be checked out from CVS. But you have "
"not specified CTEST_CVS_CHECKOUT");
return 8;
}
@ -710,7 +722,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
output = "";
command += "\"";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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_HandlerVerbose, 0 /*m_TimeOut*/);
@ -723,7 +736,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
cmakeOutputFile = m_BinaryDir + "/" + cmakeOutputFile;
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Write CMake output to file: " << cmakeOutputFile.c_str()
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"Write CMake output to file: " << cmakeOutputFile.c_str()
<< std::endl);
cmGeneratedFileStream fout(cmakeOutputFile.c_str());
if ( fout )
@ -753,7 +767,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
command = ctestCommands[i];
output = "";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "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_HandlerVerbose, 0 /*m_TimeOut*/);

View File

@ -56,19 +56,22 @@ bool cmCTestStartCommand::InitialPass(
}
if ( !src_dir )
{
this->SetError("source directory not specified. Specify source directory as an argument or set CTEST_SOURCE_DIRECTORY");
this->SetError("source directory not specified. Specify source directory "
"as an argument or set CTEST_SOURCE_DIRECTORY");
return false;
}
if ( !bld_dir)
{
this->SetError("binary directory not specified. Specify binary directory as an argument or set CTEST_BINARY_DIRECTORY");
this->SetError("binary directory not specified. Specify binary directory "
"as an argument or set CTEST_BINARY_DIRECTORY");
return false;
}
m_CTest->EmptyCTestConfiguration();
m_CTest->SetCTestConfiguration("SourceDirectory", src_dir);
m_CTest->SetCTestConfiguration("BuildDirectory", bld_dir);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel << std::endl
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel
<< std::endl
<< " Source directory: " << src_dir << std::endl
<< " Build directory: " << bld_dir << std::endl);

View File

@ -67,10 +67,10 @@ public:
{
return
" CTEST_START(Model [source [binary]])\n"
"Starts the testing for a given model. The command should be called after "
"the binary directory is initialized. If the 'source' and 'binary' "
"directory are not specified, it reads the CTEST_SOURCE_DIRECTORY and "
"CTEST_BINARY_DIRECTORY.";
"Starts the testing for a given model. The command should be called "
"after the binary directory is initialized. If the 'source' and "
"'binary' directory are not specified, it reads the "
"CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY.";
}
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);

View File

@ -36,7 +36,8 @@ bool cmCTestSubmitCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
this->SetError("called with incorrect number of arguments. "
"RETURN_VALUE specified twice.");
return false;
}
havereturn_variable = true;
@ -44,16 +45,21 @@ bool cmCTestSubmitCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
}
const char* ctestDropMethod = m_Makefile->GetDefinition("CTEST_DROP_METHOD");
const char* ctestDropSite = m_Makefile->GetDefinition("CTEST_DROP_SITE");
const char* ctestDropLocation = m_Makefile->GetDefinition("CTEST_DROP_LOCATION");
const char* ctestTriggerSite = m_Makefile->GetDefinition("CTEST_TRIGGER_SITE");
const char* ctestDropMethod
= m_Makefile->GetDefinition("CTEST_DROP_METHOD");
const char* ctestDropSite
= m_Makefile->GetDefinition("CTEST_DROP_SITE");
const char* ctestDropLocation
= m_Makefile->GetDefinition("CTEST_DROP_LOCATION");
const char* ctestTriggerSite
= m_Makefile->GetDefinition("CTEST_TRIGGER_SITE");
if ( !ctestDropMethod )
{
@ -69,8 +75,10 @@ bool cmCTestSubmitCommand::InitialPass(
}
if ( !ctestTriggerSite )
{
ctestTriggerSite = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "* Use default trigger site: " << ctestTriggerSite << std::endl;);
ctestTriggerSite
= "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "* Use default trigger site: "
<< ctestTriggerSite << std::endl;);
}
m_CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
@ -78,11 +86,15 @@ bool cmCTestSubmitCommand::InitialPass(
m_CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
m_CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite);
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "ScpCommand", "CTEST_SCP_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"DropSiteUser", "CTEST_DROP_SITE_USER");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"DropSitePassword", "CTEST_DROP_SITE_PASSWORD");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"ScpCommand", "CTEST_SCP_COMMAND");
const char* notesFilesVariable = m_Makefile->GetDefinition("CTEST_NOTES_FILES");
const char* notesFilesVariable
= m_Makefile->GetDefinition("CTEST_NOTES_FILES");
if (notesFilesVariable)
{
std::vector<std::string> notesFiles;
@ -97,7 +109,8 @@ bool cmCTestSubmitCommand::InitialPass(
}
m_CTest->GenerateNotesFile(newNotesFiles);
}
const char* extraFilesVariable = m_Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
const char* extraFilesVariable
= m_Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
if (extraFilesVariable)
{
std::vector<std::string> extraFiles;

View File

@ -22,7 +22,8 @@
/** \class cmCTestSubmit
* \brief Run a ctest script
*
* cmCTestSubmitCommand defineds the command to submit the test results for the project.
* cmCTestSubmitCommand defineds the command to submit the test results for
* the project.
*/
class cmCTestSubmitCommand : public cmCTestCommand
{

View File

@ -36,11 +36,13 @@ PURPOSE. See the above copyright notices for more information.
typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
static size_t
cmCTestSubmitHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
cmCTestSubmitHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb,
void *data)
{
register int realsize = size * nmemb;
cmCTestSubmitHandlerVectorOfChar *vec = static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
cmCTestSubmitHandlerVectorOfChar *vec
= static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
const char* chPtr = static_cast<char*>(ptr);
vec->insert(vec->end(), chPtr, chPtr + realsize);
@ -48,9 +50,11 @@ cmCTestSubmitHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb, vo
}
static size_t
cmCTestSubmitHandlerCurlDebugCallback(CURL *, curl_infotype, char *chPtr, size_t size, void *data)
cmCTestSubmitHandlerCurlDebugCallback(CURL *, curl_infotype, char *chPtr,
size_t size, void *data)
{
cmCTestSubmitHandlerVectorOfChar *vec = static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
cmCTestSubmitHandlerVectorOfChar *vec
= static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
vec->insert(vec->end(), chPtr, chPtr + size);
return size;
@ -125,12 +129,14 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
{
local_file = localprefix + "/" + *file;
}
cmStdString upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
cmStdString upload_as
= url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
@ -139,7 +145,8 @@ 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;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file.c_str() << " to "
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << std::endl);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
@ -151,14 +158,17 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
// and give the size of the upload (optional)
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(st.st_size));
::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);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, cmCTestSubmitHandlerCurlDebugCallback);
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmCTestSubmitHandlerWriteMemoryCallback);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION,
cmCTestSubmitHandlerCurlDebugCallback);
/* we pass our 'chunk' struct to the callback function */
cmCTestSubmitHandlerVectorOfChar chunk;
@ -172,31 +182,39 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl);
}
fclose(ftpfile);
if ( res )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: "
<< local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " 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
<< " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
<< " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
// always cleanup
::curl_easy_cleanup(curl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
<< std::endl);
}
}
::curl_global_cleanup();
@ -261,7 +279,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
{
local_file = localprefix + "/" + *file;
}
cmStdString remote_file = remoteprefix + cmSystemTools::GetFilenameName(*file);
cmStdString remote_file
= remoteprefix + cmSystemTools::GetFilenameName(*file);
*m_LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< remote_file.c_str() << std::endl;
@ -296,14 +315,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
ftpfile = ::fopen(local_file.c_str(), "rb");
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file.c_str() << " to "
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << " Size: " << st.st_size << std::endl);
@ -314,14 +335,17 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
// and give the size of the upload (optional)
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(st.st_size));
::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);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, cmCTestSubmitHandlerCurlDebugCallback);
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmCTestSubmitHandlerWriteMemoryCallback);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION,
cmCTestSubmitHandlerCurlDebugCallback);
/* we pass our 'chunk' struct to the callback function */
cmCTestSubmitHandlerVectorOfChar chunk;
@ -335,31 +359,39 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl);
}
fclose(ftpfile);
if ( res )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: "
<< local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " 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
<< " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
<< " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
}
// always cleanup
::curl_easy_cleanup(curl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
<< std::endl);
}
}
::curl_global_cleanup();
@ -367,7 +399,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
//----------------------------------------------------------------------------
bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
bool cmCTestSubmitHandler::TriggerUsingHTTP(
const std::set<cmStdString>& files,
const cmStdString& remoteprefix,
const cmStdString& url)
{
@ -412,8 +445,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
// specify handler for output
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmCTestSubmitHandlerWriteMemoryCallback);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, cmCTestSubmitHandlerCurlDebugCallback);
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmCTestSubmitHandlerWriteMemoryCallback);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION,
cmCTestSubmitHandlerCurlDebugCallback);
/* we pass our 'chunk' struct to the callback function */
cmCTestSubmitHandlerVectorOfChar chunk;
@ -421,7 +456,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
cmStdString rfile = remoteprefix + cmSystemTools::GetFilenameName(*file);
cmStdString rfile
= remoteprefix + cmSystemTools::GetFilenameName(*file);
cmStdString ofile = "";
cmStdString::iterator kk;
for ( kk = rfile.begin(); kk < rfile.end(); ++ kk)
@ -450,17 +486,23 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
= url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&")
+ "xmlfile=" + ofile;
*m_LogFile << "Trigger url: " << turl.c_str() << std::endl;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " 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) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when triggering: " << turl.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl);
*m_LogFile << "\tTrigerring failed with error: " << error_buffer << std::endl
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when triggering: "
<< turl.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " 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;
<< " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
@ -469,12 +511,14 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl);
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size())
<< "]" << std::endl);
}
// always cleanup
@ -483,7 +527,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
}
}
::curl_global_cleanup();
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Dart server triggered..." << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Dart server triggered..."
<< std::endl);
return true;
}
@ -524,7 +569,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
argv[1] = lfname.c_str();
std::string rfname = url + "/" + remoteprefix + *file;
argv[2] = rfname.c_str();
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
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;
@ -536,7 +582,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLogWrite(data, length));
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(data, length));
}
cmsysProcess_WaitForExit(cp, 0);
@ -548,7 +595,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
retVal = cmsysProcess_GetExitValue(cp);
if ( retVal != 0 )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: " << retVal << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: "
<< retVal << std::endl);
*m_LogFile << "\tSCP returned: " << retVal << std::endl;
problems ++;
}
@ -556,13 +604,15 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
else if(result == cmsysProcess_State_Exception)
{
retVal = cmsysProcess_GetExitException(cp);
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was an exception: " << retVal << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was an exception: "
<< retVal << std::endl);
*m_LogFile << "\tThere was an exception: " << retVal << std::endl;
problems ++;
}
else if(result == cmsysProcess_State_Expired)
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was a timeout" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was a timeout"
<< std::endl);
*m_LogFile << "\tThere was a timeout" << std::endl;
problems ++;
}
@ -601,7 +651,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
xmlrpc_env_init(&env);
/* Call the famous server at UserLand. */
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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);
cmCTest::tm_SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
@ -612,11 +663,13 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
local_file = localprefix + "/" + *file;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
return false;
}
@ -624,7 +677,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
FILE* fp = fopen(local_file.c_str(), "rb");
if ( !fp )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot open file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot open file: "
<< local_file.c_str() << std::endl);
return false;
}
@ -633,7 +687,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
delete [] fileBuffer;
fclose(fp);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot read file: " << local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot read file: "
<< local_file.c_str() << std::endl);
return false;
}
fclose(fp);
@ -647,7 +702,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
if ( env.fault_occurred )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Submission problem: "
<< env.fault_string << " (" << env.fault_code << ")" << std::endl);
xmlrpc_env_clean(&env);
xmlrpc_client_cleanup();
return false;
@ -668,10 +724,13 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
//----------------------------------------------------------------------------
int cmCTestSubmitHandler::ProcessHandler()
{
const std::string &buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
const std::string &buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
@ -742,11 +801,13 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( m_HTTPProxy.size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " << m_HTTPProxy << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " << m_HTTPProxy
<< std::endl);
}
if ( m_FTPProxy.size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use FTP Proxy: " << m_FTPProxy << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use FTP Proxy: " << m_FTPProxy
<< std::endl);
}
cmGeneratedFileStream ofs;
this->StartLogFile("Submit", ofs);
@ -762,17 +823,20 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( m_CTest->AddIfExists(files, "Coverage.xml") )
{
cmCTest::tm_VectorOfStrings gfiles;
std::string gpath = buildDirectory + "/Testing/" + m_CTest->GetCurrentTag();
std::string gpath
= buildDirectory + "/Testing/" + m_CTest->GetCurrentTag();
std::string::size_type glen = gpath.size() + 1;
gpath = gpath + "/CoverageLog*";
cmCTestLog(m_CTest, DEBUG, "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);
cmCTestLog(m_CTest, DEBUG, "Glob file: " << gfiles[cc].c_str() << std::endl);
cmCTestLog(m_CTest, DEBUG, "Glob file: " << gfiles[cc].c_str()
<< std::endl);
files.insert(gfiles[cc]);
}
}
@ -803,60 +867,75 @@ int cmCTestSubmitHandler::ProcessHandler()
cnt ++;
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Submit files (using " << m_CTest->GetCTestConfiguration("DropMethod") << ")"
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;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using FTP submit method" << std::endl
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using FTP submit method"
<< std::endl
<< " Drop site: ftp://");
std::string url = "ftp://";
url += cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropSiteUser")) + ":" +
cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropSitePassword")) + "@" +
url += cmCTest::MakeURLSafe(
m_CTest->GetCTestConfiguration("DropSiteUser")) + ":" +
cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration(
"DropSitePassword")) + "@" +
m_CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropLocation"));
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration("DropSiteUser").c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration(
"DropSiteUser").c_str());
if ( m_CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, ":******");
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "@");
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration("DropSite")
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSite")
<< m_CTest->GetCTestConfiguration("DropLocation") << std::endl);
if ( !this->SubmitUsingFTP(buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(),
if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/"
+ m_CTest->GetCurrentTag(),
files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via FTP" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via FTP"
<< std::endl);
ofs << " Problems when submitting via FTP" << std::endl;
return -1;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP trigger method" << std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite") << std::endl);
if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetCTestConfiguration("TriggerSite")) )
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP trigger method"
<< std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite")
<< std::endl);
if ( !this->TriggerUsingHTTP(files, prefix,
m_CTest->GetCTestConfiguration("TriggerSite")) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when triggering via HTTP" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
" Problems when triggering via HTTP" << std::endl);
ofs << " Problems when triggering via HTTP" << std::endl;
return -1;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP submit method" << std::endl
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP submit method"
<< std::endl
<< " Drop site: http://");
std::string url = "http://";
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
url += m_CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration("DropSiteUser").c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSiteUser").c_str());
if ( m_CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
{
url += ":" + m_CTest->GetCTestConfiguration("DropSitePassword");
@ -865,40 +944,53 @@ int cmCTestSubmitHandler::ProcessHandler()
url += "@";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "@");
}
url += m_CTest->GetCTestConfiguration("DropSite") + m_CTest->GetCTestConfiguration("DropLocation");
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration("DropSite")
url += m_CTest->GetCTestConfiguration("DropSite") +
m_CTest->GetCTestConfiguration("DropLocation");
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSite")
<< m_CTest->GetCTestConfiguration("DropLocation") << std::endl);
if ( !this->SubmitUsingHTTP(buildDirectory +"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" +
m_CTest->GetCurrentTag(), files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via HTTP" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
" Problems when submitting via HTTP" << std::endl);
ofs << " Problems when submitting via HTTP" << std::endl;
return -1;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP trigger method" << std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite") << std::endl);
if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetCTestConfiguration("TriggerSite")) )
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP trigger method"
<< std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite")
<< std::endl);
if ( !this->TriggerUsingHTTP(files, prefix,
m_CTest->GetCTestConfiguration("TriggerSite")) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when triggering via HTTP" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
" Problems when triggering via HTTP" << std::endl);
ofs << " Problems when triggering via HTTP" << std::endl;
return -1;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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) )
if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" +
m_CTest->GetCurrentTag(), files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via XML-RPC" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
" Problems when submitting via XML-RPC" << std::endl);
ofs << " Problems when submitting via XML-RPC" << std::endl;
return -1;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
@ -910,7 +1002,8 @@ int cmCTestSubmitHandler::ProcessHandler()
{
url += m_CTest->GetCTestConfiguration("DropSiteUser") + "@";
}
url += m_CTest->GetCTestConfiguration("DropSite") + ":" + m_CTest->GetCTestConfiguration("DropLocation");
url += m_CTest->GetCTestConfiguration("DropSite") + ":" +
m_CTest->GetCTestConfiguration("DropLocation");
// change to the build directory so that we can uses a relative path
// on windows since scp dosn't support "c:" a drive in the path
@ -921,17 +1014,20 @@ int cmCTestSubmitHandler::ProcessHandler()
"Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
{
cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str());
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via SCP" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via SCP"
<< std::endl);
ofs << " Problems when submitting via SCP" << std::endl;
return -1;
}
cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
cmCTestLog(m_CTest, ERROR_MESSAGE, " Unknown submission method: \"" << m_CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Unknown submission method: \""
<< m_CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl);
return -1;
}

View File

@ -63,7 +63,8 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
{
testsToRunString << m_Values[ctt_STRIDE];
}
handler->SetOption("TestsToRunInformation", testsToRunString.str().c_str());
handler->SetOption("TestsToRunInformation",
testsToRunString.str().c_str());
}
return handler;
}

View File

@ -111,7 +111,8 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
}
fname += "/";
fname += testFilename;
bool readit = m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(), fname.c_str());
bool readit = m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(),
fname.c_str());
cmSystemTools::ChangeDirectory(cwd.c_str());
if(!readit)
{
@ -178,7 +179,8 @@ public:
*/
virtual cmCommand* Clone()
{
cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand;
cmCTestSetTestsPropertiesCommand* c
= new cmCTestSetTestsPropertiesCommand;
c->m_TestHandler = m_TestHandler;
return c;
}
@ -204,7 +206,8 @@ public:
};
//----------------------------------------------------------------------
bool cmCTestSetTestsPropertiesCommand::InitialPass(std::vector<std::string> const& args)
bool cmCTestSetTestsPropertiesCommand::InitialPass(
std::vector<std::string> const& args)
{
return m_TestHandler->SetTestsProperties(args);
}
@ -402,7 +405,8 @@ int cmCTestTestHandler::PreProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPreTest) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem executing pre-test command(s)." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem executing pre-test command(s)." << std::endl);
return 0;
}
return 1;
@ -413,7 +417,8 @@ int cmCTestTestHandler::PostProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPostTest) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem executing post-test command(s)." << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Problem executing post-test command(s)." << std::endl);
return 0;
}
return 1;
@ -443,7 +448,8 @@ int cmCTestTestHandler::ProcessHandler()
m_TestResults.clear();
cmCTestLog(m_CTest, HANDLER_OUTPUT, (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;
@ -465,7 +471,8 @@ int cmCTestTestHandler::ProcessHandler()
{
if ( !m_CTest->GetShowOnly() )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "No tests were found!!!" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "No tests were found!!!"
<< std::endl);
}
}
else
@ -473,7 +480,8 @@ int cmCTestTestHandler::ProcessHandler()
if (m_HandlerVerbose && passed.size() &&
(m_UseIncludeRegExp || m_UseExcludeRegExp))
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl << "The following tests passed:" << std::endl);
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)
{
@ -486,7 +494,8 @@ int cmCTestTestHandler::ProcessHandler()
{
percent = 99;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl << static_cast<int>(percent + .5) << "% tests passed, "
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl
<< static_cast<int>(percent + .5) << "% 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);
@ -495,7 +504,8 @@ int cmCTestTestHandler::ProcessHandler()
{
cmGeneratedFileStream ofs;
cmCTestLog(m_CTest, ERROR_MESSAGE, std::endl << "The following tests FAILED:" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, std::endl
<< "The following tests FAILED:" << std::endl);
this->StartLogFile("TestsFailed", ofs);
std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator ftit;
@ -505,9 +515,9 @@ int cmCTestTestHandler::ProcessHandler()
if ( ftit->m_Status != cmCTestTestHandler::COMPLETED )
{
ofs << ftit->m_TestCount << ":" << ftit->m_Name << std::endl;
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));
cmCTestLog(m_CTest, HANDLER_OUTPUT, "\t" << std::setw(3)
<< ftit->m_TestCount << " - " << ftit->m_Name.c_str() << " ("
<< this->GetTestStatus(ftit->m_Status) << ")" << std::endl);
}
}
@ -517,9 +527,11 @@ int cmCTestTestHandler::ProcessHandler()
if ( m_CTest->GetProduceXML() )
{
cmGeneratedFileStream xmlfile;
if( !this->StartResultingXML((m_MemCheck ? "DynamicAnalysis" : "Test"), xmlfile) )
if( !this->StartResultingXML((m_MemCheck ? "DynamicAnalysis" : "Test"),
xmlfile) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create " << (m_MemCheck ? "memory check" : "testing")
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create "
<< (m_MemCheck ? "memory check" : "testing")
<< " XML file" << std::endl);
m_LogFile = 0;
return 1;
@ -658,7 +670,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
cmCTestLog(m_CTest, DEBUG, "Testing " << args[0].c_str() << " ... ");
// find the test executable
std::string actualCommand = this->FindTheExecutable(args[1].c_str());
std::string testCommand = cmSystemTools::ConvertToOutputPath(actualCommand.c_str());
std::string testCommand
= cmSystemTools::ConvertToOutputPath(actualCommand.c_str());
// continue if we did not find the executable
if (testCommand == "")
@ -698,7 +711,9 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
int retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, 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);
*m_LogFile << cnt << "/" << tmsize
<< " Test: " << testname.c_str() << std::endl;
*m_LogFile << "Command: ";
@ -839,7 +854,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
}
else if ( res == cmsysProcess_State_Error )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Bad command " << res << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Bad command " << res
<< std::endl);
cres.m_Status = cmCTestTestHandler::BAD_COMMAND;
}
else
@ -869,18 +885,21 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
{
std::string dartString = m_DartStuff.match(1);
cmSystemTools::ReplaceString(output, dartString.c_str(),"");
cres.m_RegressionImages = this->GenerateRegressionImages(dartString);
cres.m_RegressionImages
= this->GenerateRegressionImages(dartString);
}
}
}
if ( cres.m_Status == cmCTestTestHandler::COMPLETED )
{
this->CleanTestOutput(output, static_cast<size_t>(m_CustomMaximumPassedTestOutputSize));
this->CleanTestOutput(output, static_cast<size_t>(
m_CustomMaximumPassedTestOutputSize));
}
else
{
this->CleanTestOutput(output, static_cast<size_t>(m_CustomMaximumFailedTestOutputSize));
this->CleanTestOutput(output, static_cast<size_t>(
m_CustomMaximumFailedTestOutputSize));
}
cres.m_Output = output;
@ -954,12 +973,17 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
<< "\t\t<Results>" << std::endl;
if ( result->m_Status != cmCTestTestHandler::NOT_RUN )
{
if ( result->m_Status != cmCTestTestHandler::COMPLETED || result->m_ReturnValue )
if ( result->m_Status != cmCTestTestHandler::COMPLETED ||
result->m_ReturnValue )
{
os << "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Code\"><Value>"
<< this->GetTestStatus(result->m_Status) << "</Value></NamedMeasurement>\n"
<< "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Value\"><Value>"
<< result->m_ReturnValue << "</Value></NamedMeasurement>" << std::endl;
os << "\t\t\t<NamedMeasurement type=\"text/string\" "
"name=\"Exit Code\"><Value>"
<< this->GetTestStatus(result->m_Status) << "</Value>"
"</NamedMeasurement>\n"
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
"name=\"Exit Value\"><Value>"
<< result->m_ReturnValue << "</Value></NamedMeasurement>"
<< std::endl;
}
os << result->m_RegressionImages;
os << "\t\t\t<NamedMeasurement type=\"numeric/double\" "
@ -996,11 +1020,13 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
for ( it = vec.begin(); it != vec.end(); ++it )
{
int retVal = 0;
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 )
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 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem running command: " << *it << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem running command: " << *it
<< std::endl);
return 0;
}
}
@ -1017,7 +1043,8 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
std::string file;
cmSystemTools::SplitProgramPath(exe, dir, file);
// first try to find the executable given a config type subdir if there is one
// first try to find the executable given a config type subdir if there is
// one
if(m_CTest->GetConfigType() != "" &&
::TryExecutable(dir.c_str(), file.c_str(), &fullPath,
m_CTest->GetConfigType().c_str()))
@ -1088,7 +1115,8 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
dir += m_CTest->GetConfigType();
dir += "/";
dir += file;
cmSystemTools::Error("config type specified on the command line, but test executable not found.",
cmSystemTools::Error("config type specified on the command line, but "
"test executable not found.",
dir.c_str());
return "";
}
@ -1107,14 +1135,16 @@ void cmCTestTestHandler::GetListOfTests()
{
m_ExcludeTestsRegularExpression.compile(m_ExcludeRegExp.c_str());
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Constructing a list of tests" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Constructing a list of tests"
<< std::endl);
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE", m_CTest->GetConfigType().c_str());
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
m_CTest->GetConfigType().c_str());
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
@ -1127,7 +1157,8 @@ void cmCTestTestHandler::GetListOfTests()
cm.AddCommand(newCom2);
// Add handler for SET_SOURCE_FILES_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom3 = new cmCTestSetTestsPropertiesCommand;
cmCTestSetTestsPropertiesCommand* newCom3
= new cmCTestSetTestsPropertiesCommand;
newCom3->m_TestHandler = this;
cm.AddCommand(newCom3);
@ -1155,7 +1186,8 @@ void cmCTestTestHandler::GetListOfTests()
{
return;
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Done constructing a list of tests" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"Done constructing a list of tests" << std::endl);
}
//----------------------------------------------------------------------
@ -1305,37 +1337,49 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
{
ostr
<< "\t\t\t<NamedMeasurement"
<< " " << twoattributes.match(1) << "=\"" << twoattributes.match(2) << "\""
<< " " << twoattributes.match(3) << "=\"" << twoattributes.match(4) << "\""
<< " " << twoattributes.match(1) << "=\""
<< twoattributes.match(2) << "\""
<< " " << twoattributes.match(3) << "=\""
<< twoattributes.match(4) << "\""
<< "><Value>" << twoattributes.match(5)
<< "</Value></NamedMeasurement>"
<< std::endl;
cxml.erase(twoattributes.start(), twoattributes.end() - twoattributes.start());
cxml.erase(twoattributes.start(),
twoattributes.end() - twoattributes.start());
}
else if ( threeattributes.find(cxml) )
{
ostr
<< "\t\t\t<NamedMeasurement"
<< " " << threeattributes.match(1) << "=\"" << threeattributes.match(2) << "\""
<< " " << threeattributes.match(3) << "=\"" << threeattributes.match(4) << "\""
<< " " << threeattributes.match(5) << "=\"" << threeattributes.match(6) << "\""
<< " " << threeattributes.match(1) << "=\""
<< threeattributes.match(2) << "\""
<< " " << threeattributes.match(3) << "=\""
<< threeattributes.match(4) << "\""
<< " " << threeattributes.match(5) << "=\""
<< threeattributes.match(6) << "\""
<< "><Value>" << threeattributes.match(7)
<< "</Value></NamedMeasurement>"
<< std::endl;
cxml.erase(threeattributes.start(), threeattributes.end() - threeattributes.start());
cxml.erase(threeattributes.start(),
threeattributes.end() - threeattributes.start());
}
else if ( fourattributes.find(cxml) )
{
ostr
<< "\t\t\t<NamedMeasurement"
<< " " << fourattributes.match(1) << "=\"" << fourattributes.match(2) << "\""
<< " " << fourattributes.match(3) << "=\"" << fourattributes.match(4) << "\""
<< " " << fourattributes.match(5) << "=\"" << fourattributes.match(6) << "\""
<< " " << fourattributes.match(7) << "=\"" << fourattributes.match(8) << "\""
<< " " << fourattributes.match(1) << "=\""
<< fourattributes.match(2) << "\""
<< " " << fourattributes.match(3) << "=\""
<< fourattributes.match(4) << "\""
<< " " << fourattributes.match(5) << "=\""
<< fourattributes.match(6) << "\""
<< " " << fourattributes.match(7) << "=\""
<< fourattributes.match(8) << "\""
<< "><Value>" << fourattributes.match(9)
<< "</Value></NamedMeasurement>"
<< std::endl;
cxml.erase(fourattributes.start(), fourattributes.end() - fourattributes.start());
cxml.erase(fourattributes.start(),
fourattributes.end() - fourattributes.start());
}
else if ( measurementfile.find(cxml) )
{
@ -1376,15 +1420,19 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
);
unsigned char *file_buffer = new unsigned char [ len + 1 ];
ifs.read(reinterpret_cast<char*>(file_buffer), len);
unsigned char *encoded_buffer = new unsigned char [ static_cast<int>(len * 1.5 + 5) ];
unsigned char *encoded_buffer
= new unsigned char [ static_cast<int>(len * 1.5 + 5) ];
unsigned long rlen = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
unsigned long rlen
= cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
unsigned long cc;
ostr
<< "\t\t\t<NamedMeasurement"
<< " " << measurementfile.match(1) << "=\"" << measurementfile.match(2) << "\""
<< " " << measurementfile.match(3) << "=\"" << measurementfile.match(4) << "\""
<< " " << measurementfile.match(1) << "=\""
<< measurementfile.match(2) << "\""
<< " " << measurementfile.match(3) << "=\""
<< measurementfile.match(4) << "\""
<< " encoding=\"base64\""
<< ">" << std::endl << "\t\t\t\t<Value>";
for ( cc = 0; cc < rlen; cc ++ )
@ -1413,11 +1461,14 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
<< "\t\t\t<NamedMeasurement"
<< " name=\"" << measurementfile.match(idx) << "\""
<< " text=\"text/string\""
<< "><Value>File " << filename.c_str() << " not found</Value></NamedMeasurement>"
<< "><Value>File " << filename.c_str()
<< " not found</Value></NamedMeasurement>"
<< std::endl;
cmCTestLog(m_CTest, HANDLER_OUTPUT, "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());
cxml.erase(measurementfile.start(),
measurementfile.end() - measurementfile.start());
}
else
{
@ -1447,7 +1498,8 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
return;
}
this->TestsToRunString = in;
// if the argument is a file, then read it and use the contents as the string
// if the argument is a file, then read it and use the contents as the
// string
if(cmSystemTools::FileExists(in))
{
std::ifstream fin(in);
@ -1460,7 +1512,8 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
}
//----------------------------------------------------------------------
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t remove_threshold)
bool cmCTestTestHandler::CleanTestOutput(std::string& output,
size_t remove_threshold)
{
if ( remove_threshold == 0 )
{
@ -1512,7 +1565,8 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t remove_thre
}
if ( skipped )
{
ostr << "..." << std::endl << "The rest of the test output was removed since it exceeds the threshold of "
ostr << "..." << std::endl << "The rest of the test output was removed "
"since it exceeds the threshold of "
<< remove_threshold << " characters." << std::endl;
}
output = ostr.str();
@ -1520,7 +1574,8 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t remove_thre
}
//----------------------------------------------------------------------
bool cmCTestTestHandler::SetTestsProperties(const std::vector<std::string>& args)
bool cmCTestTestHandler::SetTestsProperties(
const std::vector<std::string>& args)
{
std::vector<std::string>::const_iterator it;
std::vector<cmStdString> tests;
@ -1567,7 +1622,8 @@ bool cmCTestTestHandler::SetTestsProperties(const std::vector<std::string>& args
std::vector<std::string>::iterator crit;
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
{
rtit->m_ErrorRegularExpressions.push_back(cmsys::RegularExpression(crit->c_str()));
rtit->m_ErrorRegularExpressions.push_back(
cmsys::RegularExpression(crit->c_str()));
}
}
if ( key == "PASS_REGULAR_EXPRESSION" )
@ -1577,7 +1633,8 @@ bool cmCTestTestHandler::SetTestsProperties(const std::vector<std::string>& args
std::vector<std::string>::iterator crit;
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
{
rtit->m_RequiredRegularExpressions.push_back(cmsys::RegularExpression(crit->c_str()));
rtit->m_RequiredRegularExpressions.push_back(
cmsys::RegularExpression(crit->c_str()));
}
}
}
@ -1612,7 +1669,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
if ( found )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: " << *it << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: "
<< *it << std::endl);
return true;
}
}
@ -1631,7 +1689,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
if ( found )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " << *it << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: "
<< *it << std::endl);
return true;
}
}
@ -1642,7 +1701,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.m_Directory = cmSystemTools::GetCurrentWorkingDirectory();
test.m_IsInBasedOnREOptions = true;
test.m_WillFail = false;
if (this->m_UseIncludeRegExp && !m_IncludeTestsRegularExpression.find(testname.c_str()))
if (this->m_UseIncludeRegExp &&
!m_IncludeTestsRegularExpression.find(testname.c_str()))
{
test.m_IsInBasedOnREOptions = false;
}

View File

@ -43,7 +43,8 @@ bool cmCTestUpdateCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
this->SetError("called with incorrect number of arguments. "
"RETURN_VALUE specified twice.");
return false;
}
havereturn_variable = true;
@ -52,7 +53,8 @@ bool cmCTestUpdateCommand::InitialPass(
{
if ( source_dir )
{
this->SetError("called with incorrect number of arguments. SOURCE specified twice.");
this->SetError("called with incorrect number of arguments. SOURCE "
"specified twice.");
return false;
}
havesource = true;
@ -60,20 +62,28 @@ bool cmCTestUpdateCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
}
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "UpdateCommand", "CTEST_UPDATE_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "UpdateOptions", "CTEST_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSCommand", "CTEST_CVS_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNCommand", "CTEST_SVN_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"UpdateCommand", "CTEST_UPDATE_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"UpdateOptions", "CTEST_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"CVSCommand", "CTEST_CVS_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"SVNCommand", "CTEST_SVN_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
const char* initialCheckoutCommand = m_Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
const char* initialCheckoutCommand
= m_Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
if ( !initialCheckoutCommand )
{
initialCheckoutCommand = m_Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
@ -95,14 +105,16 @@ bool cmCTestUpdateCommand::InitialPass(
{
handler->SetOption("InitialCheckout", initialCheckoutCommand);
}
if ( (!cmSystemTools::FileExists(source_dir) || !cmSystemTools::FileIsDirectory(source_dir))
if ( (!cmSystemTools::FileExists(source_dir) ||
!cmSystemTools::FileIsDirectory(source_dir))
&& !initialCheckoutCommand )
{
cmOStringStream str;
str << "cannot find source directory: " << source_dir << ".";
if ( !cmSystemTools::FileExists(source_dir) )
{
str << " Looks like it is not checked out yet. Please specify CTEST_CHECKOUT_COMMAND.";
str << " Looks like it is not checked out yet. Please specify "
"CTEST_CHECKOUT_COMMAND.";
}
this->SetError(str.str().c_str());
return false;

View File

@ -67,8 +67,8 @@ public:
{
return
" CTEST_UPDATE([SOURCE source] [RETURN_VALUE res])\n"
"Updates the given source directory and stores results in Update.xml. The "
"second argument is a variable that will hold the number of files "
"Updates the given source directory and stores results in Update.xml. "
"The second argument is a variable that will hold the number of files "
"modified. If there is a problem, the variable will be -1.";
}

View File

@ -48,7 +48,8 @@ static const char* cmCTestUpdateHandlerUpdateStrings[] =
static const char* cmCTestUpdateHandlerUpdateToString(int type)
{
if ( type < cmCTestUpdateHandler::e_UNKNOWN || type >= cmCTestUpdateHandler::e_LAST )
if ( type < cmCTestUpdateHandler::e_UNKNOWN ||
type >= cmCTestUpdateHandler::e_LAST )
{
return cmCTestUpdateHandlerUpdateStrings[cmCTestUpdateHandler::e_UNKNOWN];
}
@ -116,7 +117,8 @@ protected:
{
if ( strcmp(name, "logentry") == 0 )
{
cmCTestLog(m_UpdateHandler->GetCTestInstance(), HANDLER_VERBOSE_OUTPUT, "\tRevision: " << m_CommitLog.m_Revision<< 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);
@ -124,15 +126,18 @@ protected:
}
else if ( strcmp(name, "author") == 0 )
{
m_CommitLog.m_Author.assign(&(*(m_CharacterData.begin())), m_CharacterData.size());
m_CommitLog.m_Author.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
}
else if ( strcmp(name, "date") == 0 )
{
m_CommitLog.m_Date.assign(&(*(m_CharacterData.begin())), m_CharacterData.size());
m_CommitLog.m_Date.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
}
else if ( strcmp(name, "msg") == 0 )
{
m_CommitLog.m_Message.assign(&(*(m_CharacterData.begin())), m_CharacterData.size());
m_CommitLog.m_Message.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
}
m_CharacterData.erase(m_CharacterData.begin(), m_CharacterData.end());
}
@ -184,7 +189,8 @@ void cmCTestUpdateHandler::Initialize()
//----------------------------------------------------------------------
int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
{
cmCTestLog(m_CTest, DEBUG, "Determine update type from command: " << cmd << " and type: " << type << std::endl);
cmCTestLog(m_CTest, DEBUG, "Determine update type from command: " << cmd
<< " and type: " << type << std::endl);
if ( type && *type )
{
cmCTestLog(m_CTest, DEBUG, "Type specified: " << type << std::endl);
@ -200,7 +206,8 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
}
else
{
cmCTestLog(m_CTest, DEBUG, "Type not specified, check command: " << cmd << std::endl);
cmCTestLog(m_CTest, DEBUG, "Type not specified, check command: " << cmd
<< std::endl);
std::string stype = cmSystemTools::LowerCase(cmd);
if ( stype.find("cvs") != std::string::npos )
{
@ -212,7 +219,8 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
}
}
std::string sourceDirectory = this->GetOption("SourceDirectory");
cmCTestLog(m_CTest, DEBUG, "Check directory: " << sourceDirectory.c_str() << std::endl);
cmCTestLog(m_CTest, DEBUG, "Check directory: " << sourceDirectory.c_str()
<< std::endl);
sourceDirectory += "/.svn";
if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
{
@ -246,7 +254,9 @@ int cmCTestUpdateHandler::ProcessHandler()
const char* sourceDirectory = this->GetOption("SourceDirectory");
if ( !sourceDirectory )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find SourceDirectory key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
@ -261,39 +271,49 @@ int cmCTestUpdateHandler::ProcessHandler()
const char* initialCheckoutCommand = this->GetOption("InitialCheckout");
if ( initialCheckoutCommand )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " First perform the initil checkout: " << initialCheckoutCommand << std::endl);
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);
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);
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);
"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);
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 << "]";
ostr << "Problem running initial checkout Output [" << goutput
<< "] Errors [" << errors << "]";
cmCTestLog(m_CTest, ERROR_MESSAGE, 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);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Updating the repository: "
<< sourceDirectory << std::endl);
// Get update command
std::string updateCommand = m_CTest->GetCTestConfiguration("UpdateCommand");
@ -305,7 +325,9 @@ int cmCTestUpdateHandler::ProcessHandler()
updateCommand = m_CTest->GetCTestConfiguration("SVNCommand");
if ( updateCommand.empty() )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the "
"DartConfiguration.tcl" << std::endl);
return -1;
}
else
@ -320,10 +342,13 @@ int cmCTestUpdateHandler::ProcessHandler()
}
else
{
updateType = this->DetermineType(updateCommand.c_str(), m_CTest->GetCTestConfiguration("UpdateType").c_str());
updateType = this->DetermineType(updateCommand.c_str(),
m_CTest->GetCTestConfiguration("UpdateType").c_str());
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use " << cmCTestUpdateHandlerUpdateToString(updateType) << " repository type" << std::endl;);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use "
<< cmCTestUpdateHandlerUpdateToString(updateType) << " repository type"
<< std::endl;);
// And update options
std::string updateOptions = m_CTest->GetCTestConfiguration("UpdateOptions");
@ -348,7 +373,8 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string extra_update_opts;
if ( m_CTest->GetTestModel() == cmCTest::NIGHTLY )
{
struct tm* t = m_CTest->GetNightlyTime(m_CTest->GetCTestConfiguration("NightlyStartTime"),
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",
@ -396,11 +422,13 @@ int cmCTestUpdateHandler::ProcessHandler()
//
// Get initial repository information if that is possible. With subversion, this will check the current revision.
// Get initial repository information if that is possible. With subversion,
// this will check the current revision.
//
if ( !command.empty() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* 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() )
{
ofs << "* Get repository information" << std::endl;
@ -422,12 +450,16 @@ int cmCTestUpdateHandler::ProcessHandler()
break;
case cmCTestUpdateHandler::e_SVN:
{
cmsys::RegularExpression current_revision_regex("Revision: ([0-9]+)");
cmsys::RegularExpression current_revision_regex(
"Revision: ([0-9]+)");
if ( current_revision_regex.find(goutput.c_str()) )
{
std::string currentRevisionString = current_revision_regex.match(1);
std::string currentRevisionString
= current_revision_regex.match(1);
svn_current_revision = atoi(currentRevisionString.c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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;
@ -435,7 +467,8 @@ int cmCTestUpdateHandler::ProcessHandler()
}
else
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Update with command: " << command << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"Update with command: " << command << std::endl);
}
}
@ -451,7 +484,8 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string start_time = m_CTest->CurrentTime();
double elapsed_time_start = cmSystemTools::GetTime();
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* 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 = "";
@ -474,7 +508,8 @@ int cmCTestUpdateHandler::ProcessHandler()
" " + extra_update_opts;
ofs << "* Update repository: " << std::endl;
ofs << " Command: " << command.c_str() << std::endl;
bool res1 = m_CTest->RunCommand(command.c_str(), &partialOutput, &errors,
bool res1 = m_CTest->RunCommand(command.c_str(), &partialOutput,
&errors,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
ofs << " Output: " << partialOutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
@ -494,7 +529,7 @@ int cmCTestUpdateHandler::ProcessHandler()
if ( ofs )
{
ofs << "--- Update repository ---" << std::endl;
ofs << goutput << std::endl;;
ofs << goutput << std::endl;
}
}
if ( !res || retVal )
@ -514,10 +549,12 @@ int cmCTestUpdateHandler::ProcessHandler()
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<UpdateCommand>" << m_CTest->MakeXMLSafe(command)
<< "</UpdateCommand>\n"
<< "\t<UpdateType>" << m_CTest->MakeXMLSafe(cmCTestUpdateHandlerUpdateToString(updateType))
<< "\t<UpdateType>" << m_CTest->MakeXMLSafe(
cmCTestUpdateHandlerUpdateToString(updateType))
<< "</UpdateType>\n";
// Even though it failed, we may have some useful information. Try to continue...
// Even though it failed, we may have some useful information. Try to
// continue...
std::vector<cmStdString> lines;
cmSystemTools::Split(goutput.c_str(), lines);
std::vector<cmStdString> errLines;
@ -525,16 +562,23 @@ int cmCTestUpdateHandler::ProcessHandler()
lines.insert(lines.end(), errLines.begin(), errLines.end());
// CVS style regular expressions
cmsys::RegularExpression cvs_date_author_regex("^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
cmsys::RegularExpression cvs_date_author_regex(
"^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
cmsys::RegularExpression cvs_revision_regex("^revision +([^ ]*) *$");
cmsys::RegularExpression cvs_end_of_file_regex("^=============================================================================$");
cmsys::RegularExpression cvs_end_of_comment_regex("^----------------------------$");
cmsys::RegularExpression cvs_end_of_file_regex(
"^=========================================="
"===================================$");
cmsys::RegularExpression cvs_end_of_comment_regex(
"^----------------------------$");
// Subversion style regular expressions
cmsys::RegularExpression svn_status_line_regex("^ *([0-9]+) *([0-9]+) *([^ ]+) *([^ ][^\t\r\n]*)[ \t\r\n]*$");
cmsys::RegularExpression svn_latest_revision_regex("(Updated to|At) revision ([0-9]+)\\.");
cmsys::RegularExpression svn_status_line_regex(
"^ *([0-9]+) *([0-9]+) *([^ ]+) *([^ ][^\t\r\n]*)[ \t\r\n]*$");
cmsys::RegularExpression svn_latest_revision_regex(
"(Updated to|At) revision ([0-9]+)\\.");
cmsys::RegularExpression file_removed_line("cvs update: `(.*)' is no longer in the repository");
cmsys::RegularExpression file_removed_line(
"cvs update: `(.*)' is no longer in the repository");
cmsys::RegularExpression file_update_line("([A-Z]) *(.*)");
std::string current_path = "<no-path>";
bool first_file = true;
@ -546,28 +590,35 @@ int cmCTestUpdateHandler::ProcessHandler()
// In subversion, get the latest revision
if ( updateType == cmCTestUpdateHandler::e_SVN )
{
for ( cc= 0 ; cc < lines.size(); cc ++ )
for ( cc= 0; cc < lines.size(); cc ++ )
{
const char* line = lines[cc].c_str();
if ( svn_latest_revision_regex.find(line) )
{
svn_latest_revision = atoi(svn_latest_revision_regex.match(2).c_str());
svn_latest_revision = atoi(
svn_latest_revision_regex.match(2).c_str());
}
}
if ( svn_latest_revision <= 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem determining the current revision of the repository from output:" << std::endl << goutput.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem determining the current "
"revision of the repository from output:" << std::endl
<< goutput.c_str() << std::endl);
}
else
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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);
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " 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;
std::string removed_line;
for ( cc= 0 ; cc < lines.size(); cc ++ )
for ( cc= 0; cc < lines.size(); cc ++ )
{
const char* line = lines[cc].c_str();
if ( file_removed_line.find(line) )
@ -596,7 +647,8 @@ int cmCTestUpdateHandler::ProcessHandler()
modifiedOrConflict = true;
}
const char* file = upFile.c_str();
cmCTestLog(m_CTest, DEBUG, "Line" << cc << ": " << mod << " - " << file << std::endl);
cmCTestLog(m_CTest, DEBUG, "Line" << cc << ": " << mod << " - "
<< file << std::endl);
std::string output;
if ( modifiedOrConflict )
@ -608,22 +660,27 @@ int cmCTestUpdateHandler::ProcessHandler()
logcommand = updateCommand + " -z3 log -N \"" + file + "\"";
break;
case cmCTestUpdateHandler::e_SVN:
if ( svn_latest_revision > 0 && svn_latest_revision > svn_current_revision )
if ( svn_latest_revision > 0 &&
svn_latest_revision > svn_current_revision )
{
cmOStringStream logCommandStream;
logCommandStream << updateCommand << " log -r " << svn_current_revision << ":" << svn_latest_revision
logCommandStream << updateCommand << " log -r "
<< svn_current_revision << ":" << svn_latest_revision
<< " --xml \"" << file << "\"";
logcommand = logCommandStream.str();
}
else
{
logcommand = updateCommand + " status --verbose \"" + file + "\"";
logcommand = updateCommand +
" status --verbose \"" + file + "\"";
svn_use_status = 1;
}
break;
}
cmCTestLog(m_CTest, DEBUG, "Do log: " << logcommand << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* Get file update information: " << logcommand.c_str() << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
"* Get file update information: " << logcommand.c_str()
<< std::endl);
ofs << "* Get log information for file: " << file << std::endl;
ofs << " Command: " << logcommand.c_str() << std::endl;
res = m_CTest->RunCommand(logcommand.c_str(), &output, &errors,
@ -669,7 +726,8 @@ int cmCTestUpdateHandler::ProcessHandler()
srevision2 = cvs_revision_regex.match(1);
}
}
else if ( !have_second && !sline && cvs_date_author_regex.find(clp) )
else if ( !have_second && !sline &&
cvs_date_author_regex.find(clp) )
{
sline = kk + 1;
if ( !have_first )
@ -683,7 +741,8 @@ int cmCTestUpdateHandler::ProcessHandler()
sauthor2 = cvs_date_author_regex.match(2);
}
}
else if ( sline && cvs_end_of_comment_regex.find(clp) || cvs_end_of_file_regex.find(clp))
else if ( sline && cvs_end_of_comment_regex.find(clp) ||
cvs_end_of_file_regex.find(clp))
{
if ( !have_first )
{
@ -719,16 +778,24 @@ int cmCTestUpdateHandler::ProcessHandler()
srevision1 = str.str();
if (!svn_status_line_regex.find(output))
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Bad output from SVN status command: " << output << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Bad output from SVN status command: " << output
<< std::endl);
}
else if ( svn_status_line_regex.match(4) != file )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "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_MESSAGE,
"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
{
srevision1 = svn_status_line_regex.match(2);
int latest_revision = atoi(svn_status_line_regex.match(2).c_str());
int latest_revision = atoi(
svn_status_line_regex.match(2).c_str());
if ( svn_current_revision < latest_revision )
{
srevision2 = str.str();
@ -743,7 +810,8 @@ int cmCTestUpdateHandler::ProcessHandler()
{
int minrev = parser.GetMinRevision();
int maxrev = parser.GetMaxRevision();
cmCTestUpdateHandlerSVNXMLParser::t_VectorOfCommits::iterator it;
cmCTestUpdateHandlerSVNXMLParser::
t_VectorOfCommits::iterator it;
for ( it = parser.GetCommits()->begin();
it != parser.GetCommits()->end();
++ it )
@ -823,14 +891,18 @@ int cmCTestUpdateHandler::ProcessHandler()
{
srevision2 = srevision1;
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: " << path.c_str() << " / " << fname.c_str() << " was updated by "
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)
os << "\t\t<File Directory=\"" << cmCTest::MakeXMLSafe(path) << "\">"
<< cmCTest::MakeXMLSafe(fname)
<< "</File>\n"
<< "\t\t<Directory>" << cmCTest::MakeXMLSafe(path) << "</Directory>\n"
<< "\t\t<Directory>" << cmCTest::MakeXMLSafe(path)
<< "</Directory>\n"
<< "\t\t<FullName>" << cmCTest::MakeXMLSafe(file) << "</FullName>\n"
<< "\t\t<CheckinDate>" << cmCTest::MakeXMLSafe(sdate1) << "</CheckinDate>\n"
<< "\t\t<CheckinDate>" << cmCTest::MakeXMLSafe(sdate1)
<< "</CheckinDate>\n"
<< "\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor1) << "</Author>\n"
<< "\t\t<Email>" << cmCTest::MakeXMLSafe(semail1) << "</Email>\n"
<< "\t\t<Log>" << cmCTest::MakeXMLSafe(comment1) << "</Log>\n"
@ -842,19 +914,29 @@ int cmCTestUpdateHandler::ProcessHandler()
os
<< "\t\t<Revisions>\n"
<< "\t\t\t<Revision>" << srevision1 << "</Revision>\n"
<< "\t\t\t<PreviousRevision>" << srevision2 << "</PreviousRevision>\n"
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor1) << "</Author>\n"
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate1) << "</Date>\n"
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment1) << "</Comment>\n"
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail1) << "</Email>\n"
<< "\t\t\t<PreviousRevision>" << srevision2
<< "</PreviousRevision>\n"
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor1)
<< "</Author>\n"
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate1)
<< "</Date>\n"
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment1)
<< "</Comment>\n"
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail1)
<< "</Email>\n"
<< "\t\t</Revisions>\n"
<< "\t\t<Revisions>\n"
<< "\t\t\t<Revision>" << srevision2 << "</Revision>\n"
<< "\t\t\t<PreviousRevision>" << srevision2 << "</PreviousRevision>\n"
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor2) << "</Author>\n"
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate2) << "</Date>\n"
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment2) << "</Comment>\n"
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail2) << "</Email>\n"
<< "\t\t\t<PreviousRevision>" << srevision2
<< "</PreviousRevision>\n"
<< "\t\t\t<Author>" << cmCTest::MakeXMLSafe(sauthor2)
<< "</Author>\n"
<< "\t\t\t<Date>" << cmCTest::MakeXMLSafe(sdate2)
<< "</Date>\n"
<< "\t\t\t<Comment>" << cmCTest::MakeXMLSafe(comment2)
<< "</Comment>\n"
<< "\t\t\t<Email>" << cmCTest::MakeXMLSafe(semail2)
<< "</Email>\n"
<< "\t\t</Revisions>" << std::endl;
}
if ( mod == 'C' )
@ -890,21 +972,25 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( num_updated )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_updated << " updated files" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_updated
<< " updated files" << std::endl);
}
if ( num_modified )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_modified << " locally modified files"
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_modified
<< " locally modified files"
<< std::endl);
}
if ( num_conflicting )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_conflicting << " conflicting files"
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_conflicting
<< " conflicting files"
<< std::endl);
}
if ( num_modified == 0 && num_conflicting == 0 && num_updated == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Project is up-to-date" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Project is up-to-date"
<< std::endl);
}
if ( !first_file )
{
@ -936,21 +1022,26 @@ int cmCTestUpdateHandler::ProcessHandler()
<< "\t<UpdateReturnStatus>";
if ( num_modified > 0 || num_conflicting > 0 )
{
os << "Update error: There are modified or conflicting files in the repository";
cmCTestLog(m_CTest, ERROR_MESSAGE, " There are modified or conflicting files in the repository" << std::endl);
os << "Update error: There are modified or conflicting files in the "
"repository";
cmCTestLog(m_CTest, ERROR_MESSAGE,
" There are modified or conflicting files in the repository"
<< std::endl);
}
if ( updateProducedError )
{
os << "Update error: ";
os << m_CTest->MakeXMLSafe(checkoutErrorMessages);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Update with command: " << command << " failed" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Update with command: " << command
<< " failed" << std::endl);
}
os << "</UpdateReturnStatus>" << std::endl;
os << "</Update>" << std::endl;
if (! res || retVal )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project"
<< std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Output: " << goutput << std::endl);
return -1;
}