STYLE: Fix some style issues

This commit is contained in:
Andy Cedilnik 2006-03-10 15:03:09 -05:00
parent c0161e9e57
commit 862f5df25c
45 changed files with 1788 additions and 1708 deletions

View File

@ -26,30 +26,31 @@
//----------------------------------------------------------------------
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
{
m_BuildTwoConfig = false;
m_BuildNoClean = false;
m_BuildNoCMake = false;
this->BuildTwoConfig = false;
this->BuildNoClean = false;
this->BuildNoCMake = false;
}
//----------------------------------------------------------------------
void cmCTestBuildAndTestHandler::Initialize()
{
m_BuildTargets.erase(m_BuildTargets.begin(), m_BuildTargets.end());
this->BuildTargets.erase(
this->BuildTargets.begin(), this->BuildTargets.end());
this->Superclass::Initialize();
}
//----------------------------------------------------------------------
const char* cmCTestBuildAndTestHandler::GetOutput()
{
return m_Output.c_str();
return this->Output.c_str();
}
//----------------------------------------------------------------------
int cmCTestBuildAndTestHandler::ProcessHandler()
{
m_Output = "";
this->Output = "";
std::string output;
cmSystemTools::ResetErrorOccuredFlag();
int retv = this->RunCMakeAndTest(&m_Output);
int retv = this->RunCMakeAndTest(&this->Output);
cmSystemTools::ResetErrorOccuredFlag();
return retv;
}
@ -61,24 +62,24 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
{
unsigned int k;
std::vector<std::string> args;
args.push_back(m_CTest->GetCMakeExecutable());
args.push_back(m_SourceDir);
if(m_BuildGenerator.size())
args.push_back(this->CTest->GetCMakeExecutable());
args.push_back(this->SourceDir);
if(this->BuildGenerator.size())
{
std::string generator = "-G";
generator += m_BuildGenerator;
generator += this->BuildGenerator;
args.push_back(generator);
}
if ( m_CTest->GetConfigType().size() > 0 )
if ( this->CTest->GetConfigType().size() > 0 )
{
std::string btype
= "-DCMAKE_BUILD_TYPE:STRING=" + m_CTest->GetConfigType();
= "-DCMAKE_BUILD_TYPE:STRING=" + this->CTest->GetConfigType();
args.push_back(btype);
}
for(k=0; k < m_BuildOptions.size(); ++k)
for(k=0; k < this->BuildOptions.size(); ++k)
{
args.push_back(m_BuildOptions[k]);
args.push_back(this->BuildOptions[k]);
}
if (cm->Run(args) != 0)
{
@ -92,12 +93,12 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, out.str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
}
return 1;
}
// do another config?
if(m_BuildTwoConfig)
if(this->BuildTwoConfig)
{
if (cm->Run(args) != 0)
{
@ -111,7 +112,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, out.str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
}
return 1;
}
@ -142,11 +143,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &cmakeOutString);
cmSystemTools::SetStdoutCallback(CMakeStdoutCallback, &cmakeOutString);
cmOStringStream out;
// What is this? double timeout = m_CTest->GetTimeOut();
// What is this? double timeout = this->CTest->GetTimeOut();
int retVal = 0;
// if the generator and make program are not specified then it is an error
if (!m_BuildGenerator.size() || !m_BuildMakeProgram.size())
if (!this->BuildGenerator.size() || !this->BuildMakeProgram.size())
{
if(outstring)
{
@ -160,18 +161,20 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// make sure the binary dir is there
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
out << "Internal cmake changing into directory: " << m_BinaryDir << "\n";
if (!cmSystemTools::FileIsDirectory(m_BinaryDir.c_str()))
out << "Internal cmake changing into directory: "
<< this->BinaryDir << std::endl;
if (!cmSystemTools::FileIsDirectory(this->BinaryDir.c_str()))
{
cmSystemTools::MakeDirectory(m_BinaryDir.c_str());
cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
}
cmSystemTools::ChangeDirectory(m_BinaryDir.c_str());
cmSystemTools::ChangeDirectory(this->BinaryDir.c_str());
// should we cmake?
cmake cm;
cm.SetGlobalGenerator(cm.CreateGlobalGenerator(m_BuildGenerator.c_str()));
cm.SetGlobalGenerator(cm.CreateGlobalGenerator(
this->BuildGenerator.c_str()));
if(!m_BuildNoCMake)
if(!this->BuildNoCMake)
{
// do the cmake step
if (this->RunCMake(outstring,out,cmakeOutString,cwd,&cm))
@ -182,19 +185,19 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// do the build
std::vector<std::string>::iterator tarIt;
if ( m_BuildTargets.size() == 0 )
if ( this->BuildTargets.size() == 0 )
{
m_BuildTargets.push_back("");
this->BuildTargets.push_back("");
}
for ( tarIt = m_BuildTargets.begin(); tarIt != m_BuildTargets.end();
for ( tarIt = this->BuildTargets.begin(); tarIt != this->BuildTargets.end();
++ tarIt )
{
std::string output;
retVal = cm.GetGlobalGenerator()->Build(
m_SourceDir.c_str(), m_BinaryDir.c_str(),
m_BuildProject.c_str(), tarIt->c_str(),
&output, m_BuildMakeProgram.c_str(),
m_CTest->GetConfigType().c_str(),!m_BuildNoClean);
this->SourceDir.c_str(), this->BinaryDir.c_str(),
this->BuildProject.c_str(), tarIt->c_str(),
&output, this->BuildMakeProgram.c_str(),
this->CTest->GetConfigType().c_str(),!this->BuildNoClean);
out << output;
// if the build failed then return
@ -213,7 +216,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
// if not test was specified then we are done
if (!m_TestCommand.size())
if (!this->TestCommand.size())
{
return 0;
}
@ -223,9 +226,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::vector<std::string> failed;
std::string tempPath;
std::string filepath =
cmSystemTools::GetFilenamePath(m_TestCommand);
cmSystemTools::GetFilenamePath(this->TestCommand);
std::string filename =
cmSystemTools::GetFilenameName(m_TestCommand);
cmSystemTools::GetFilenameName(this->TestCommand);
// if full path specified then search that first
if (filepath.size())
{
@ -233,17 +236,17 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
tempPath += "/";
tempPath += filename;
attempted.push_back(tempPath);
if(m_CTest->GetConfigType().size())
if(this->CTest->GetConfigType().size())
{
tempPath = filepath;
tempPath += "/";
tempPath += m_CTest->GetConfigType();
tempPath += this->CTest->GetConfigType();
tempPath += "/";
tempPath += filename;
attempted.push_back(tempPath);
// If the file is an OSX bundle then the configtyp
// will be at the start of the path
tempPath = m_CTest->GetConfigType();
tempPath = this->CTest->GetConfigType();
tempPath += "/";
tempPath += filepath;
tempPath += "/";
@ -255,26 +258,26 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
else
{
attempted.push_back(filename);
if(m_CTest->GetConfigType().size())
if(this->CTest->GetConfigType().size())
{
tempPath = m_CTest->GetConfigType();
tempPath = this->CTest->GetConfigType();
tempPath += "/";
tempPath += filename;
attempted.push_back(tempPath);
}
}
// if m_ExecutableDirectory is set try that as well
if (m_ExecutableDirectory.size())
// if this->ExecutableDirectory is set try that as well
if (this->ExecutableDirectory.size())
{
tempPath = m_ExecutableDirectory;
tempPath = this->ExecutableDirectory;
tempPath += "/";
tempPath += m_TestCommand;
tempPath += this->TestCommand;
attempted.push_back(tempPath);
if(m_CTest->GetConfigType().size())
if(this->CTest->GetConfigType().size())
{
tempPath = m_ExecutableDirectory;
tempPath = this->ExecutableDirectory;
tempPath += "/";
tempPath += m_CTest->GetConfigType();
tempPath += this->CTest->GetConfigType();
tempPath += "/";
tempPath += filename;
attempted.push_back(tempPath);
@ -314,8 +317,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
if(!cmSystemTools::FileExists(fullPath.c_str()))
{
out << "Could not find path to executable, perhaps it was not built: " <<
m_TestCommand << "\n";
out << "Could not find path to executable, perhaps it was not built: "
<< this->TestCommand << "\n";
out << "tried to find it in these places:\n";
out << fullPath.c_str() << "\n";
for(unsigned int i=0; i < failed.size(); ++i)
@ -328,7 +331,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, out.str());
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str());
}
// return to the original directory
cmSystemTools::ChangeDirectory(cwd.c_str());
@ -337,27 +340,27 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::vector<const char*> testCommand;
testCommand.push_back(fullPath.c_str());
for(k=0; k < m_TestCommandArgs.size(); ++k)
for(k=0; k < this->TestCommandArgs.size(); ++k)
{
testCommand.push_back(m_TestCommandArgs[k].c_str());
testCommand.push_back(this->TestCommandArgs[k].c_str());
}
testCommand.push_back(0);
std::string outs;
int retval = 0;
// run the test from the m_BuildRunDir if set
if(m_BuildRunDir.size())
// run the test from the this->BuildRunDir if set
if(this->BuildRunDir.size())
{
out << "Run test in directory: " << m_BuildRunDir << "\n";
cmSystemTools::ChangeDirectory(m_BuildRunDir.c_str());
out << "Run test in directory: " << this->BuildRunDir << "\n";
cmSystemTools::ChangeDirectory(this->BuildRunDir.c_str());
}
out << "Running test executable: " << fullPath << " ";
for(k=0; k < m_TestCommandArgs.size(); ++k)
for(k=0; k < this->TestCommandArgs.size(); ++k)
{
out << m_TestCommandArgs[k] << " ";
out << this->TestCommandArgs[k] << " ";
}
out << "\n";
// What is this? m_TimeOut = timeout;
int runTestRes = m_CTest->RunTest(testCommand, &outs, &retval, 0);
// What is this? this->TimeOut = timeout;
int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0);
if(runTestRes != cmsysProcess_State_Exited || retval != 0)
{
out << "Failed to run test command: " << testCommand[0] << "\n";
@ -371,7 +374,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
else
{
cmCTestLog(m_CTest, OUTPUT, out.str() << std::endl);
cmCTestLog(this->CTest, OUTPUT, out.str() << std::endl);
}
return retval;
}
@ -387,17 +390,19 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
if(idx+2 < allArgs.size())
{
idx++;
m_SourceDir = allArgs[idx];
this->SourceDir = allArgs[idx];
idx++;
m_BinaryDir = allArgs[idx];
this->BinaryDir = allArgs[idx];
// dir must exist before CollapseFullPath is called
cmSystemTools::MakeDirectory(m_BinaryDir.c_str());
m_BinaryDir = cmSystemTools::CollapseFullPath(m_BinaryDir.c_str());
m_SourceDir = cmSystemTools::CollapseFullPath(m_SourceDir.c_str());
cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
this->BinaryDir
= cmSystemTools::CollapseFullPath(this->BinaryDir.c_str());
this->SourceDir
= cmSystemTools::CollapseFullPath(this->SourceDir.c_str());
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"--build-and-test must have source and binary dir" << std::endl);
return 0;
}
@ -405,45 +410,45 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
if(currentArg.find("--build-target",0) == 0 && idx < allArgs.size() - 1)
{
idx++;
m_BuildTargets.push_back(allArgs[idx]);
this->BuildTargets.push_back(allArgs[idx]);
}
if(currentArg.find("--build-nocmake",0) == 0)
{
m_BuildNoCMake = true;
this->BuildNoCMake = true;
}
if(currentArg.find("--build-run-dir",0) == 0 && idx < allArgs.size() - 1)
{
idx++;
m_BuildRunDir = allArgs[idx];
this->BuildRunDir = allArgs[idx];
}
if(currentArg.find("--build-two-config",0) == 0)
{
m_BuildTwoConfig = true;
this->BuildTwoConfig = true;
}
if(currentArg.find("--build-exe-dir",0) == 0 && idx < allArgs.size() - 1)
{
idx++;
m_ExecutableDirectory = allArgs[idx];
this->ExecutableDirectory = allArgs[idx];
}
if(currentArg.find("--build-generator",0) == 0 && idx < allArgs.size() - 1)
{
idx++;
m_BuildGenerator = allArgs[idx];
this->BuildGenerator = allArgs[idx];
}
if(currentArg.find("--build-project",0) == 0 && idx < allArgs.size() - 1)
{
idx++;
m_BuildProject = allArgs[idx];
this->BuildProject = allArgs[idx];
}
if(currentArg.find("--build-makeprogram",0) == 0 &&
idx < allArgs.size() - 1)
{
idx++;
m_BuildMakeProgram = allArgs[idx];
this->BuildMakeProgram = allArgs[idx];
}
if(currentArg.find("--build-noclean",0) == 0)
{
m_BuildNoClean = true;
this->BuildNoClean = true;
}
if(currentArg.find("--build-options",0) == 0 && idx < allArgs.size() - 1)
{
@ -451,7 +456,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
bool done = false;
while(idx < allArgs.size() && !done)
{
m_BuildOptions.push_back(allArgs[idx]);
this->BuildOptions.push_back(allArgs[idx]);
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" ||
allArgs[idx+1] == "--test-command"))
@ -467,11 +472,11 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
if(currentArg.find("--test-command",0) == 0 && idx < allArgs.size() - 1)
{
++idx;
m_TestCommand = allArgs[idx];
this->TestCommand = allArgs[idx];
while(idx+1 < allArgs.size())
{
++idx;
m_TestCommandArgs.push_back(allArgs[idx]);
this->TestCommandArgs.push_back(allArgs[idx]);
}
}
return 1;

View File

@ -59,22 +59,22 @@ protected:
std::string &cmakeOutString,
std::string &cwd, cmake *cm);
cmStdString m_Output;
cmStdString Output;
std::string m_BuildGenerator;
std::vector<std::string> m_BuildOptions;
bool m_BuildTwoConfig;
std::string m_BuildMakeProgram;
std::string m_SourceDir;
std::string m_BinaryDir;
std::string m_BuildProject;
std::string m_TestCommand;
bool m_BuildNoClean;
std::string m_BuildRunDir;
std::string m_ExecutableDirectory;
std::vector<std::string> m_TestCommandArgs;
std::vector<std::string> m_BuildTargets;
bool m_BuildNoCMake;
std::string BuildGenerator;
std::vector<std::string> BuildOptions;
bool BuildTwoConfig;
std::string BuildMakeProgram;
std::string SourceDir;
std::string BinaryDir;
std::string BuildProject;
std::string TestCommand;
bool BuildNoClean;
std::string BuildRunDir;
std::string ExecutableDirectory;
std::vector<std::string> TestCommandArgs;
std::vector<std::string> BuildTargets;
bool BuildNoCMake;
};
#endif

View File

@ -25,16 +25,16 @@
//----------------------------------------------------------------------------
cmCTestBuildCommand::cmCTestBuildCommand()
{
m_GlobalGenerator = 0;
this->GlobalGenerator = 0;
}
//----------------------------------------------------------------------------
cmCTestBuildCommand::~cmCTestBuildCommand()
{
if ( m_GlobalGenerator )
if ( this->GlobalGenerator )
{
delete m_GlobalGenerator;
m_GlobalGenerator = 0;
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
}
}
@ -91,10 +91,11 @@ bool cmCTestBuildCommand::InitialPass(
if ( build_dir )
{
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
}
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("build");
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("build");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate build handler");
@ -105,7 +106,7 @@ bool cmCTestBuildCommand::InitialPass(
= m_Makefile->GetDefinition("CTEST_BUILD_COMMAND");
if ( ctestBuildCommand && *ctestBuildCommand )
{
m_CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand);
this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand);
}
else
{
@ -124,28 +125,29 @@ bool cmCTestBuildCommand::InitialPass(
{
cmakeBuildConfiguration = "Release";
}
if ( m_GlobalGenerator )
if ( this->GlobalGenerator )
{
if ( strcmp(m_GlobalGenerator->GetName(), cmakeGeneratorName) != 0 )
if ( strcmp(this->GlobalGenerator->GetName(),
cmakeGeneratorName) != 0 )
{
delete m_GlobalGenerator;
m_GlobalGenerator = 0;
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
}
}
if ( !m_GlobalGenerator )
if ( !this->GlobalGenerator )
{
m_GlobalGenerator =
this->GlobalGenerator =
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGeneratorName);
}
m_GlobalGenerator->FindMakeProgram(m_Makefile);
this->GlobalGenerator->FindMakeProgram(m_Makefile);
const char* cmakeMakeProgram
= m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram,
= this->GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram,
cmakeProjectName,
cmakeBuildAdditionalFlags, 0, cmakeBuildConfiguration, true);
m_CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str());
this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str());
}
else
{

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -32,15 +32,15 @@ public:
cmCTestBuildCommand();
~cmCTestBuildCommand();
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
virtual cmCommand* Clone()
{
cmCTestBuildCommand* ni = new cmCTestBuildCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}
@ -58,11 +58,11 @@ public:
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
virtual const char* GetTerseDocumentation()
{
return "Builds the repository.";
}
/**
* More documentation.
*/
@ -75,7 +75,7 @@ public:
cmTypeMacro(cmCTestBuildCommand, cmCTestCommand);
cmGlobalGenerator* m_GlobalGenerator;
cmGlobalGenerator* GlobalGenerator;
};

View File

@ -146,9 +146,9 @@ static const char* cmCTestWarningExceptions[] = {
struct cmCTestBuildCompileErrorWarningRex
{
const char* m_RegularExpressionString;
int m_FileIndex;
int m_LineIndex;
const char* RegularExpressionString;
int FileIndex;
int LineIndex;
};
static cmCTestBuildCompileErrorWarningRex
@ -165,13 +165,13 @@ cmCTestWarningErrorFileLine[] = {
//----------------------------------------------------------------------
cmCTestBuildHandler::cmCTestBuildHandler()
{
m_MaxPreContext = 6;
m_MaxPostContext = 6;
this->MaxPreContext = 6;
this->MaxPostContext = 6;
m_MaxErrors = 50;
m_MaxWarnings = 50;
this->MaxErrors = 50;
this->MaxWarnings = 50;
m_LastErrorOrWarning = m_ErrorsAndWarnings.end();
this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
}
@ -179,61 +179,61 @@ cmCTestBuildHandler::cmCTestBuildHandler()
void cmCTestBuildHandler::Initialize()
{
this->Superclass::Initialize();
m_StartBuild = "";
m_EndBuild = "";
m_CustomErrorMatches.clear();
m_CustomErrorExceptions.clear();
m_CustomWarningMatches.clear();
m_CustomWarningExceptions.clear();
m_ErrorWarningFileLineRegex.clear();
this->StartBuild = "";
this->EndBuild = "";
this->CustomErrorMatches.clear();
this->CustomErrorExceptions.clear();
this->CustomWarningMatches.clear();
this->CustomWarningExceptions.clear();
this->ErrorWarningFileLineRegex.clear();
m_ErrorMatchRegex.clear();
m_ErrorExceptionRegex.clear();
m_WarningMatchRegex.clear();
m_WarningExceptionRegex.clear();
m_BuildProcessingQueue.clear();
m_BuildProcessingErrorQueue.clear();
m_BuildOutputLogSize = 0;
m_CurrentProcessingLine.clear();
this->ErrorMatchRegex.clear();
this->ErrorExceptionRegex.clear();
this->WarningMatchRegex.clear();
this->WarningExceptionRegex.clear();
this->BuildProcessingQueue.clear();
this->BuildProcessingErrorQueue.clear();
this->BuildOutputLogSize = 0;
this->CurrentProcessingLine.clear();
m_SimplifySourceDir = "";
m_SimplifyBuildDir = "";
m_OutputLineCounter = 0;
m_ErrorsAndWarnings.clear();
m_LastErrorOrWarning = m_ErrorsAndWarnings.end();
m_PostContextCount = 0;
m_MaxPreContext = 6;
m_MaxPostContext = 6;
m_PreContext.clear();
this->SimplifySourceDir = "";
this->SimplifyBuildDir = "";
this->OutputLineCounter = 0;
this->ErrorsAndWarnings.clear();
this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
this->PostContextCount = 0;
this->MaxPreContext = 6;
this->MaxPostContext = 6;
this->PreContext.clear();
m_TotalErrors = 0;
m_TotalWarnings = 0;
m_LastTickChar = 0;
this->TotalErrors = 0;
this->TotalWarnings = 0;
this->LastTickChar = 0;
m_ErrorQuotaReached = false;
m_WarningQuotaReached = false;
this->ErrorQuotaReached = false;
this->WarningQuotaReached = false;
m_MaxErrors = 50;
m_MaxWarnings = 50;
this->MaxErrors = 50;
this->MaxWarnings = 50;
}
//----------------------------------------------------------------------
void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf)
{
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_MATCH",
m_CustomErrorMatches);
this->CustomErrorMatches);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_EXCEPTION",
m_CustomErrorExceptions);
this->CustomErrorExceptions);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_MATCH",
m_CustomWarningMatches);
this->CustomWarningMatches);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_EXCEPTION",
m_CustomWarningExceptions);
this->CustomWarningExceptions);
cmCTest::PopulateCustomInteger(mf,
"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS",
m_MaxErrors);
this->MaxErrors);
cmCTest::PopulateCustomInteger(mf,
"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS",
m_MaxWarnings);
this->MaxWarnings);
}
//----------------------------------------------------------------------
@ -241,45 +241,45 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf)
//functions and commented...
int cmCTestBuildHandler::ProcessHandler()
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl);
int entry;
for ( entry = 0;
cmCTestWarningErrorFileLine[entry].m_RegularExpressionString;
cmCTestWarningErrorFileLine[entry].RegularExpressionString;
++ entry )
{
cmCTestBuildHandler::cmCTestCompileErrorWarningRex r;
if ( r.m_RegularExpression.compile(
cmCTestWarningErrorFileLine[entry].m_RegularExpressionString) )
if ( r.RegularExpression.compile(
cmCTestWarningErrorFileLine[entry].RegularExpressionString) )
{
r.m_FileIndex = cmCTestWarningErrorFileLine[entry].m_FileIndex;
r.m_LineIndex = cmCTestWarningErrorFileLine[entry].m_LineIndex;
m_ErrorWarningFileLineRegex.push_back(r);
r.FileIndex = cmCTestWarningErrorFileLine[entry].FileIndex;
r.LineIndex = cmCTestWarningErrorFileLine[entry].LineIndex;
this->ErrorWarningFileLineRegex.push_back(r);
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[entry].m_RegularExpressionString
<< cmCTestWarningErrorFileLine[entry].RegularExpressionString
<< std::endl);
}
}
// Determine build command and build directory
const std::string &makeCommand
= m_CTest->GetCTestConfiguration("MakeCommand");
= this->CTest->GetCTestConfiguration("MakeCommand");
if ( makeCommand.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find MakeCommand key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
const std::string &buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
= this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
@ -290,7 +290,7 @@ int cmCTestBuildHandler::ProcessHandler()
double elapsed_time_start = cmSystemTools::GetTime();
if ( !this->StartLogFile("Build", ofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build log file"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build log file"
<< std::endl);
}
@ -299,19 +299,19 @@ int cmCTestBuildHandler::ProcessHandler()
std::vector<cmStdString>::size_type cc;
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
{
m_CustomErrorMatches.push_back(cmCTestErrorMatches[cc]);
this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]);
}
for ( cc = 0; cmCTestErrorExceptions[cc]; cc ++ )
{
m_CustomErrorExceptions.push_back(cmCTestErrorExceptions[cc]);
this->CustomErrorExceptions.push_back(cmCTestErrorExceptions[cc]);
}
for ( cc = 0; cmCTestWarningMatches[cc]; cc ++ )
{
m_CustomWarningMatches.push_back(cmCTestWarningMatches[cc]);
this->CustomWarningMatches.push_back(cmCTestWarningMatches[cc]);
}
for ( cc = 0; cmCTestWarningExceptions[cc]; cc ++ )
{
m_CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]);
this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]);
}
// Pre-compile regular expressions objects for all regular expressions
@ -324,22 +324,22 @@ int cmCTestBuildHandler::ProcessHandler()
regexes.push_back(it->c_str()); \
}
cmCTestBuildHandlerPopulateRegexVector(
m_CustomErrorMatches, m_ErrorMatchRegex);
this->CustomErrorMatches, this->ErrorMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomErrorExceptions, m_ErrorExceptionRegex);
this->CustomErrorExceptions, this->ErrorExceptionRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomWarningMatches, m_WarningMatchRegex);
this->CustomWarningMatches, this->WarningMatchRegex);
cmCTestBuildHandlerPopulateRegexVector(
m_CustomWarningExceptions, m_WarningExceptionRegex);
this->CustomWarningExceptions, this->WarningExceptionRegex);
// Determine source and binary tree substitutions to simplify the output.
m_SimplifySourceDir = "";
m_SimplifyBuildDir = "";
if ( m_CTest->GetCTestConfiguration("SourceDirectory").size() > 20 )
this->SimplifySourceDir = "";
this->SimplifyBuildDir = "";
if ( this->CTest->GetCTestConfiguration("SourceDirectory").size() > 20 )
{
std::string srcdir
= m_CTest->GetCTestConfiguration("SourceDirectory") + "/";
= this->CTest->GetCTestConfiguration("SourceDirectory") + "/";
std::string srcdirrep;
for ( cc = srcdir.size()-2; cc > 0; cc -- )
{
@ -351,12 +351,12 @@ int cmCTestBuildHandler::ProcessHandler()
break;
}
}
m_SimplifySourceDir = srcdir;
this->SimplifySourceDir = srcdir;
}
if ( m_CTest->GetCTestConfiguration("BuildDirectory").size() > 20 )
if ( this->CTest->GetCTestConfiguration("BuildDirectory").size() > 20 )
{
std::string bindir
= m_CTest->GetCTestConfiguration("BuildDirectory") + "/";
= this->CTest->GetCTestConfiguration("BuildDirectory") + "/";
std::string bindirrep;
for ( cc = bindir.size()-2; cc > 0; cc -- )
{
@ -368,86 +368,86 @@ int cmCTestBuildHandler::ProcessHandler()
break;
}
}
m_SimplifyBuildDir = bindir;
this->SimplifyBuildDir = bindir;
}
// Ok, let's do the build
// Remember start build time
m_StartBuild = m_CTest->CurrentTime();
this->StartBuild = this->CTest->CurrentTime();
int retVal = 0;
int res = cmsysProcess_State_Exited;
if ( !m_CTest->GetShowOnly() )
if ( !this->CTest->GetShowOnly() )
{
res = this->RunMakeCommand(makeCommand.c_str(), &retVal,
buildDirectory.c_str(), 0, ofs);
}
else
{
cmCTestLog(m_CTest, DEBUG, "Build with command: " << makeCommand
cmCTestLog(this->CTest, DEBUG, "Build with command: " << makeCommand
<< std::endl);
}
// Remember end build time and calculate elapsed time
m_EndBuild = m_CTest->CurrentTime();
this->EndBuild = this->CTest->CurrentTime();
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"
cmCTestLog(this->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() )
if ( !this->SimplifySourceDir.empty() )
{
for ( evit = m_ErrorsAndWarnings.begin();
evit != m_ErrorsAndWarnings.end();
for ( evit = this->ErrorsAndWarnings.begin();
evit != this->ErrorsAndWarnings.end();
++ evit )
{
cmSystemTools::ReplaceString(
evit->m_Text, m_SimplifySourceDir.c_str(), "/.../");
evit->Text, this->SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PreContext, m_SimplifySourceDir.c_str(), "/.../");
evit->PreContext, this->SimplifySourceDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PostContext, m_SimplifySourceDir.c_str(), "/.../");
evit->PostContext, this->SimplifySourceDir.c_str(), "/.../");
}
}
if ( !m_SimplifyBuildDir.empty() )
if ( !this->SimplifyBuildDir.empty() )
{
for ( evit = m_ErrorsAndWarnings.begin();
evit != m_ErrorsAndWarnings.end();
for ( evit = this->ErrorsAndWarnings.begin();
evit != this->ErrorsAndWarnings.end();
++ evit )
{
cmSystemTools::ReplaceString(
evit->m_Text, m_SimplifyBuildDir.c_str(), "/.../");
evit->Text, this->SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PreContext, m_SimplifyBuildDir.c_str(), "/.../");
evit->PreContext, this->SimplifyBuildDir.c_str(), "/.../");
cmSystemTools::ReplaceString(
evit->m_PostContext, m_SimplifyBuildDir.c_str(), "/.../");
evit->PostContext, this->SimplifyBuildDir.c_str(), "/.../");
}
}
// Display message about number of errors and warnings
cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << m_TotalErrors
<< (m_TotalErrors >= m_MaxErrors ? " or more" : "")
cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << this->TotalErrors
<< (this->TotalErrors >= this->MaxErrors ? " or more" : "")
<< " Compiler errors" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << m_TotalWarnings
<< (m_TotalWarnings >= m_MaxWarnings ? " or more" : "")
cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << this->TotalWarnings
<< (this->TotalWarnings >= this->MaxWarnings ? " or more" : "")
<< " Compiler warnings" << std::endl);
// Generate XML output
cmGeneratedFileStream xofs;
if( !this->StartResultingXML("Build", xofs))
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create build XML file"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build XML file"
<< std::endl);
return -1;
}
this->GenerateDartBuildOutput(
xofs, m_ErrorsAndWarnings, elapsed_build_time);
xofs, this->ErrorsAndWarnings, elapsed_build_time);
return 0;
}
@ -457,19 +457,20 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
std::vector<cmCTestBuildErrorWarning> ew,
double elapsed_build_time)
{
m_CTest->StartXML(os);
this->CTest->StartXML(os);
os << "<Build>\n"
<< "\t<StartDateTime>" << m_StartBuild << "</StartDateTime>\n"
<< "\t<StartDateTime>" << this->StartBuild << "</StartDateTime>\n"
<< "<BuildCommand>"
<< m_CTest->MakeXMLSafe(m_CTest->GetCTestConfiguration("MakeCommand"))
<< this->CTest->MakeXMLSafe(
this->CTest->GetCTestConfiguration("MakeCommand"))
<< "</BuildCommand>" << std::endl;
std::vector<cmCTestBuildErrorWarning>::iterator it;
// only report the first 50 warnings and first 50 errors
unsigned short numErrorsAllowed = m_MaxErrors;
unsigned short numWarningsAllowed = m_MaxWarnings;
std::string srcdir = m_CTest->GetCTestConfiguration("SourceDirectory");
unsigned short numErrorsAllowed = this->MaxErrors;
unsigned short numWarningsAllowed = this->MaxWarnings;
std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
// make sure the source dir is in the correct case on windows
// via a call to collapse full path.
srcdir = cmSystemTools::CollapseFullPath(srcdir.c_str());
@ -478,10 +479,10 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
it != ew.end() && (numErrorsAllowed || numWarningsAllowed); it++ )
{
cmCTestBuildErrorWarning *cm = &(*it);
if (cm->m_Error && numErrorsAllowed ||
!cm->m_Error && numWarningsAllowed)
if (cm->Error && numErrorsAllowed ||
!cm->Error && numWarningsAllowed)
{
if (cm->m_Error)
if (cm->Error)
{
numErrorsAllowed--;
}
@ -489,80 +490,80 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
{
numWarningsAllowed--;
}
os << "\t<" << (cm->m_Error ? "Error" : "Warning") << ">\n"
<< "\t\t<BuildLogLine>" << cm->m_LogLine << "</BuildLogLine>\n"
<< "\t\t<Text>" << m_CTest->MakeXMLSafe(cm->m_Text)
os << "\t<" << (cm->Error ? "Error" : "Warning") << ">\n"
<< "\t\t<BuildLogLine>" << cm->LogLine << "</BuildLogLine>\n"
<< "\t\t<Text>" << this->CTest->MakeXMLSafe(cm->Text)
<< "\n</Text>" << std::endl;
std::vector<cmCTestCompileErrorWarningRex>::iterator rit;
for ( rit = m_ErrorWarningFileLineRegex.begin();
rit != m_ErrorWarningFileLineRegex.end(); ++ rit )
for ( rit = this->ErrorWarningFileLineRegex.begin();
rit != this->ErrorWarningFileLineRegex.end(); ++ rit )
{
cmsys::RegularExpression* re = &rit->m_RegularExpression;
if ( re->find(cm->m_Text.c_str() ) )
cmsys::RegularExpression* re = &rit->RegularExpression;
if ( re->find(cm->Text.c_str() ) )
{
cm->m_SourceFile = re->match(rit->m_FileIndex);
// At this point we need to make m_SourceFile relative to
cm->SourceFile = re->match(rit->FileIndex);
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
cmSystemTools::ConvertToUnixSlashes(cm->m_SourceFile);
if(cm->m_SourceFile.find("/.../") != cm->m_SourceFile.npos)
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
if(cm->SourceFile.find("/.../") != cm->SourceFile.npos)
{
cmSystemTools::ReplaceString(cm->m_SourceFile, "/.../", "");
std::string::size_type p = cm->m_SourceFile.find("/");
if(p != cm->m_SourceFile.npos)
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
std::string::size_type p = cm->SourceFile.find("/");
if(p != cm->SourceFile.npos)
{
cm->m_SourceFile = cm->m_SourceFile.substr(
p+1, cm->m_SourceFile.size()-p);
cm->SourceFile = cm->SourceFile.substr(
p+1, cm->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());
cm->SourceFile = cmSystemTools::CollapseFullPath(
cm->SourceFile.c_str());
cmSystemTools::ReplaceString(
cm->m_SourceFile, srcdir.c_str(), "");
cm->SourceFile, srcdir.c_str(), "");
}
cm->m_LineNumber = atoi(re->match(rit->m_LineIndex).c_str());
cm->LineNumber = atoi(re->match(rit->LineIndex).c_str());
break;
}
}
if ( cm->m_SourceFile.size() > 0 )
if ( cm->SourceFile.size() > 0 )
{
os << "\t\t<SourceFile>" << cm->m_SourceFile << "</SourceFile>"
os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>"
<< std::endl;
}
if ( cm->m_SourceFileTail.size() > 0 )
if ( cm->SourceFileTail.size() > 0 )
{
os << "\t\t<SourceFileTail>" << cm->m_SourceFileTail
os << "\t\t<SourceFileTail>" << cm->SourceFileTail
<< "</SourceFileTail>" << std::endl;
}
if ( cm->m_LineNumber >= 0 )
if ( cm->LineNumber >= 0 )
{
os << "\t\t<SourceLineNumber>" << cm->m_LineNumber
os << "\t\t<SourceLineNumber>" << cm->LineNumber
<< "</SourceLineNumber>" << std::endl;
}
os << "\t\t<PreContext>" << m_CTest->MakeXMLSafe(cm->m_PreContext)
os << "\t\t<PreContext>" << this->CTest->MakeXMLSafe(cm->PreContext)
<< "</PreContext>\n"
<< "\t\t<PostContext>" << m_CTest->MakeXMLSafe(cm->m_PostContext);
<< "\t\t<PostContext>" << this->CTest->MakeXMLSafe(cm->PostContext);
// is this the last warning or error, if so notify
if (cm->m_Error && !numErrorsAllowed ||
!cm->m_Error && !numWarningsAllowed)
if (cm->Error && !numErrorsAllowed ||
!cm->Error && !numWarningsAllowed)
{
os << "\nThe maximum number of reported warnings or errors has been "
"reached!!!\n";
}
os << "</PostContext>\n"
<< "\t\t<RepeatCount>0</RepeatCount>\n"
<< "</" << (cm->m_Error ? "Error" : "Warning") << ">\n\n"
<< "</" << (cm->Error ? "Error" : "Warning") << ">\n\n"
<< std::endl;
}
}
os << "\t<Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n\t</Log>\n"
<< "\t<EndDateTime>" << m_EndBuild << "</EndDateTime>\n"
<< "\t<EndDateTime>" << this->EndBuild << "</EndDateTime>\n"
<< "<ElapsedMinutes>" << static_cast<int>(elapsed_build_time/6)/10.0
<< "</ElapsedMinutes>"
<< "</Build>" << std::endl;
m_CTest->EndXML(os);
this->CTest->EndXML(os);
}
//######################################################################
@ -590,13 +591,13 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
}
argv.push_back(0);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run command:");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:");
std::vector<const char*>::iterator ait;
for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\"");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\"");
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
// Now create process object
cmsysProcess* cp = cmsysProcess_New();
@ -612,22 +613,22 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
char* data;
int length;
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Each symbol represents " << tick_len << " bytes of output."
<< std::endl
<< " '!' represents an error and '*' a warning." << std::endl
<< " " << std::flush);
// Initialize building structures
m_BuildProcessingQueue.clear();
m_OutputLineCounter = 0;
m_ErrorsAndWarnings.clear();
m_TotalErrors = 0;
m_TotalWarnings = 0;
m_BuildOutputLogSize = 0;
m_LastTickChar = '.';
m_WarningQuotaReached = false;
m_ErrorQuotaReached = false;
this->BuildProcessingQueue.clear();
this->OutputLineCounter = 0;
this->ErrorsAndWarnings.clear();
this->TotalErrors = 0;
this->TotalWarnings = 0;
this->BuildOutputLogSize = 0;
this->LastTickChar = '.';
this->WarningQuotaReached = false;
this->ErrorQuotaReached = false;
// For every chunk of data
int res;
@ -647,20 +648,20 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
if ( res == cmsysProcess_Pipe_STDERR )
{
this->ProcessBuffer(data, length, tick, tick_len, ofs,
&m_BuildProcessingErrorQueue);
&this->BuildProcessingErrorQueue);
}
else
{
this->ProcessBuffer(data, length, tick, tick_len, ofs,
&m_BuildProcessingQueue);
&this->BuildProcessingQueue);
}
}
this->ProcessBuffer(0, 0, tick, tick_len, ofs, &m_BuildProcessingQueue);
this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue);
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);
&this->BuildProcessingErrorQueue);
cmCTestLog(this->CTest, OUTPUT, " Size of output: "
<< int(this->BuildOutputLogSize / 1024.0) << "K" << std::endl);
// Properly handle output of the build command
cmsysProcess_WaitForExit(cp, 0);
@ -669,32 +670,32 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
if(result == cmsysProcess_State_Exited)
{
*retVal = cmsysProcess_GetExitValue(cp);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->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
cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal
<< std::endl);
}
else if(result == cmsysProcess_State_Expired)
{
cmCTestLog(m_CTest, WARNING, "There was a timeout" << std::endl);
cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl);
}
else if(result == cmsysProcess_State_Error)
{
// If there was an error running command, report that on the dashboard.
cmCTestBuildErrorWarning errorwarning;
errorwarning.m_LogLine = 1;
errorwarning.m_Text = "*** ERROR executing: ";
errorwarning.m_Text += cmsysProcess_GetErrorString(cp);
errorwarning.m_PreContext = "";
errorwarning.m_PostContext = "";
errorwarning.m_Error = true;
m_ErrorsAndWarnings.push_back(errorwarning);
m_TotalErrors ++;
cmCTestLog(m_CTest, ERROR_MESSAGE, "There was an error: "
errorwarning.LogLine = 1;
errorwarning.Text = "*** ERROR executing: ";
errorwarning.Text += cmsysProcess_GetErrorString(cp);
errorwarning.PreContext = "";
errorwarning.PostContext = "";
errorwarning.Error = true;
this->ErrorsAndWarnings.push_back(errorwarning);
this->TotalErrors ++;
cmCTestLog(this->CTest, ERROR_MESSAGE, "There was an error: "
<< cmsysProcess_GetErrorString(cp) << std::endl);
}
@ -720,7 +721,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{
queue->push_back(*ptr);
}
m_BuildOutputLogSize += length;
this->BuildOutputLogSize += length;
// until there are any lines left in the buffer
while ( 1 )
@ -739,27 +740,27 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
// Once certain number of errors or warnings reached, ignore future errors
// or warnings.
if ( m_TotalWarnings >= m_MaxWarnings )
if ( this->TotalWarnings >= this->MaxWarnings )
{
m_WarningQuotaReached = true;
this->WarningQuotaReached = true;
}
if ( m_TotalErrors >= m_MaxErrors )
if ( this->TotalErrors >= this->MaxErrors )
{
m_ErrorQuotaReached = true;
this->ErrorQuotaReached = true;
}
// If the end of line was found
if ( it != queue->end() )
{
// Create a contiguous array for the line
m_CurrentProcessingLine.clear();
this->CurrentProcessingLine.clear();
t_BuildProcessingQueueType::iterator cit;
for ( cit = queue->begin(); cit != it; ++cit )
{
m_CurrentProcessingLine.push_back(*cit);
this->CurrentProcessingLine.push_back(*cit);
}
m_CurrentProcessingLine.push_back(0);
const char* line = &*m_CurrentProcessingLine.begin();
this->CurrentProcessingLine.push_back(0);
const char* line = &*this->CurrentProcessingLine.begin();
// Process the line
int lineType = this->ProcessSingleLine(line);
@ -773,67 +774,67 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
switch ( lineType )
{
case b_WARNING_LINE:
m_LastTickChar = '*';
errorwarning.m_Error = false;
this->LastTickChar = '*';
errorwarning.Error = false;
found = true;
m_TotalWarnings ++;
this->TotalWarnings ++;
break;
case b_ERROR_LINE:
m_LastTickChar = '!';
errorwarning.m_Error = true;
this->LastTickChar = '!';
errorwarning.Error = true;
found = true;
m_TotalErrors ++;
this->TotalErrors ++;
break;
}
if ( found )
{
// This is an error or warning, so generate report
errorwarning.m_LogLine = static_cast<int>(m_OutputLineCounter+1);
errorwarning.m_Text = line;
errorwarning.m_PreContext = "";
errorwarning.m_PostContext = "";
errorwarning.LogLine = static_cast<int>(this->OutputLineCounter+1);
errorwarning.Text = line;
errorwarning.PreContext = "";
errorwarning.PostContext = "";
// Copy pre-context to report
std::deque<cmStdString>::iterator pcit;
for ( pcit = m_PreContext.begin();
pcit != m_PreContext.end();
for ( pcit = this->PreContext.begin();
pcit != this->PreContext.end();
++pcit )
{
errorwarning.m_PreContext += *pcit + "\n";
errorwarning.PreContext += *pcit + "\n";
}
m_PreContext.clear();
this->PreContext.clear();
// Store report
m_ErrorsAndWarnings.push_back(errorwarning);
m_LastErrorOrWarning = m_ErrorsAndWarnings.end()-1;
m_PostContextCount = 0;
this->ErrorsAndWarnings.push_back(errorwarning);
this->LastErrorOrWarning = this->ErrorsAndWarnings.end()-1;
this->PostContextCount = 0;
}
else
{
// 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 ( this->LastErrorOrWarning != this->ErrorsAndWarnings.end() &&
this->PostContextCount < this->MaxPostContext )
{
m_PostContextCount ++;
m_LastErrorOrWarning->m_PostContext += line;
if ( m_PostContextCount < m_MaxPostContext )
this->PostContextCount ++;
this->LastErrorOrWarning->PostContext += line;
if ( this->PostContextCount < this->MaxPostContext )
{
m_LastErrorOrWarning->m_PostContext += "\n";
this->LastErrorOrWarning->PostContext += "\n";
}
}
else
{
// Otherwise store pre-context for the next error
m_PreContext.push_back(line);
if ( m_PreContext.size() > m_MaxPreContext )
this->PreContext.push_back(line);
if ( this->PreContext.size() > this->MaxPreContext )
{
m_PreContext.erase(m_PreContext.begin(),
m_PreContext.end()-m_MaxPreContext);
this->PreContext.erase(this->PreContext.begin(),
this->PreContext.end()-this->MaxPreContext);
}
}
}
m_OutputLineCounter ++;
this->OutputLineCounter ++;
}
else
{
@ -843,25 +844,26 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
// Now that the buffer is processed, display missing ticks
int tickDisplayed = false;
while ( m_BuildOutputLogSize > (tick * tick_len) )
while ( this->BuildOutputLogSize > (tick * tick_len) )
{
tick ++;
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_LastTickChar);
cmCTestLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar);
tickDisplayed = true;
if ( tick % tick_line_len == 0 && tick > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Size: "
<< int((m_BuildOutputLogSize / 1024.0) + 1) << "K" << std::endl
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Size: "
<< int((this->BuildOutputLogSize / 1024.0) + 1) << "K" << std::endl
<< " ");
}
}
if ( tickDisplayed )
{
m_LastTickChar = '.';
this->LastTickChar = '.';
}
// And if this is verbose output, display the content of the chunk
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLogWrite(data, length));
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(data, length));
// Always store the chunk to the file
ofs << cmCTestLogWrite(data, length);
@ -870,7 +872,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
//----------------------------------------------------------------------
int cmCTestBuildHandler::ProcessSingleLine(const char* data)
{
cmCTestLog(m_CTest, DEBUG, "Line: [" << data << "]" << std::endl);
cmCTestLog(this->CTest, DEBUG, "Line: [" << data << "]" << std::endl);
std::vector<cmsys::RegularExpression>::iterator it;
@ -879,58 +881,59 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data)
// Check for regular expressions
if ( !m_ErrorQuotaReached )
if ( !this->ErrorQuotaReached )
{
// Errors
for ( it = m_ErrorMatchRegex.begin();
it != m_ErrorMatchRegex.end();
for ( it = this->ErrorMatchRegex.begin();
it != this->ErrorMatchRegex.end();
++ it )
{
if ( it->find(data) )
{
errorLine = 1;
cmCTestLog(m_CTest, DEBUG, " Error Line: " << data << std::endl);
cmCTestLog(this->CTest, DEBUG, " Error Line: " << data << std::endl);
break;
}
}
// Error exceptions
for ( it = m_ErrorExceptionRegex.begin();
it != m_ErrorExceptionRegex.end();
for ( it = this->ErrorExceptionRegex.begin();
it != this->ErrorExceptionRegex.end();
++ it )
{
if ( it->find(data) )
{
errorLine = 0;
cmCTestLog(m_CTest, DEBUG, " Not an error Line: " << data
cmCTestLog(this->CTest, DEBUG, " Not an error Line: " << data
<< std::endl);
break;
}
}
}
if ( !m_WarningQuotaReached )
if ( !this->WarningQuotaReached )
{
// Warnings
for ( it = m_WarningMatchRegex.begin();
it != m_WarningMatchRegex.end();
for ( it = this->WarningMatchRegex.begin();
it != this->WarningMatchRegex.end();
++ it )
{
if ( it->find(data) )
{
warningLine = 1;
cmCTestLog(m_CTest, DEBUG, " Warning Line: " << data << std::endl);
cmCTestLog(this->CTest, DEBUG,
" Warning Line: " << data << std::endl);
break;
}
}
// Warning exceptions
for ( it = m_WarningExceptionRegex.begin();
it != m_WarningExceptionRegex.end();
for ( it = this->WarningExceptionRegex.begin();
it != this->WarningExceptionRegex.end();
++ it )
{
if ( it->find(data) )
{
warningLine = 0;
cmCTestLog(m_CTest, DEBUG, " Not a warning Line: " << data
cmCTestLog(this->CTest, DEBUG, " Not a warning Line: " << data
<< std::endl);
break;
}

View File

@ -66,21 +66,21 @@ private:
{
public:
cmCTestCompileErrorWarningRex() {}
int m_FileIndex;
int m_LineIndex;
cmsys::RegularExpression m_RegularExpression;
int FileIndex;
int LineIndex;
cmsys::RegularExpression RegularExpression;
};
struct cmCTestBuildErrorWarning
{
bool m_Error;
int m_LogLine;
std::string m_Text;
std::string m_SourceFile;
std::string m_SourceFileTail;
int m_LineNumber;
std::string m_PreContext;
std::string m_PostContext;
bool Error;
int LogLine;
std::string Text;
std::string SourceFile;
std::string SourceFileTail;
int LineNumber;
std::string PreContext;
std::string PostContext;
};
// generate the XML output
@ -89,19 +89,19 @@ private:
double elapsed_time);
std::string m_StartBuild;
std::string m_EndBuild;
std::string StartBuild;
std::string EndBuild;
std::vector<cmStdString> m_CustomErrorMatches;
std::vector<cmStdString> m_CustomErrorExceptions;
std::vector<cmStdString> m_CustomWarningMatches;
std::vector<cmStdString> m_CustomWarningExceptions;
std::vector<cmCTestCompileErrorWarningRex> m_ErrorWarningFileLineRegex;
std::vector<cmStdString> CustomErrorMatches;
std::vector<cmStdString> CustomErrorExceptions;
std::vector<cmStdString> CustomWarningMatches;
std::vector<cmStdString> CustomWarningExceptions;
std::vector<cmCTestCompileErrorWarningRex> ErrorWarningFileLineRegex;
std::vector<cmsys::RegularExpression> m_ErrorMatchRegex;
std::vector<cmsys::RegularExpression> m_ErrorExceptionRegex;
std::vector<cmsys::RegularExpression> m_WarningMatchRegex;
std::vector<cmsys::RegularExpression> m_WarningExceptionRegex;
std::vector<cmsys::RegularExpression> ErrorMatchRegex;
std::vector<cmsys::RegularExpression> ErrorExceptionRegex;
std::vector<cmsys::RegularExpression> WarningMatchRegex;
std::vector<cmsys::RegularExpression> WarningExceptionRegex;
typedef std::deque<char> t_BuildProcessingQueueType;
@ -109,31 +109,31 @@ private:
size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
t_BuildProcessingQueueType m_BuildProcessingQueue;
t_BuildProcessingQueueType m_BuildProcessingErrorQueue;
size_t m_BuildOutputLogSize;
std::vector<char> m_CurrentProcessingLine;
t_BuildProcessingQueueType BuildProcessingQueue;
t_BuildProcessingQueueType BuildProcessingErrorQueue;
size_t BuildOutputLogSize;
std::vector<char> CurrentProcessingLine;
cmStdString m_SimplifySourceDir;
cmStdString m_SimplifyBuildDir;
size_t m_OutputLineCounter;
cmStdString SimplifySourceDir;
cmStdString SimplifyBuildDir;
size_t OutputLineCounter;
typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
t_ErrorsAndWarningsVector m_ErrorsAndWarnings;
t_ErrorsAndWarningsVector::iterator m_LastErrorOrWarning;
size_t m_PostContextCount;
size_t m_MaxPreContext;
size_t m_MaxPostContext;
std::deque<cmStdString> m_PreContext;
t_ErrorsAndWarningsVector ErrorsAndWarnings;
t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
size_t PostContextCount;
size_t MaxPreContext;
size_t MaxPostContext;
std::deque<cmStdString> PreContext;
int m_TotalErrors;
int m_TotalWarnings;
char m_LastTickChar;
int TotalErrors;
int TotalWarnings;
char LastTickChar;
bool m_ErrorQuotaReached;
bool m_WarningQuotaReached;
bool ErrorQuotaReached;
bool WarningQuotaReached;
int m_MaxErrors;
int m_MaxWarnings;
int MaxErrors;
int MaxWarnings;
};
#endif

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -27,17 +27,17 @@ class cmCTestScriptHandler;
*
* cmCTestCommand is the superclass for all commands that will be added to
* the ctest script handlers parser.
*
*
*/
class cmCTestCommand : public cmCommand
{
public:
cmCTestCommand() {m_CTest = 0; m_CTestScriptHandler = 0;}
cmCTest *m_CTest;
cmCTestScriptHandler *m_CTestScriptHandler;
cmCTestCommand() {this->CTest = 0; this->CTestScriptHandler = 0;}
cmCTest *CTest;
cmCTestScriptHandler *CTestScriptHandler;
cmTypeMacro(cmCTestCommand, cmCommand);
};

View File

@ -88,7 +88,7 @@ bool cmCTestConfigureCommand::InitialPass(
if ( source_dir )
{
m_CTest->SetCTestConfiguration("SourceDirectory", source_dir);
this->CTest->SetCTestConfiguration("SourceDirectory", source_dir);
}
else
{
@ -97,7 +97,7 @@ bool cmCTestConfigureCommand::InitialPass(
if ( build_dir )
{
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
}
else
{
@ -116,7 +116,8 @@ bool cmCTestConfigureCommand::InitialPass(
= m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
if ( ctestConfigureCommand && *ctestConfigureCommand )
{
m_CTest->SetCTestConfiguration("ConfigureCommand", ctestConfigureCommand);
this->CTest->SetCTestConfiguration("ConfigureCommand",
ctestConfigureCommand);
}
else
{
@ -125,13 +126,13 @@ bool cmCTestConfigureCommand::InitialPass(
if ( cmakeGeneratorName && *cmakeGeneratorName )
{
std::string cmakeConfigureCommand = "\"";
cmakeConfigureCommand += m_CTest->GetCMakeExecutable();
cmakeConfigureCommand += this->CTest->GetCMakeExecutable();
cmakeConfigureCommand += "\" \"-G";
cmakeConfigureCommand += cmakeGeneratorName;
cmakeConfigureCommand += "\" \"";
cmakeConfigureCommand += source_dir;
cmakeConfigureCommand += "\"";
m_CTest->SetCTestConfiguration("ConfigureCommand",
this->CTest->SetCTestConfiguration("ConfigureCommand",
cmakeConfigureCommand.c_str());
}
else
@ -144,7 +145,7 @@ bool cmCTestConfigureCommand::InitialPass(
}
cmCTestGenericHandler* handler
= m_CTest->GetInitializedHandler("configure");
= this->CTest->GetInitializedHandler("configure");
if ( !handler )
{
this->SetError(

View File

@ -36,8 +36,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestConfigureCommand* ni = new cmCTestConfigureCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -39,21 +39,22 @@ void cmCTestConfigureHandler::Initialize()
//functions and commented...
int cmCTestConfigureHandler::ProcessHandler()
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
std::string cCommand = m_CTest->GetCTestConfiguration("ConfigureCommand");
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
std::string cCommand
= this->CTest->GetCTestConfiguration("ConfigureCommand");
if ( cCommand.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find ConfigureCommand key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
std::string buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
= this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
@ -63,22 +64,22 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string output;
int retVal = 0;
int res = 0;
if ( !m_CTest->GetShowOnly() )
if ( !this->CTest->GetShowOnly() )
{
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Configure", os) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open configure file"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open configure file"
<< std::endl);
return 1;
}
std::string start_time = m_CTest->CurrentTime();
std::string start_time = this->CTest->CurrentTime();
cmGeneratedFileStream ofs;
this->StartLogFile("Configure", ofs);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
<< cCommand.c_str() << std::endl);
res = m_CTest->RunMakeCommand(cCommand.c_str(), &output,
res = this->CTest->RunMakeCommand(cCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
0, ofs);
@ -89,7 +90,7 @@ int cmCTestConfigureHandler::ProcessHandler()
if ( os )
{
m_CTest->StartXML(os);
this->CTest->StartXML(os);
os << "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>"
<< std::endl;
@ -99,9 +100,9 @@ int cmCTestConfigureHandler::ProcessHandler()
}
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>"
<< std::endl;
cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
cmCTestLog(this->CTest, DEBUG, "End" << std::endl);
os << "<Log>" << cmCTest::MakeXMLSafe(output) << "</Log>" << std::endl;
std::string end_time = m_CTest->CurrentTime();
std::string end_time = this->CTest->CurrentTime();
os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "<ElapsedMinutes>"
@ -109,18 +110,18 @@ int cmCTestConfigureHandler::ProcessHandler()
(cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>"
<< "</Configure>" << std::endl;
m_CTest->EndXML(os);
this->CTest->EndXML(os);
}
}
else
{
cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand
cmCTestLog(this->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(this->CTest, ERROR_MESSAGE,
"Error(s) when updating the project" << std::endl);
return -1;
}
return 0;

View File

@ -71,13 +71,14 @@ bool cmCTestCoverageCommand::InitialPass(
if ( build_dir )
{
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
}
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"CoverageCommand", "CTEST_COVERAGE_COMMAND");
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("coverage");
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("coverage");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate test handler");
@ -85,7 +86,7 @@ bool cmCTestCoverageCommand::InitialPass(
}
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(
m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
int res = handler->ProcessHandler();
if ( res_var )
{

View File

@ -36,8 +36,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestCoverageCommand* ni = new cmCTestCoverageCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -40,7 +40,7 @@ cmCTestCoverageHandler::cmCTestCoverageHandler()
void cmCTestCoverageHandler::Initialize()
{
this->Superclass::Initialize();
m_CustomCoverageExclude.empty();
this->CustomCoverageExclude.empty();
}
//----------------------------------------------------------------------
@ -49,16 +49,16 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
{
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " << covLogFilename
<< std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: "
<< covLogFilename << std::endl);
if (!this->StartResultingXML(covLogFilename, covLogFile) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open log file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file: "
<< covLogFilename << std::endl);
return false;
}
std::string local_start_time = m_CTest->CurrentTime();
m_CTest->StartXML(covLogFile);
std::string local_start_time = this->CTest->CurrentTime();
this->CTest->StartXML(covLogFile);
covLogFile << "<CoverageLog>" << std::endl
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>"
<< std::endl;
@ -69,13 +69,13 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
int logFileCount)
{
std::string local_end_time = m_CTest->CurrentTime();
std::string local_end_time = this->CTest->CurrentTime();
ostr << "\t<EndDateTime>" << local_end_time << "</EndDateTime>" << std::endl
<< "</CoverageLog>" << std::endl;
m_CTest->EndXML(ostr);
this->CTest->EndXML(ostr);
char covLogFilename[1024];
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Close file: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: "
<< covLogFilename << std::endl);
ostr.Close();
}
@ -86,12 +86,12 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
const char* binDir)
{
std::vector<cmsys::RegularExpression>::iterator sit;
for ( sit = m_CustomCoverageExcludeRegex.begin();
sit != m_CustomCoverageExcludeRegex.end(); ++ sit )
for ( sit = this->CustomCoverageExcludeRegex.begin();
sit != this->CustomCoverageExcludeRegex.end(); ++ sit )
{
if ( sit->find(file) )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " File " << file
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file
<< " is excluded in CTestCustom.ctest" << std::endl;);
return false;
}
@ -133,7 +133,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str()
<< " so skip coverage of " << file << std::endl);
return false;
}
@ -164,7 +164,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str()
<< " so skip coverage of: " << file << std::endl);
return false;
}
@ -179,16 +179,19 @@ int cmCTestCoverageHandler::ProcessHandler()
{
int error = 0;
std::string sourceDir = m_CTest->GetCTestConfiguration("SourceDirectory");
std::string binaryDir = m_CTest->GetCTestConfiguration("BuildDirectory");
std::string gcovCommand = m_CTest->GetCTestConfiguration("CoverageCommand");
std::string sourceDir
= this->CTest->GetCTestConfiguration("SourceDirectory");
std::string binaryDir
= this->CTest->GetCTestConfiguration("BuildDirectory");
std::string gcovCommand
= this->CTest->GetCTestConfiguration("CoverageCommand");
cmGeneratedFileStream ofs;
double elapsed_time_start = cmSystemTools::GetTime();
if ( !this->StartLogFile("Coverage", ofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create LastCoverage.log file"
<< std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create LastCoverage.log file" << std::endl);
}
ofs << "Performing coverage: " << elapsed_time_start << std::endl;
@ -224,11 +227,11 @@ int cmCTestCoverageHandler::ProcessHandler()
cmsys::RegularExpression st2re5(st2gcovOutputRex5.c_str());
cmsys::RegularExpression st2re6(st2gcovOutputRex6.c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl);
std::string coverage_start_time = m_CTest->CurrentTime();
std::string coverage_start_time = this->CTest->CurrentTime();
std::string testingDir = m_CTest->GetBinaryDir() + "/Testing";
std::string testingDir = this->CTest->GetBinaryDir() + "/Testing";
std::string tempDir = testingDir + "/CoverageInfo";
std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::MakeDirectory(tempDir.c_str());
@ -247,19 +250,19 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( files.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find any coverage files."
cmCTestLog(this->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;
}
m_CustomCoverageExcludeRegex.empty();
this->CustomCoverageExcludeRegex.empty();
std::vector<cmStdString>::iterator rexIt;
for ( rexIt = m_CustomCoverageExclude.begin();
rexIt != m_CustomCoverageExclude.end();
for ( rexIt = this->CustomCoverageExclude.begin();
rexIt != this->CustomCoverageExclude.end();
++ rexIt )
{
m_CustomCoverageExcludeRegex.push_back(
this->CustomCoverageExcludeRegex.push_back(
cmsys::RegularExpression(rexIt->c_str()));
}
@ -273,44 +276,45 @@ int cmCTestCoverageHandler::ProcessHandler()
std::set<std::string> missingFiles;
std::string actualSourceFile = "";
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Processing coverage (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
int file_count = 0;
for ( it = files.begin(); it != files.end(); ++ it )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "." << std::flush);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir
+ "\" \"" + *it + "\"";
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() << std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
std::string output = "";
std::string errors = "";
int retVal = 0;
ofs << "* Run coverage for: " << fileDir.c_str() << std::endl;
ofs << " Command: " << command.c_str() << std::endl;
int res = m_CTest->RunCommand(command.c_str(), &output, &errors,
&retVal, tempDir.c_str(), 0 /*m_TimeOut*/);
int res = this->CTest->RunCommand(command.c_str(), &output, &errors,
&retVal, tempDir.c_str(), 0 /*this->TimeOut*/);
ofs << " Output: " << output.c_str() << std::endl;
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(this->CTest, ERROR_MESSAGE,
"Problem running coverage on file: " << it->c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Command produced error: " << errors << std::endl);
error ++;
continue;
}
if ( retVal != 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Coverage command returned: "
cmCTestLog(this->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(this->CTest, ERROR_MESSAGE,
"Command produced error: " << error << std::endl);
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"--------------------------------------------------------------"
<< std::endl
<< output << std::endl
@ -326,7 +330,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
std::string sourceFile;
std::string gcovFile;
cmCTestLog(m_CTest, DEBUG, "Line: [" << line->c_str() << "]"
cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl);
if ( line->size() == 0 )
{
@ -338,7 +342,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -355,7 +359,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -371,7 +375,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -388,7 +392,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -402,7 +406,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -418,7 +422,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -426,7 +430,7 @@ int cmCTestCoverageHandler::ProcessHandler()
gcovStyle = 2;
}
cmCTestLog(m_CTest, WARNING, "Warning: " << st2re4.match(1)
cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl);
}
else if ( st2re5.find(line->c_str() ) )
@ -435,7 +439,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -443,7 +447,7 @@ int cmCTestCoverageHandler::ProcessHandler()
gcovStyle = 2;
}
cmCTestLog(m_CTest, WARNING, "Warning: Cannot open file: "
cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
<< st2re5.match(1) << std::endl);
}
else if ( st2re6.find(line->c_str() ) )
@ -452,7 +456,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( gcovStyle != 2 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown gcov output style"
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
<< std::endl);
error ++;
break;
@ -460,25 +464,25 @@ int cmCTestCoverageHandler::ProcessHandler()
gcovStyle = 2;
}
cmCTestLog(m_CTest, WARNING, "Warning: File: " << st2re6.match(1)
cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
<< " is newer than " << st2re6.match(2) << std::endl);
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown line: [" << line->c_str()
<< "]" << std::endl);
cmCTestLog(this->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: "
cmCTestLog(this->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: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: "
<< gcovFile << std::endl);
}
else
@ -541,7 +545,7 @@ int cmCTestCoverageHandler::ProcessHandler()
sourceFile.substr(0, sourceDir.size()) == sourceDir &&
sourceFile[sourceDir.size()] == '/' )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
<< sourceFile.c_str() << std::endl);
ofs << " produced in source dir: " << sourceFile.c_str()
<< std::endl;
@ -553,7 +557,7 @@ int cmCTestCoverageHandler::ProcessHandler()
sourceFile.substr(0, binaryDir.size()) == binaryDir &&
sourceFile[binaryDir.size()] == '/' )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
<< sourceFile.c_str() << std::endl);
ofs << " produced in binary dir: " << sourceFile.c_str()
<< std::endl;
@ -564,13 +568,13 @@ int cmCTestCoverageHandler::ProcessHandler()
{
if ( missingFiles.find(actualSourceFile) == missingFiles.end() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Something went wrong"
<< std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: ["
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Something went wrong" << std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "File: ["
<< sourceFile.c_str() << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "s: ["
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "s: ["
<< sourceFile.substr(0, sourceDir.size()) << "]" << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "b: ["
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "b: ["
<< sourceFile.substr(0, binaryDir.size()) << "]" << std::endl);
ofs << " Something went wrong. Cannot find: "
<< sourceFile.c_str()
@ -584,9 +588,9 @@ int cmCTestCoverageHandler::ProcessHandler()
file_count ++;
if ( file_count % 50 == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
<< " out of " << files.size() << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
}
}
@ -595,13 +599,13 @@ int cmCTestCoverageHandler::ProcessHandler()
if (!this->StartResultingXML("Coverage", covSumFile))
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open coverage summary file."
<< std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot open coverage summary file." << std::endl);
return -1;
}
m_CTest->StartXML(covSumFile);
this->CTest->StartXML(covSumFile);
// Produce output xml files
covSumFile << "<Coverage>" << std::endl
@ -618,10 +622,10 @@ int cmCTestCoverageHandler::ProcessHandler()
long total_untested = 0;
//std::string fullSourceDir = sourceDir + "/";
//std::string fullBinaryDir = binaryDir + "/";
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Acumulating results (each . represents one file):" << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
std::vector<std::string> errorsWhileAccumulating;
@ -630,14 +634,14 @@ int cmCTestCoverageHandler::ProcessHandler()
fileIterator != totalCoverage.end();
++fileIterator )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "." << std::flush);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
file_count ++;
if ( file_count % 50 == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " processed: " << file_count
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
<< " out of "
<< totalCoverage.size() << std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
}
if ( cnt % 100 == 0 )
{
@ -653,14 +657,14 @@ int cmCTestCoverageHandler::ProcessHandler()
= cmSystemTools::GetFilenameName(fullFileName.c_str());
std::string fullFilePath
= cmSystemTools::GetFilenamePath(fullFileName.c_str());
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Process file: "
cmCTestLog(this->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: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: "
<< fullFileName.c_str() << std::endl);
continue;
}
@ -670,7 +674,7 @@ int cmCTestCoverageHandler::ProcessHandler()
sourceDir.c_str(), binaryDir.c_str());
if ( !shouldIDoCoverage )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
".NoDartCoverage found, so skip coverage check for: "
<< fullFileName.c_str()
<< std::endl);
@ -679,8 +683,9 @@ int cmCTestCoverageHandler::ProcessHandler()
const singleFileCoverageVector& fcov = fileIterator->second;
covLogFile << "\t<File Name=\""
<< m_CTest->MakeXMLSafe(fileName.c_str())
<< "\" FullPath=\"" << m_CTest->MakeXMLSafe(m_CTest->GetShortPathToFile(
<< this->CTest->MakeXMLSafe(fileName.c_str())
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
this->CTest->GetShortPathToFile(
fileIterator->first.c_str())) << "\">" << std::endl
<< "\t\t<Report>" << std::endl;
@ -712,7 +717,7 @@ int cmCTestCoverageHandler::ProcessHandler()
}
covLogFile << "\t\t<Line Number=\"" << cc << "\" Count=\"" << fcov[cc]
<< "\">"
<< m_CTest->MakeXMLSafe(line.c_str()) << "</Line>" << std::endl;
<< this->CTest->MakeXMLSafe(line.c_str()) << "</Line>" << std::endl;
if ( fcov[cc] == 0 )
{
untested ++;
@ -741,9 +746,9 @@ int cmCTestCoverageHandler::ProcessHandler()
total_untested += untested;
covLogFile << "\t\t</Report>" << std::endl
<< "\t</File>" << std::endl;
covSumFile << "\t<File Name=\"" << m_CTest->MakeXMLSafe(fileName)
<< "\" FullPath=\"" << m_CTest->MakeXMLSafe(
m_CTest->GetShortPathToFile(fullFileName.c_str()))
covSumFile << "\t<File Name=\"" << this->CTest->MakeXMLSafe(fileName)
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
this->CTest->GetShortPathToFile(fullFileName.c_str()))
<< "\" Covered=\"" << (cmet>0?"true":"false") << "\">\n"
<< "\t\t<LOCTested>" << tested << "</LOCTested>\n"
<< "\t\t<LOCUnTested>" << untested << "</LOCUnTested>\n"
@ -762,15 +767,16 @@ 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(this->CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error(s) while acumulating results:" << std::endl);
std::vector<std::string>::iterator erIt;
for ( erIt = errorsWhileAccumulating.begin();
erIt != errorsWhileAccumulating.end();
++ erIt )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " " << erIt->c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
" " << erIt->c_str() << std::endl);
}
}
@ -782,7 +788,7 @@ int cmCTestCoverageHandler::ProcessHandler()
percent_coverage = 0;
}
std::string end_time = m_CTest->CurrentTime();
std::string end_time = this->CTest->CurrentTime();
covSumFile << "\t<LOCTested>" << total_tested << "</LOCTested>\n"
<< "\t<LOCUntested>" << total_untested << "</LOCUntested>\n"
@ -796,9 +802,9 @@ int cmCTestCoverageHandler::ProcessHandler()
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>"
<< "</Coverage>" << std::endl;
m_CTest->EndXML(covSumFile);
this->CTest->EndXML(covSumFile);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "\tCovered LOC: "
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\tCovered LOC: "
<< total_tested << std::endl
<< "\tNot covered LOC: " << total_untested << std::endl
<< "\tTotal LOC: " << total_lines << std::endl
@ -827,16 +833,16 @@ int cmCTestCoverageHandler::ProcessHandler()
//----------------------------------------------------------------------
void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Add coverage exclude regular expressions." << std::endl);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
m_CustomCoverageExclude);
this->CustomCoverageExclude);
std::vector<cmStdString>::iterator it;
for ( it = m_CustomCoverageExclude.begin();
it != m_CustomCoverageExclude.end();
for ( it = this->CustomCoverageExclude.begin();
it != this->CustomCoverageExclude.end();
++ it )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: "
<< it->c_str() << std::endl);
}
}

View File

@ -59,48 +59,48 @@ private:
{
cmCTestCoverage()
{
m_AbsolutePath = "";
m_FullPath = "";
m_Covered = false;
m_Tested = 0;
m_UnTested = 0;
m_Lines.clear();
m_Show = false;
this->AbsolutePath = "";
this->FullPath = "";
this->Covered = false;
this->Tested = 0;
this->UnTested = 0;
this->Lines.clear();
this->Show = false;
}
cmCTestCoverage(const cmCTestCoverage& rhs) :
m_AbsolutePath(rhs.m_AbsolutePath),
m_FullPath(rhs.m_FullPath),
m_Covered(rhs.m_Covered),
m_Tested(rhs.m_Tested),
m_UnTested(rhs.m_UnTested),
m_Lines(rhs.m_Lines),
m_Show(rhs.m_Show)
AbsolutePath(rhs.AbsolutePath),
FullPath(rhs.FullPath),
Covered(rhs.Covered),
Tested(rhs.Tested),
UnTested(rhs.UnTested),
Lines(rhs.Lines),
Show(rhs.Show)
{
}
cmCTestCoverage& operator=(const cmCTestCoverage& rhs)
{
m_AbsolutePath = rhs.m_AbsolutePath;
m_FullPath = rhs.m_FullPath;
m_Covered = rhs.m_Covered;
m_Tested = rhs.m_Tested;
m_UnTested = rhs.m_UnTested;
m_Lines = rhs.m_Lines;
m_Show = rhs.m_Show;
this->AbsolutePath = rhs.AbsolutePath;
this->FullPath = rhs.FullPath;
this->Covered = rhs.Covered;
this->Tested = rhs.Tested;
this->UnTested = rhs.UnTested;
this->Lines = rhs.Lines;
this->Show = rhs.Show;
return *this;
}
std::string m_AbsolutePath;
std::string m_FullPath;
bool m_Covered;
int m_Tested;
int m_UnTested;
std::vector<int> m_Lines;
bool m_Show;
std::string AbsolutePath;
std::string FullPath;
bool Covered;
int Tested;
int UnTested;
std::vector<int> Lines;
bool Show;
};
std::vector<cmStdString> m_CustomCoverageExclude;
std::vector<cmsys::RegularExpression> m_CustomCoverageExcludeRegex;
std::vector<cmStdString> CustomCoverageExclude;
std::vector<cmsys::RegularExpression> CustomCoverageExcludeRegex;
typedef std::map<std::string, cmCTestCoverage> tm_CoverageMap;
typedef std::map<std::string, cmCTestCoverage> CoverageMap;
};
#endif

View File

@ -38,8 +38,8 @@ public:
{
cmCTestEmptyBinaryDirectoryCommand* ni
= new cmCTestEmptyBinaryDirectoryCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -22,9 +22,9 @@
//----------------------------------------------------------------------
cmCTestGenericHandler::cmCTestGenericHandler()
{
m_HandlerVerbose = false;
m_CTest = 0;
m_SubmitIndex = 0;
this->HandlerVerbose = false;
this->CTest = 0;
this->SubmitIndex = 0;
}
//----------------------------------------------------------------------
@ -42,29 +42,29 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value)
if ( !value )
{
cmCTestGenericHandler::t_StringToString::iterator remit
= m_Options.find(op);
if ( remit != m_Options.end() )
= this->Options.find(op);
if ( remit != this->Options.end() )
{
m_Options.erase(remit);
this->Options.erase(remit);
}
return;
}
m_Options[op] = value;
this->Options[op] = value;
}
//----------------------------------------------------------------------
void cmCTestGenericHandler::Initialize()
{
m_Options.clear();
this->Options.clear();
}
//----------------------------------------------------------------------
const char* cmCTestGenericHandler::GetOption(const char* op)
{
cmCTestGenericHandler::t_StringToString::iterator remit
= m_Options.find(op);
if ( remit == m_Options.end() )
= this->Options.find(op);
if ( remit == this->Options.end() )
{
return 0;
}
@ -77,26 +77,27 @@ bool cmCTestGenericHandler::StartResultingXML(const char* name,
{
if ( !name )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create resulting XML file without providing the name"
<< std::endl;);
return false;
}
cmOStringStream ostr;
ostr << name;
if ( m_SubmitIndex > 0 )
if ( this->SubmitIndex > 0 )
{
ostr << "_" << m_SubmitIndex;
ostr << "_" << this->SubmitIndex;
}
ostr << ".xml";
if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), ostr.str().c_str(),
xofs, true) )
if( !this->CTest->OpenOutputFile(this->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(this->CTest, ERROR_MESSAGE,
"Cannot create resulting XML file: " << ostr.str().c_str()
<< std::endl);
return false;
}
m_CTest->AddSubmitFile(ostr.str().c_str());
this->CTest->AddSubmitFile(ostr.str().c_str());
return true;
}
@ -106,24 +107,24 @@ bool cmCTestGenericHandler::StartLogFile(const char* name,
{
if ( !name )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create log file without providing the name" << std::endl;);
return false;
}
cmOStringStream ostr;
ostr << "Last" << name;
if ( m_SubmitIndex > 0 )
if ( this->SubmitIndex > 0 )
{
ostr << "_" << m_SubmitIndex;
ostr << "_" << this->SubmitIndex;
}
if ( !m_CTest->GetCurrentTag().empty() )
if ( !this->CTest->GetCurrentTag().empty() )
{
ostr << "_" << m_CTest->GetCurrentTag();
ostr << "_" << this->CTest->GetCurrentTag();
}
ostr << ".log";
if( !m_CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) )
if( !this->CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot create log file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: "
<< ostr.str().c_str() << std::endl);
return false;
}

View File

@ -36,7 +36,7 @@ public:
/**
* If verbose then more informaiton is printed out
*/
void SetVerbose(bool val) { m_HandlerVerbose = val; }
void SetVerbose(bool val) { this->HandlerVerbose = val; }
/**
* Populate internals from CTest custom scripts
@ -64,8 +64,8 @@ public:
/**
* Set the CTest instance
*/
void SetCTestInstance(cmCTest* ctest) { m_CTest = ctest; }
cmCTest* GetCTestInstance() { return m_CTest; }
void SetCTestInstance(cmCTest* ctest) { this->CTest = ctest; }
cmCTest* GetCTestInstance() { return this->CTest; }
/**
* Construct handler
@ -80,22 +80,22 @@ public:
void SetCommand(cmCTestCommand* command)
{
m_Command = command;
this->Command = command;
}
void SetSubmitIndex(int idx) { m_SubmitIndex = idx; }
int GetSubmitIndex() { return m_SubmitIndex; }
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
int GetSubmitIndex() { return this->SubmitIndex; }
protected:
bool StartResultingXML(const char* name, cmGeneratedFileStream& xofs);
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool m_HandlerVerbose;
cmCTest *m_CTest;
t_StringToString m_Options;
bool HandlerVerbose;
cmCTest *CTest;
t_StringToString Options;
cmCTestCommand* m_Command;
int m_SubmitIndex;
cmCTestCommand* Command;
int SubmitIndex;
};
#endif

View File

@ -23,23 +23,23 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
{
const size_t INIT_SIZE = 100;
size_t cc;
m_Arguments.reserve(INIT_SIZE);
this->Arguments.reserve(INIT_SIZE);
for ( cc = 0; cc < INIT_SIZE; ++ cc )
{
m_Arguments.push_back(0);
this->Arguments.push_back(0);
}
m_Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
m_Arguments[ct_SOURCE] = "SOURCE";
m_Arguments[ct_BUILD] = "BUILD";
m_Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
m_Last = ct_LAST;
this->Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
this->Arguments[ct_SOURCE] = "SOURCE";
this->Arguments[ct_BUILD] = "BUILD";
this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
this->Last = ct_LAST;
}
bool cmCTestHandlerCommand::InitialPass(
std::vector<std::string> const& args)
{
if ( !this->ProcessArguments(args, m_Last, &*m_Arguments.begin(),
m_Values) )
if ( !this->ProcessArguments(args, this->Last, &*this->Arguments.begin(),
this->Values) )
{
return false;
}
@ -51,15 +51,16 @@ bool cmCTestHandlerCommand::InitialPass(
return false;
}
if ( m_Values[ct_BUILD] )
if ( this->Values[ct_BUILD] )
{
m_CTest->SetCTestConfiguration("BuildDirectory", m_Values[ct_BUILD]);
this->CTest->SetCTestConfiguration("BuildDirectory",
this->Values[ct_BUILD]);
}
if ( m_Values[ct_SUBMIT_INDEX] )
if ( this->Values[ct_SUBMIT_INDEX] )
{
if ( m_CTest->GetDartVersion() <= 1 )
if ( this->CTest->GetDartVersion() <= 1 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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 "
@ -67,20 +68,21 @@ bool cmCTestHandlerCommand::InitialPass(
}
else
{
handler->SetSubmitIndex(atoi(m_Values[ct_SUBMIT_INDEX]));
handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX]));
}
}
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(
m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
int res = handler->ProcessHandler();
if ( m_Values[ct_RETURN_VALUE] && *m_Values[ct_RETURN_VALUE])
if ( this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE])
{
cmOStringStream str;
str << res;
m_Makefile->AddDefinition(m_Values[ct_RETURN_VALUE], str.str().c_str());
m_Makefile->AddDefinition(
this->Values[ct_RETURN_VALUE], str.str().c_str());
}
cmSystemTools::ChangeDirectory(current_dir.c_str());
return true;
@ -103,8 +105,7 @@ bool cmCTestHandlerCommand::ProcessArguments(
if ( state > 0 && state < last )
{
values[state] = args[i].c_str();
#undef cerr
cmCTestLog(m_CTest, DEBUG, "Set " << strings[state] << " to "
cmCTestLog(this->CTest, DEBUG, "Set " << strings[state] << " to "
<< args[i].c_str() << std::endl);
state = 0;
}

View File

@ -54,10 +54,10 @@ protected:
bool ProcessArguments(std::vector<std::string> const& args,
int last, const char** strings, std::vector<const char*>& values);
std::string m_ReturnVariable;
std::vector<const char*> m_Arguments;
std::vector<const char*> m_Values;
size_t m_Last;
std::string ReturnVariable;
std::vector<const char*> Arguments;
std::vector<const char*> Values;
size_t Last;
};
#endif

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -22,13 +22,14 @@
cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler()
{
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("memcheck");
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("memcheck");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE");
return handler;

View File

@ -38,8 +38,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestMemCheckCommand* ni = new cmCTestMemCheckCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -87,22 +87,22 @@ static const char* cmCTestMemCheckResultLongStrings[] = {
//----------------------------------------------------------------------
cmCTestMemCheckHandler::cmCTestMemCheckHandler()
{
m_MemCheck = true;
this->MemCheck = true;
}
//----------------------------------------------------------------------
void cmCTestMemCheckHandler::Initialize()
{
this->Superclass::Initialize();
m_MemoryTester = "";
m_MemoryTesterOptionsParsed.clear();
m_MemoryTesterOptions = "";
m_MemoryTesterStyle = UNKNOWN;
m_MemoryTesterOutputFile = "";
this->MemoryTester = "";
this->MemoryTesterOptionsParsed.clear();
this->MemoryTesterOptions = "";
this->MemoryTesterStyle = UNKNOWN;
this->MemoryTesterOutputFile = "";
int cc;
for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ )
{
m_MemoryTesterGlobalResults[cc] = 0;
this->MemoryTesterGlobalResults[cc] = 0;
}
}
@ -115,9 +115,9 @@ int cmCTestMemCheckHandler::PreProcessHandler()
return 0;
}
if ( !this->ExecuteCommands(m_CustomPreMemCheck) )
if ( !this->ExecuteCommands(this->CustomPreMemCheck) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Problem executing pre-memcheck command(s)." << std::endl);
return 0;
}
@ -127,9 +127,9 @@ int cmCTestMemCheckHandler::PreProcessHandler()
//----------------------------------------------------------------------
int cmCTestMemCheckHandler::PostProcessHandler()
{
if ( !this->ExecuteCommands(m_CustomPostMemCheck) )
if ( !this->ExecuteCommands(this->CustomPostMemCheck) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Problem executing post-memcheck command(s)." << std::endl);
return 0;
}
@ -141,17 +141,17 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
std::vector<const char*>& args)
{
std::vector<cmStdString>::size_type pp;
args.push_back(m_MemoryTester.c_str());
args.push_back(this->MemoryTester.c_str());
std::string memcheckcommand = "";
memcheckcommand = m_MemoryTester;
for ( pp = 0; pp < m_MemoryTesterOptionsParsed.size(); pp ++ )
memcheckcommand = this->MemoryTester;
for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ )
{
args.push_back(m_MemoryTesterOptionsParsed[pp].c_str());
args.push_back(this->MemoryTesterOptionsParsed[pp].c_str());
memcheckcommand += " ";
memcheckcommand += cmSystemTools::EscapeSpaces(
m_MemoryTesterOptionsParsed[pp].c_str());
this->MemoryTesterOptionsParsed[pp].c_str());
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
<< memcheckcommand << std::endl);
}
@ -160,26 +160,26 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf)
{
this->cmCTestTestHandler::PopulateCustomVectors(mf);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_MEMCHECK",
m_CustomPreMemCheck);
this->CustomPreMemCheck);
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_POST_MEMCHECK",
m_CustomPostMemCheck);
this->CustomPostMemCheck);
cmCTest::PopulateCustomVector(mf,
"CTEST_CUSTOM_MEMCHECK_IGNORE",
m_CustomTestsIgnore);
this->CustomTestsIgnore);
}
//----------------------------------------------------------------------
void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
{
if ( !m_CTest->GetProduceXML() )
if ( !this->CTest->GetProduceXML() )
{
return;
}
m_CTest->StartXML(os);
this->CTest->StartXML(os);
os << "<DynamicAnalysis Checker=\"";
switch ( m_MemoryTesterStyle )
switch ( this->MemoryTesterStyle )
{
case cmCTestMemCheckHandler::VALGRIND:
os << "Valgrind";
@ -195,41 +195,41 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
}
os << "\">" << std::endl;
os << "\t<StartDateTime>" << m_StartTest << "</StartDateTime>\n"
os << "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
<< "\t<TestList>\n";
tm_TestResultsVector::size_type cc;
for ( cc = 0; cc < m_TestResults.size(); cc ++ )
cmCTestMemCheckHandler::TestResultsVector::size_type cc;
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
{
cmCTestTestResult *result = &m_TestResults[cc];
std::string testPath = result->m_Path + "/" + result->m_Name;
cmCTestTestResult *result = &this->TestResults[cc];
std::string testPath = result->Path + "/" + result->Name;
os << "\t\t<Test>" << cmCTest::MakeXMLSafe(
m_CTest->GetShortPathToFile(testPath.c_str()))
this->CTest->GetShortPathToFile(testPath.c_str()))
<< "</Test>" << std::endl;
}
os << "\t</TestList>\n";
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
"-- Processing memory checking output: ");
unsigned int total = m_TestResults.size();
unsigned int total = this->TestResults.size();
unsigned int step = total / 10;
unsigned int current = 0;
for ( cc = 0; cc < m_TestResults.size(); cc ++ )
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
{
cmCTestTestResult *result = &m_TestResults[cc];
cmCTestTestResult *result = &this->TestResults[cc];
std::string memcheckstr;
int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT];
int kk;
bool res = this->ProcessMemCheckOutput(result->m_Output, memcheckstr,
bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr,
memcheckresults);
if ( res && result->m_Status == cmCTestMemCheckHandler::COMPLETED )
if ( res && result->Status == cmCTestMemCheckHandler::COMPLETED )
{
continue;
}
os << "\t<Test Status=\"";
if ( result->m_Status == cmCTestMemCheckHandler::COMPLETED )
if ( result->Status == cmCTestMemCheckHandler::COMPLETED )
{
os << "passed";
}
else if ( result->m_Status == cmCTestMemCheckHandler::NOT_RUN )
else if ( result->Status == cmCTestMemCheckHandler::NOT_RUN )
{
os << "notrun";
}
@ -237,15 +237,15 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
{
os << "failed";
}
std::string testPath = result->m_Path + "/" + result->m_Name;
std::string testPath = result->Path + "/" + result->Name;
os << "\">\n"
<< "\t\t<Name>" << cmCTest::MakeXMLSafe(result->m_Name) << "</Name>\n"
<< "\t\t<Name>" << cmCTest::MakeXMLSafe(result->Name) << "</Name>\n"
<< "\t\t<Path>" << cmCTest::MakeXMLSafe(
m_CTest->GetShortPathToFile(result->m_Path.c_str())) << "</Path>\n"
this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
<< "\t\t<FullName>" << cmCTest::MakeXMLSafe(
m_CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
<< "\t\t<FullCommandLine>"
<< cmCTest::MakeXMLSafe(result->m_FullCommandLine)
<< cmCTest::MakeXMLSafe(result->FullCommandLine)
<< "</FullCommandLine>\n"
<< "\t\t<Results>" << std::endl;
for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ )
@ -257,7 +257,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
<< memcheckresults[kk]
<< "</Defect>" << std::endl;
}
m_MemoryTesterGlobalResults[kk] += memcheckresults[kk];
this->MemoryTesterGlobalResults[kk] += memcheckresults[kk];
}
os
<< "\t\t</Results>\n"
@ -266,39 +266,39 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
<< "\t</Test>" << std::endl;
if ( current < cc )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, "#" << std::flush);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush);
current += step;
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Memory checking results:"
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:"
<< std::endl);
os << "\t<DefectList>" << std::endl;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
if ( m_MemoryTesterGlobalResults[cc] )
if ( this->MemoryTesterGlobalResults[cc] )
{
#ifdef cerr
# undef cerr
#endif
std::cerr.width(35);
#define cerr no_cerr
cmCTestLog(m_CTest, HANDLER_OUTPUT, cmCTestMemCheckResultLongStrings[cc]
<< " - "
<< m_MemoryTesterGlobalResults[cc] << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT,
cmCTestMemCheckResultLongStrings[cc] << " - "
<< this->MemoryTesterGlobalResults[cc] << std::endl);
os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc]
<< "\"/>" << std::endl;
}
}
os << "\t</DefectList>" << std::endl;
os << "\t<EndDateTime>" << m_EndTest << "</EndDateTime>" << std::endl;
os << "\t<EndDateTime>" << this->EndTest << "</EndDateTime>" << std::endl;
os << "<ElapsedMinutes>"
<< static_cast<int>(m_ElapsedTestingTime/6)/10.0
<< static_cast<int>(this->ElapsedTestingTime/6)/10.0
<< "</ElapsedMinutes>\n";
os << "</DynamicAnalysis>" << std::endl;
m_CTest->EndXML(os);
this->CTest->EndXML(os);
}
@ -307,111 +307,118 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
bool cmCTestMemCheckHandler::InitializeMemoryChecking()
{
// Setup the command
if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"MemoryCheckCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
"MemoryCheckCommand").c_str());
}
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"PurifyCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
"PurifyCommand").c_str());
}
else if ( cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"ValgrindCommand").c_str()) )
{
m_MemoryTester
= cmSystemTools::ConvertToOutputPath(m_CTest->GetCTestConfiguration(
this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
"ValgrindCommand").c_str());
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Memory checker (MemoryCheckCommand) "
cmCTestLog(this->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 ( this->MemoryTester[0] == '\"' &&
this->MemoryTester[this->MemoryTester.size()-1] == '\"' )
{
m_MemoryTester = m_MemoryTester.substr(1, m_MemoryTester.size()-2);
this->MemoryTester
= this->MemoryTester.substr(1, this->MemoryTester.size()-2);
}
// Setup the options
if ( m_CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size() )
if ( this->CTest->GetCTestConfiguration(
"MemoryCheckCommandOptions").size() )
{
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration(
this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
"MemoryCheckCommandOptions");
}
else if ( m_CTest->GetCTestConfiguration("ValgrindCommandOptions").size() )
else if ( this->CTest->GetCTestConfiguration(
"ValgrindCommandOptions").size() )
{
m_MemoryTesterOptions = m_CTest->GetCTestConfiguration(
this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
"ValgrindCommandOptions");
}
m_MemoryTesterOutputFile
= m_CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
m_MemoryTesterOutputFile
= cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str());
this->MemoryTesterOutputFile
= this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
this->MemoryTesterOutputFile
= cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str());
if ( m_MemoryTester.find("valgrind") != std::string::npos )
if ( this->MemoryTester.find("valgrind") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
if ( !m_MemoryTesterOptions.size() )
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
if ( !this->MemoryTesterOptions.size() )
{
m_MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes "
this->MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes "
"--show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=100";
}
if ( m_CTest->GetCTestConfiguration("MemoryCheckSuppressionFile").size() )
if ( this->CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").size() )
{
if ( !cmSystemTools::FileExists(m_CTest->GetCTestConfiguration(
if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find memory checker suppression file: "
<< m_CTest->GetCTestConfiguration(
<< this->CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").c_str() << std::endl);
return false;
}
m_MemoryTesterOptions += " --suppressions=" +
cmSystemTools::EscapeSpaces(m_CTest->GetCTestConfiguration(
this->MemoryTesterOptions += " --suppressions=" +
cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration(
"MemoryCheckSuppressionFile").c_str()) + "";
}
}
else if ( m_MemoryTester.find("purify") != std::string::npos )
else if ( this->MemoryTester.find("purify") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
#ifdef _WIN32
m_MemoryTesterOptions += " /SAVETEXTDATA=" + m_MemoryTesterOutputFile;
this->MemoryTesterOptions += " /SAVETEXTDATA=" +
this->MemoryTesterOutputFile;
#else
m_MemoryTesterOptions += " -log-file=" + m_MemoryTesterOutputFile;
this->MemoryTesterOptions += " -log-file=" + this->MemoryTesterOutputFile;
#endif
}
else if ( m_MemoryTester.find("boundschecker") != std::string::npos )
else if ( this->MemoryTester.find("boundschecker") != std::string::npos )
{
m_MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
cmCTestLog(m_CTest, ERROR_MESSAGE, "Bounds checker not yet implemented"
<< std::endl);
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
cmCTestLog(this->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(this->CTest, ERROR_MESSAGE,
"Do not understand memory checker: " << this->MemoryTester.c_str()
<< std::endl);
return false;
}
m_MemoryTesterOptionsParsed
= cmSystemTools::ParseArguments(m_MemoryTesterOptions.c_str());
this->MemoryTesterOptionsParsed
= cmSystemTools::ParseArguments(this->MemoryTesterOptions.c_str());
std::vector<cmStdString>::size_type cc;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
m_MemoryTesterGlobalResults[cc] = 0;
this->MemoryTesterGlobalResults[cc] = 0;
}
return true;
}
@ -426,15 +433,16 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
results[cc] = 0;
}
if ( m_MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND )
if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND )
{
return this->ProcessMemCheckValgrindOutput(str, log, results);
}
else if ( m_MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY )
else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY )
{
return this->ProcessMemCheckPurifyOutput(str, log, results);
}
else if ( m_MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER )
else if ( this->MemoryTesterStyle ==
cmCTestMemCheckHandler::BOUNDS_CHECKER )
{
log.append("\nMemory checking style used was: ");
log.append("Bounds Checker");
@ -455,18 +463,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string&, std::string& log,
int* results)
{
if ( !cmSystemTools::FileExists(m_MemoryTesterOutputFile.c_str()) )
if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) )
{
log = "Cannot find Purify output file: " + m_MemoryTesterOutputFile;
cmCTestLog(m_CTest, ERROR_MESSAGE, log.c_str() << std::endl);
log = "Cannot find Purify output file: " + this->MemoryTesterOutputFile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
return false;
}
std::ifstream ifs(m_MemoryTesterOutputFile.c_str());
std::ifstream ifs(this->MemoryTesterOutputFile.c_str());
if ( !ifs )
{
log = "Cannot read Purify output file: " + m_MemoryTesterOutputFile;
cmCTestLog(m_CTest, ERROR_MESSAGE, log.c_str() << std::endl);
log = "Cannot read Purify output file: " + this->MemoryTesterOutputFile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
return false;
}
@ -494,7 +502,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unknown Purify memory fault: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown Purify memory fault: "
<< pfW.match(1) << std::endl);
ostr << "*** Unknown Purify memory fault: " << pfW.match(1)
<< std::endl;
@ -562,7 +570,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
"locked by a different thread");
double sttime = cmSystemTools::GetTime();
cmCTestLog(m_CTest, DEBUG, "Start test: " << lines.size() << std::endl);
cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl);
for ( cc = 0; cc < lines.size(); cc ++ )
{
if ( valgrindLine.find(lines[cc]) )
@ -630,7 +638,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
}
}
cmCTestLog(m_CTest, DEBUG, "End test (elapsed: "
cmCTestLog(this->CTest, DEBUG, "End test (elapsed: "
<< (cmSystemTools::GetTime() - sttime) << std::endl);
log = ostr.str();
if ( defects )

View File

@ -91,12 +91,12 @@ private:
COMPLETED
};
std::string m_MemoryTester;
std::vector<cmStdString> m_MemoryTesterOptionsParsed;
std::string m_MemoryTesterOptions;
int m_MemoryTesterStyle;
std::string m_MemoryTesterOutputFile;
int m_MemoryTesterGlobalResults[NO_MEMORY_FAULT];
std::string MemoryTester;
std::vector<cmStdString> MemoryTesterOptionsParsed;
std::string MemoryTesterOptions;
int MemoryTesterStyle;
std::string MemoryTesterOutputFile;
int MemoryTesterGlobalResults[NO_MEMORY_FAULT];
///! Initialize memory checking subsystem.
bool InitializeMemoryChecking();
@ -106,8 +106,8 @@ private:
*/
void GenerateDartOutput(std::ostream& os);
std::vector<cmStdString> m_CustomPreMemCheck;
std::vector<cmStdString> m_CustomPostMemCheck;
std::vector<cmStdString> CustomPreMemCheck;
std::vector<cmStdString> CustomPostMemCheck;
//! Parse Valgrind/Purify/Bounds Checker result out of the output
//string. After running, log holds the output and results hold the

View File

@ -23,7 +23,7 @@ bool cmCTestRunScriptCommand::InitialPass(
{
if(args.size() < 1 )
{
m_CTestScriptHandler->RunCurrentScript();
this->CTestScriptHandler->RunCurrentScript();
return true;
}
@ -31,7 +31,7 @@ bool cmCTestRunScriptCommand::InitialPass(
unsigned int i;
for (i = 0; i < args.size(); ++i)
{
cmCTestScriptHandler::RunScript(m_CTest, args[i].c_str());
cmCTestScriptHandler::RunScript(this->CTest, args[i].c_str());
}
return true;
}

View File

@ -37,8 +37,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -68,77 +68,77 @@ public:
//virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
//virtual void ScopeEnded(cmMakefile &mf);
cmCTestScriptHandler* m_CTestScriptHandler;
cmCTestScriptHandler* CTestScriptHandler;
};
// simply update the time and don't block anything
bool cmCTestScriptFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& , cmMakefile &)
{
m_CTestScriptHandler->UpdateElapsedTime();
this->CTestScriptHandler->UpdateElapsedTime();
return false;
}
//----------------------------------------------------------------------
cmCTestScriptHandler::cmCTestScriptHandler()
{
m_Backup = false;
m_EmptyBinDir = false;
m_EmptyBinDirOnce = false;
m_Makefile = 0;
m_LocalGenerator = 0;
m_CMake = 0;
m_GlobalGenerator = 0;
this->Backup = false;
this->EmptyBinDir = false;
this->EmptyBinDirOnce = false;
this->Makefile = 0;
this->LocalGenerator = 0;
this->CMake = 0;
this->GlobalGenerator = 0;
m_ScriptStartTime = 0;
this->ScriptStartTime = 0;
// the *60 is becuase the settings are in minutes but GetTime is seconds
m_MinimumInterval = 30*60;
m_ContinuousDuration = -1;
this->MinimumInterval = 30*60;
this->ContinuousDuration = -1;
}
//----------------------------------------------------------------------
void cmCTestScriptHandler::Initialize()
{
this->Superclass::Initialize();
m_Backup = false;
m_EmptyBinDir = false;
m_EmptyBinDirOnce = false;
this->Backup = false;
this->EmptyBinDir = false;
this->EmptyBinDirOnce = false;
m_SourceDir = "";
m_BinaryDir = "";
m_BackupSourceDir = "";
m_BackupBinaryDir = "";
m_CTestRoot = "";
m_CVSCheckOut = "";
m_CTestCmd = "";
m_CVSCmd = "";
m_CTestEnv = "";
m_InitCache = "";
m_CMakeCmd = "";
m_CMOutFile = "";
m_ExtraUpdates.clear();
this->SourceDir = "";
this->BinaryDir = "";
this->BackupSourceDir = "";
this->BackupBinaryDir = "";
this->CTestRoot = "";
this->CVSCheckOut = "";
this->CTestCmd = "";
this->CVSCmd = "";
this->CTestEnv = "";
this->InitCache = "";
this->CMakeCmd = "";
this->CMOutFile = "";
this->ExtraUpdates.clear();
m_MinimumInterval = 20*60;
m_ContinuousDuration = -1;
this->MinimumInterval = 20*60;
this->ContinuousDuration = -1;
// what time in seconds did this script start running
m_ScriptStartTime = 0;
this->ScriptStartTime = 0;
m_Makefile = 0;
if (m_LocalGenerator)
this->Makefile = 0;
if (this->LocalGenerator)
{
delete m_LocalGenerator;
delete this->LocalGenerator;
}
m_LocalGenerator = 0;
if (m_GlobalGenerator)
this->LocalGenerator = 0;
if (this->GlobalGenerator)
{
delete m_GlobalGenerator;
delete this->GlobalGenerator;
}
m_GlobalGenerator = 0;
if (m_CMake)
this->GlobalGenerator = 0;
if (this->CMake)
{
delete m_CMake;
delete this->CMake;
}
}
@ -146,20 +146,20 @@ void cmCTestScriptHandler::Initialize()
cmCTestScriptHandler::~cmCTestScriptHandler()
{
// local generator owns the makefile
m_Makefile = 0;
if (m_LocalGenerator)
this->Makefile = 0;
if (this->LocalGenerator)
{
delete m_LocalGenerator;
delete this->LocalGenerator;
}
m_LocalGenerator = 0;
if (m_GlobalGenerator)
this->LocalGenerator = 0;
if (this->GlobalGenerator)
{
delete m_GlobalGenerator;
delete this->GlobalGenerator;
}
m_GlobalGenerator = 0;
if (m_CMake)
this->GlobalGenerator = 0;
if (this->CMake)
{
delete m_CMake;
delete this->CMake;
}
}
@ -168,7 +168,7 @@ cmCTestScriptHandler::~cmCTestScriptHandler()
// just adds an argument to the vector
void cmCTestScriptHandler::AddConfigurationScript(const char *script)
{
m_ConfigurationScripts.push_back(script);
this->ConfigurationScripts.push_back(script);
}
@ -179,8 +179,8 @@ int cmCTestScriptHandler::ProcessHandler()
{
int res = 0;
std::vector<cmStdString>::iterator it;
for ( it = m_ConfigurationScripts.begin();
it != m_ConfigurationScripts.end();
for ( it = this->ConfigurationScripts.begin();
it != this->ConfigurationScripts.end();
it ++ )
{
// for each script run it
@ -196,14 +196,14 @@ int cmCTestScriptHandler::ProcessHandler()
void cmCTestScriptHandler::UpdateElapsedTime()
{
if (m_LocalGenerator)
if (this->LocalGenerator)
{
// set the current elapsed time
char timeString[20];
int itime = static_cast<unsigned int>(cmSystemTools::GetTime()
- m_ScriptStartTime);
- this->ScriptStartTime);
sprintf(timeString,"%i",itime);
m_LocalGenerator->GetMakefile()->AddDefinition("CTEST_ELAPSED_TIME",
this->LocalGenerator->GetMakefile()->AddDefinition("CTEST_ELAPSED_TIME",
timeString);
}
}
@ -212,9 +212,9 @@ void cmCTestScriptHandler::UpdateElapsedTime()
void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
{
cmCTestCommand* newCom = command;
newCom->m_CTest = m_CTest;
newCom->m_CTestScriptHandler = this;
m_CMake->AddCommand(newCom);
newCom->CTest = this->CTest;
newCom->CTestScriptHandler = this;
this->CMake->AddCommand(newCom);
}
//----------------------------------------------------------------------
@ -242,31 +242,31 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// create a cmake instance to read the configuration script
// read in the list file to fill the cache
if (m_CMake)
if (this->CMake)
{
delete m_CMake;
delete m_GlobalGenerator;
delete m_LocalGenerator;
delete this->CMake;
delete this->GlobalGenerator;
delete this->LocalGenerator;
}
m_CMake = new cmake;
m_CMake->AddCMakePaths(m_CTest->GetCTestExecutable());
m_GlobalGenerator = new cmGlobalGenerator;
m_GlobalGenerator->SetCMakeInstance(m_CMake);
this->CMake = new cmake;
this->CMake->AddCMakePaths(this->CTest->GetCTestExecutable());
this->GlobalGenerator = new cmGlobalGenerator;
this->GlobalGenerator->SetCMakeInstance(this->CMake);
m_LocalGenerator = m_GlobalGenerator->CreateLocalGenerator();
m_LocalGenerator->SetGlobalGenerator(m_GlobalGenerator);
m_Makefile = m_LocalGenerator->GetMakefile();
this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
this->LocalGenerator->SetGlobalGenerator(this->GlobalGenerator);
this->Makefile = this->LocalGenerator->GetMakefile();
// set a variable with the path to the current script
m_Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
this->Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
cmSystemTools::GetFilenamePath(script).c_str());
m_Makefile->AddDefinition("CTEST_SCRIPT_NAME",
this->Makefile->AddDefinition("CTEST_SCRIPT_NAME",
cmSystemTools::GetFilenameName(script).c_str());
m_Makefile->AddDefinition("CTEST_EXECUTABLE_NAME",
m_CTest->GetCTestExecutable());
m_Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME",
m_CTest->GetCMakeExecutable());
m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
this->Makefile->AddDefinition("CTEST_EXECUTABLE_NAME",
this->CTest->GetCTestExecutable());
this->Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME",
this->CTest->GetCMakeExecutable());
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
this->UpdateElapsedTime();
// add any ctest specific commands, probably should have common superclass
@ -287,16 +287,16 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// add the script arg if defined
if (script_arg.size())
{
m_Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
}
// always add a function blocker to update the elapsed time
cmCTestScriptFunctionBlocker *f = new cmCTestScriptFunctionBlocker();
f->m_CTestScriptHandler = this;
m_Makefile->AddFunctionBlocker(f);
f->CTestScriptHandler = this;
this->Makefile->AddFunctionBlocker(f);
// finally read in the script
if (!m_Makefile->ReadListFile(0, script.c_str()))
if (!this->Makefile->ReadListFile(0, script.c_str()))
{
return 2;
}
@ -313,47 +313,59 @@ int cmCTestScriptHandler::ExtractVariables()
const char* minInterval;
const char* contDuration;
m_SourceDir = m_Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
m_BinaryDir = m_Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
m_CTestCmd = m_Makefile->GetSafeDefinition("CTEST_COMMAND");
m_CVSCheckOut = m_Makefile->GetSafeDefinition("CTEST_CVS_CHECKOUT");
m_CTestRoot = m_Makefile->GetSafeDefinition("CTEST_DASHBOARD_ROOT");
m_CVSCmd = m_Makefile->GetSafeDefinition("CTEST_CVS_COMMAND");
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");
this->SourceDir
= this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
this->BinaryDir
= this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
this->CTestCmd
= this->Makefile->GetSafeDefinition("CTEST_COMMAND");
this->CVSCheckOut
= this->Makefile->GetSafeDefinition("CTEST_CVS_CHECKOUT");
this->CTestRoot
= this->Makefile->GetSafeDefinition("CTEST_DASHBOARD_ROOT");
this->CVSCmd
= this->Makefile->GetSafeDefinition("CTEST_CVS_COMMAND");
this->CTestEnv
= this->Makefile->GetSafeDefinition("CTEST_ENVIRONMENT");
this->InitCache
= this->Makefile->GetSafeDefinition("CTEST_INITIAL_CACHE");
this->CMakeCmd
= this->Makefile->GetSafeDefinition("CTEST_CMAKE_COMMAND");
this->CMOutFile
= this->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");
this->Backup
= this->Makefile->IsOn("CTEST_BACKUP_AND_RESTORE");
this->EmptyBinDir
= this->Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY");
this->EmptyBinDirOnce
= this->Makefile->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE");
minInterval
= m_Makefile->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL");
contDuration = m_Makefile->GetDefinition("CTEST_CONTINUOUS_DURATION");
= this->Makefile->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL");
contDuration
= this->Makefile->GetDefinition("CTEST_CONTINUOUS_DURATION");
char updateVar[40];
int i;
for (i = 1; i < 10; ++i)
{
sprintf(updateVar,"CTEST_EXTRA_UPDATES_%i",i);
const char *updateVal = m_Makefile->GetDefinition(updateVar);
const char *updateVal = this->Makefile->GetDefinition(updateVar);
if ( updateVal )
{
if ( m_CVSCmd.empty() )
if ( this->CVSCmd.empty() )
{
cmSystemTools::Error(updateVar,
" specified without specifying CTEST_CVS_COMMAND.");
return 12;
}
m_ExtraUpdates.push_back(updateVal);
this->ExtraUpdates.push_back(updateVal);
}
}
// in order to backup and restore we also must have the cvs root
if (m_Backup && m_CVSCheckOut.empty())
if (this->Backup && this->CVSCheckOut.empty())
{
cmSystemTools::Error(
"Backup was requested without specifying CTEST_CVS_CHECKOUT.");
@ -361,37 +373,37 @@ int cmCTestScriptHandler::ExtractVariables()
}
// make sure the required info is here
if (this->m_SourceDir.empty() ||
this->m_BinaryDir.empty() ||
this->m_CTestCmd.empty())
if (this->SourceDir.empty() ||
this->BinaryDir.empty() ||
this->CTestCmd.empty())
{
std::string message = "CTEST_SOURCE_DIRECTORY = ";
message += (!m_SourceDir.empty()) ? m_SourceDir.c_str() : "(Null)";
message += "\nCTEST_BINARY_DIRECTORY = ";
message += (!m_BinaryDir.empty()) ? m_BinaryDir.c_str() : "(Null)";
message += "\nCTEST_COMMAND = ";
message += (!m_CTestCmd.empty()) ? m_CTestCmd.c_str() : "(Null)";
std::string msg = "CTEST_SOURCE_DIRECTORY = ";
msg += (!this->SourceDir.empty()) ? this->SourceDir.c_str() : "(Null)";
msg += "\nCTEST_BINARY_DIRECTORY = ";
msg += (!this->BinaryDir.empty()) ? this->BinaryDir.c_str() : "(Null)";
msg += "\nCTEST_COMMAND = ";
msg += (!this->CTestCmd.empty()) ? this->CTestCmd.c_str() : "(Null)";
cmSystemTools::Error(
"Some required settings in the configuration file were missing:\n",
message.c_str());
msg.c_str());
return 4;
}
// if the dashboard root isn't specified then we can compute it from the
// m_SourceDir
if (m_CTestRoot.empty() )
// this->SourceDir
if (this->CTestRoot.empty() )
{
m_CTestRoot = cmSystemTools::GetFilenamePath(m_SourceDir).c_str();
this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir).c_str();
}
// the script may override the minimum continuous interval
if (minInterval)
{
m_MinimumInterval = 60 * atof(minInterval);
this->MinimumInterval = 60 * atof(minInterval);
}
if (contDuration)
{
m_ContinuousDuration = 60.0 * atof(contDuration);
this->ContinuousDuration = 60.0 * atof(contDuration);
}
@ -417,7 +429,7 @@ int cmCTestScriptHandler::RunConfigurationScript(
{
int result;
m_ScriptStartTime =
this->ScriptStartTime =
cmSystemTools::GetTime();
// read in the script
@ -428,7 +440,7 @@ int cmCTestScriptHandler::RunConfigurationScript(
}
// only run the curent script if we should
if (m_Makefile && m_Makefile->IsOn("CTEST_RUN_CURRENT_SCRIPT"))
if (this->Makefile && this->Makefile->IsOn("CTEST_RUN_CURRENT_SCRIPT"))
{
return this->RunCurrentScript();
}
@ -441,7 +453,7 @@ int cmCTestScriptHandler::RunCurrentScript()
int result;
// do not run twice
m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", false);
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", false);
// no popup widows
cmSystemTools::SetRunCommandHideConsole(true);
@ -454,10 +466,10 @@ int cmCTestScriptHandler::RunCurrentScript()
}
// set any environment variables
if (!m_CTestEnv.empty())
if (!this->CTestEnv.empty())
{
std::vector<std::string> envArgs;
cmSystemTools::ExpandListArgument(m_CTestEnv.c_str(),envArgs);
cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs);
// for each variable/argument do a putenv
for (unsigned i = 0; i < envArgs.size(); ++i)
{
@ -468,27 +480,27 @@ int cmCTestScriptHandler::RunCurrentScript()
// now that we have done most of the error checking finally run the
// dashboard, we may be asked to repeatedly run this dashboard, such as
// for a continuous, do we ned to run it more than once?
if ( m_ContinuousDuration >= 0 )
if ( this->ContinuousDuration >= 0 )
{
this->UpdateElapsedTime();
double ending_time = cmSystemTools::GetTime() + m_ContinuousDuration;
if (m_EmptyBinDirOnce)
double ending_time = cmSystemTools::GetTime() + this->ContinuousDuration;
if (this->EmptyBinDirOnce)
{
m_EmptyBinDir = true;
this->EmptyBinDir = true;
}
do
{
double interval = cmSystemTools::GetTime();
result = this->RunConfigurationDashboard();
interval = cmSystemTools::GetTime() - interval;
if (interval < m_MinimumInterval)
if (interval < this->MinimumInterval)
{
this->SleepInSeconds(
static_cast<unsigned int>(m_MinimumInterval - interval));
static_cast<unsigned int>(this->MinimumInterval - interval));
}
if (m_EmptyBinDirOnce)
if (this->EmptyBinDirOnce)
{
m_EmptyBinDir = false;
this->EmptyBinDir = false;
}
}
while (cmSystemTools::GetTime() < ending_time);
@ -510,16 +522,16 @@ int cmCTestScriptHandler::CheckOutSourceDir()
int retVal;
bool res;
if (!cmSystemTools::FileExists(m_SourceDir.c_str()) &&
!m_CVSCheckOut.empty())
if (!cmSystemTools::FileExists(this->SourceDir.c_str()) &&
!this->CVSCheckOut.empty())
{
// we must now checkout the src dir
output = "";
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*/);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run cvs: " << this->CVSCheckOut << std::endl);
res = cmSystemTools::RunSingleCommand(this->CVSCheckOut.c_str(), &output,
&retVal, this->CTestRoot.c_str(), this->HandlerVerbose,
0 /*this->TimeOut*/);
if (!res || retVal != 0)
{
cmSystemTools::Error("Unable to perform cvs checkout:\n",
@ -536,27 +548,27 @@ int cmCTestScriptHandler::BackupDirectories()
int retVal;
// compute the backup names
m_BackupSourceDir = m_SourceDir;
m_BackupSourceDir += "_CMakeBackup";
m_BackupBinaryDir = m_BinaryDir;
m_BackupBinaryDir += "_CMakeBackup";
this->BackupSourceDir = this->SourceDir;
this->BackupSourceDir += "_CMakeBackup";
this->BackupBinaryDir = this->BinaryDir;
this->BackupBinaryDir += "_CMakeBackup";
// backup the binary and src directories if requested
if (m_Backup)
if (this->Backup)
{
// if for some reason those directories exist then first delete them
if (cmSystemTools::FileExists(m_BackupSourceDir.c_str()))
if (cmSystemTools::FileExists(this->BackupSourceDir.c_str()))
{
cmSystemTools::RemoveADirectory(m_BackupSourceDir.c_str());
cmSystemTools::RemoveADirectory(this->BackupSourceDir.c_str());
}
if (cmSystemTools::FileExists(m_BackupBinaryDir.c_str()))
if (cmSystemTools::FileExists(this->BackupBinaryDir.c_str()))
{
cmSystemTools::RemoveADirectory(m_BackupBinaryDir.c_str());
cmSystemTools::RemoveADirectory(this->BackupBinaryDir.c_str());
}
// first rename the src and binary directories
rename(m_SourceDir.c_str(), m_BackupSourceDir.c_str());
rename(m_BinaryDir.c_str(), m_BackupBinaryDir.c_str());
rename(this->SourceDir.c_str(), this->BackupSourceDir.c_str());
rename(this->BinaryDir.c_str(), this->BackupBinaryDir.c_str());
// we must now checkout the src dir
retVal = this->CheckOutSourceDir();
@ -580,9 +592,11 @@ int cmCTestScriptHandler::PerformExtraUpdates()
bool res;
// do an initial cvs update as required
command = m_CVSCmd;
command = this->CVSCmd;
std::vector<cmStdString>::iterator it;
for (it = m_ExtraUpdates.begin(); it != m_ExtraUpdates.end(); ++ it )
for (it = this->ExtraUpdates.begin();
it != this->ExtraUpdates.end();
++ it )
{
std::vector<std::string> cvsArgs;
cmSystemTools::ExpandListArgument(it->c_str(),cvsArgs);
@ -593,11 +607,11 @@ int cmCTestScriptHandler::PerformExtraUpdates()
fullCommand += cvsArgs[1];
output = "";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run CVS: "
cmCTestLog(this->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*/);
this->HandlerVerbose, 0 /*this->TimeOut*/);
if (!res || retVal != 0)
{
cmSystemTools::Error("Unable to perform extra cvs updates:\n",
@ -636,23 +650,24 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
}
// clear the binary directory?
if (m_EmptyBinDir)
if (this->EmptyBinDir)
{
if ( !cmCTestScriptHandler::EmptyBinaryDirectory(m_BinaryDir.c_str()) )
if ( !cmCTestScriptHandler::EmptyBinaryDirectory(
this->BinaryDir.c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Problem removing the binary directory" << std::endl);
}
}
// make sure the binary directory exists if it isn't the srcdir
if (!cmSystemTools::FileExists(m_BinaryDir.c_str()) &&
m_SourceDir != m_BinaryDir)
if (!cmSystemTools::FileExists(this->BinaryDir.c_str()) &&
this->SourceDir != this->BinaryDir)
{
if (!cmSystemTools::MakeDirectory(m_BinaryDir.c_str()))
if (!cmSystemTools::MakeDirectory(this->BinaryDir.c_str()))
{
cmSystemTools::Error("Unable to create the binary directory:\n",
m_BinaryDir.c_str());
this->BinaryDir.c_str());
this->RestoreBackupDirectories();
return 7;
}
@ -661,10 +676,10 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// if the binary directory and the source directory are the same,
// and we are starting with an empty binary directory, then that means
// we must check out the source tree
if (m_EmptyBinDir && m_SourceDir == m_BinaryDir)
if (this->EmptyBinDir && this->SourceDir == this->BinaryDir)
{
// make sure we have the required info
if (m_CVSCheckOut.empty())
if (this->CVSCheckOut.empty())
{
cmSystemTools::Error("You have specified the source and binary "
"directories to be the same (an in source build). You have also "
@ -691,9 +706,9 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
}
// put the initial cache into the bin dir
if (!m_InitCache.empty())
if (!this->InitCache.empty())
{
std::string cacheFile = m_BinaryDir;
std::string cacheFile = this->BinaryDir;
cacheFile += "/CMakeCache.txt";
cmGeneratedFileStream fout(cacheFile.c_str());
if(!fout)
@ -702,7 +717,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
return 9;
}
fout.write(m_InitCache.c_str(), m_InitCache.size());
fout.write(this->InitCache.c_str(), this->InitCache.size());
// Make sure the operating system has finished writing the file
// before closing it. This will ensure the file is finished before
@ -714,29 +729,29 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// do an initial cmake to setup the DartConfig file
int cmakeFailed = 0;
std::string cmakeFailedOuput;
if (!m_CMakeCmd.empty())
if (!this->CMakeCmd.empty())
{
command = m_CMakeCmd;
command = this->CMakeCmd;
command += " \"";
command += m_SourceDir;
command += this->SourceDir;
output = "";
command += "\"";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run cmake command: "
cmCTestLog(this->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*/);
&retVal, this->BinaryDir.c_str(),
this->HandlerVerbose, 0 /*this->TimeOut*/);
if ( !m_CMOutFile.empty() )
if ( !this->CMOutFile.empty() )
{
std::string cmakeOutputFile = m_CMOutFile;
std::string cmakeOutputFile = this->CMOutFile;
if ( !cmSystemTools::FileIsFullPath(cmakeOutputFile.c_str()) )
{
cmakeOutputFile = m_BinaryDir + "/" + cmakeOutputFile;
cmakeOutputFile = this->BinaryDir + "/" + cmakeOutputFile;
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Write CMake output to file: " << cmakeOutputFile.c_str()
<< std::endl);
cmGeneratedFileStream fout(cmakeOutputFile.c_str());
@ -746,7 +761,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open CMake output file: "
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot open CMake output file: "
<< cmakeOutputFile.c_str() << " for writing" << std::endl);
}
}
@ -760,18 +776,18 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// run ctest, it may be more than one command in here
std::vector<std::string> ctestCommands;
cmSystemTools::ExpandListArgument(m_CTestCmd,ctestCommands);
cmSystemTools::ExpandListArgument(this->CTestCmd,ctestCommands);
// for each variable/argument do a putenv
for (unsigned i = 0; i < ctestCommands.size(); ++i)
{
command = ctestCommands[i];
output = "";
retVal = 0;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run ctest command: "
cmCTestLog(this->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*/);
&retVal, this->BinaryDir.c_str(), this->HandlerVerbose,
0 /*this->TimeOut*/);
// did something critical fail in ctest
if (!res || cmakeFailed ||
@ -780,11 +796,13 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
this->RestoreBackupDirectories();
if (cmakeFailed)
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unable to run cmake:" << std::endl
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Unable to run cmake:" << std::endl
<< cmakeFailedOuput.c_str() << std::endl);
return 10;
}
cmCTestLog(m_CTest, ERROR_MESSAGE, "Unable to run ctest:" << std::endl
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Unable to run ctest:" << std::endl
<< output.c_str() << std::endl);
if (!res)
{
@ -795,10 +813,10 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
}
// if all was succesful, delete the backup dirs to free up disk space
if (m_Backup)
if (this->Backup)
{
cmSystemTools::RemoveADirectory(m_BackupSourceDir.c_str());
cmSystemTools::RemoveADirectory(m_BackupBinaryDir.c_str());
cmSystemTools::RemoveADirectory(this->BackupSourceDir.c_str());
cmSystemTools::RemoveADirectory(this->BackupBinaryDir.c_str());
}
return 0;
@ -810,20 +828,20 @@ void cmCTestScriptHandler::RestoreBackupDirectories()
{
// if we backed up the dirs and the build failed, then restore
// the backed up dirs
if (m_Backup)
if (this->Backup)
{
// if for some reason those directories exist then first delete them
if (cmSystemTools::FileExists(m_SourceDir.c_str()))
if (cmSystemTools::FileExists(this->SourceDir.c_str()))
{
cmSystemTools::RemoveADirectory(m_SourceDir.c_str());
cmSystemTools::RemoveADirectory(this->SourceDir.c_str());
}
if (cmSystemTools::FileExists(m_BinaryDir.c_str()))
if (cmSystemTools::FileExists(this->BinaryDir.c_str()))
{
cmSystemTools::RemoveADirectory(m_BinaryDir.c_str());
cmSystemTools::RemoveADirectory(this->BinaryDir.c_str());
}
// rename the src and binary directories
rename(m_BackupSourceDir.c_str(), m_SourceDir.c_str());
rename(m_BackupBinaryDir.c_str(), m_BinaryDir.c_str());
rename(this->BackupSourceDir.c_str(), this->SourceDir.c_str());
rename(this->BackupBinaryDir.c_str(), this->BinaryDir.c_str());
}
}

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -50,7 +50,7 @@ class cmCTestCommand;
* CTEST_INITIAL_CACHE
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE
*
*
* In addition the following variables can be used. The number can be 1-10.
* CTEST_EXTRA_UPDATES_1
* CTEST_EXTRA_UPDATES_2
@ -83,7 +83,7 @@ public:
*/
static bool RunScript(cmCTest* ctest, const char *script);
int RunCurrentScript();
/*
* Empty Binary Directory
*/
@ -97,7 +97,7 @@ public:
cmCTestScriptHandler();
~cmCTestScriptHandler();
void Initialize();
private:
// reads in a script
@ -111,7 +111,7 @@ private:
// perform any extra cvs updates that were requested
int PerformExtraUpdates();
// backup and restore dirs
int BackupDirectories();
void RestoreBackupDirectories();
@ -122,36 +122,36 @@ private:
// Add ctest command
void AddCTestCommand(cmCTestCommand* command);
std::vector<cmStdString> m_ConfigurationScripts;
std::vector<cmStdString> ConfigurationScripts;
bool m_Backup;
bool m_EmptyBinDir;
bool m_EmptyBinDirOnce;
cmStdString m_SourceDir;
cmStdString m_BinaryDir;
cmStdString m_BackupSourceDir;
cmStdString m_BackupBinaryDir;
cmStdString m_CTestRoot;
cmStdString m_CVSCheckOut;
cmStdString m_CTestCmd;
cmStdString m_CVSCmd;
cmStdString m_CTestEnv;
cmStdString m_InitCache;
cmStdString m_CMakeCmd;
cmStdString m_CMOutFile;
std::vector<cmStdString> m_ExtraUpdates;
bool Backup;
bool EmptyBinDir;
bool EmptyBinDirOnce;
double m_MinimumInterval;
double m_ContinuousDuration;
cmStdString SourceDir;
cmStdString BinaryDir;
cmStdString BackupSourceDir;
cmStdString BackupBinaryDir;
cmStdString CTestRoot;
cmStdString CVSCheckOut;
cmStdString CTestCmd;
cmStdString CVSCmd;
cmStdString CTestEnv;
cmStdString InitCache;
cmStdString CMakeCmd;
cmStdString CMOutFile;
std::vector<cmStdString> ExtraUpdates;
double MinimumInterval;
double ContinuousDuration;
// what time in seconds did this script start running
double m_ScriptStartTime;
cmMakefile *m_Makefile;
cmLocalGenerator *m_LocalGenerator;
cmGlobalGenerator *m_GlobalGenerator;
cmake *m_CMake;
double ScriptStartTime;
cmMakefile *Makefile;
cmLocalGenerator *LocalGenerator;
cmGlobalGenerator *GlobalGenerator;
cmake *CMake;
};
#endif

View File

@ -34,7 +34,7 @@ bool cmCTestSleepCommand::InitialPass(
{
cmCTestScriptHandler::SleepInSeconds(time1);
// update the elapsed time since it could have slept for a while
m_CTestScriptHandler->UpdateElapsedTime();
this->CTestScriptHandler->UpdateElapsedTime();
return true;
}
@ -48,7 +48,7 @@ bool cmCTestSleepCommand::InitialPass(
duration = (time1 + duration - time2);
cmCTestScriptHandler::SleepInSeconds(duration);
// update the elapsed time since it could have slept for a while
m_CTestScriptHandler->UpdateElapsedTime();
this->CTestScriptHandler->UpdateElapsedTime();
}
return true;
}

View File

@ -37,8 +37,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestSleepCommand* ni = new cmCTestSleepCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -66,22 +66,22 @@ bool cmCTestStartCommand::InitialPass(
"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);
this->CTest->EmptyCTestConfiguration();
this->CTest->SetCTestConfiguration("SourceDirectory", src_dir);
this->CTest->SetCTestConfiguration("BuildDirectory", bld_dir);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel
<< std::endl
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
<< smodel << std::endl
<< " Source directory: " << src_dir << std::endl
<< " Build directory: " << bld_dir << std::endl);
m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
m_CTest->SetSuppressUpdatingCTestConfiguration(true);
int model = m_CTest->GetTestModelFromString(smodel);
m_CTest->SetTestModel(model);
m_CTest->SetProduceXML(true);
this->CTest->SetSuppressUpdatingCTestConfiguration(true);
int model = this->CTest->GetTestModelFromString(smodel);
this->CTest->SetTestModel(model);
this->CTest->SetProduceXML(true);
return m_CTest->InitializeFromCommand(this, true);
return this->CTest->InitializeFromCommand(this, true);
}

View File

@ -36,8 +36,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestStartCommand* ni = new cmCTestStartCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -77,20 +77,20 @@ bool cmCTestSubmitCommand::InitialPass(
{
ctestTriggerSite
= "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "* Use default trigger site: "
cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: "
<< ctestTriggerSite << std::endl;);
}
m_CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
m_CTest->SetCTestConfiguration("DropSite", ctestDropSite);
m_CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
m_CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite);
this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite);
this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite);
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"DropSiteUser", "CTEST_DROP_SITE_USER");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"DropSitePassword", "CTEST_DROP_SITE_PASSWORD");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"ScpCommand", "CTEST_SCP_COMMAND");
const char* notesFilesVariable
@ -107,7 +107,7 @@ bool cmCTestSubmitCommand::InitialPass(
{
newNotesFiles.push_back(*it);
}
m_CTest->GenerateNotesFile(newNotesFiles);
this->CTest->GenerateNotesFile(newNotesFiles);
}
const char* extraFilesVariable
= m_Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
@ -123,14 +123,15 @@ bool cmCTestSubmitCommand::InitialPass(
{
newExtraFiles.push_back(*it);
}
if ( !m_CTest->SubmitExtraFiles(newExtraFiles))
if ( !this->CTest->SubmitExtraFiles(newExtraFiles))
{
this->SetError("problem submitting extra files.");
return false;
}
}
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("submit");
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("submit");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate submit handler");

View File

@ -37,8 +37,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -61,26 +61,26 @@ cmCTestSubmitHandlerCurlDebugCallback(CURL *, curl_infotype, char *chPtr,
}
//----------------------------------------------------------------------------
cmCTestSubmitHandler::cmCTestSubmitHandler() : m_HTTPProxy(), m_FTPProxy()
cmCTestSubmitHandler::cmCTestSubmitHandler() : HTTPProxy(), FTPProxy()
{
m_HTTPProxy = "";
m_HTTPProxyType = 0;
m_HTTPProxyAuth = "";
this->HTTPProxy = "";
this->HTTPProxyType = 0;
this->HTTPProxyAuth = "";
m_FTPProxy = "";
m_FTPProxyType = 0;
this->FTPProxy = "";
this->FTPProxyType = 0;
}
//----------------------------------------------------------------------------
void cmCTestSubmitHandler::Initialize()
{
this->Superclass::Initialize();
m_HTTPProxy = "";
m_HTTPProxyType = 0;
m_HTTPProxyAuth = "";
m_FTPProxy = "";
m_FTPProxyType = 0;
m_LogFile = 0;
this->HTTPProxy = "";
this->HTTPProxyType = 0;
this->HTTPProxyAuth = "";
this->FTPProxy = "";
this->FTPProxyType = 0;
this->LogFile = 0;
}
//----------------------------------------------------------------------------
@ -97,7 +97,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
cmCTest::tm_SetOfStrings::const_iterator file;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
/* get a curl handle */
@ -105,10 +105,10 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
if(curl)
{
// Using proxy
if ( m_FTPProxyType > 0 )
if ( this->FTPProxyType > 0 )
{
curl_easy_setopt(curl, CURLOPT_PROXY, m_FTPProxy.c_str());
switch (m_FTPProxyType)
curl_easy_setopt(curl, CURLOPT_PROXY, this->FTPProxy.c_str());
switch (this->FTPProxyType)
{
case 2:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
@ -135,7 +135,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
@ -143,9 +143,9 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
}
ftpfile = ::fopen(local_file.c_str(), "rb");
*m_LogFile << "\tUpload file: " << local_file.c_str() << " to "
*this->LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << std::endl;
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << std::endl);
@ -181,13 +181,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl);
}
@ -195,16 +195,18 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
fclose(ftpfile);
if ( res )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: "
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Error when uploading file: "
<< local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str()
*this->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;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
@ -213,7 +215,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
}
// always cleanup
::curl_easy_cleanup(curl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
<< std::endl);
}
}
@ -237,7 +239,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
::curl_global_init(CURL_GLOBAL_ALL);
cmStdString::size_type kk;
cmCTest::tm_SetOfStrings::const_iterator file;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
/* get a curl handle */
@ -246,10 +248,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
{
// Using proxy
if ( m_HTTPProxyType > 0 )
if ( this->HTTPProxyType > 0 )
{
curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str());
switch (m_HTTPProxyType)
curl_easy_setopt(curl, CURLOPT_PROXY, this->HTTPProxy.c_str());
switch (this->HTTPProxyType)
{
case 2:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
@ -259,10 +261,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (m_HTTPProxyAuth.size() > 0)
if (this->HTTPProxyAuth.size() > 0)
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
m_HTTPProxyAuth.c_str());
this->HTTPProxyAuth.c_str());
}
}
}
@ -282,7 +284,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
cmStdString remote_file
= remoteprefix + cmSystemTools::GetFilenameName(*file);
*m_LogFile << "\tUpload file: " << local_file.c_str() << " to "
*this->LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< remote_file.c_str() << std::endl;
cmStdString ofile = "";
@ -315,7 +317,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot find file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
::curl_easy_cleanup(curl);
::curl_global_cleanup();
@ -323,7 +325,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
ftpfile = ::fopen(local_file.c_str(), "rb");
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << " Size: " << st.st_size << std::endl);
@ -358,13 +360,13 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl);
}
@ -372,16 +374,18 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
fclose(ftpfile);
if ( res )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error when uploading file: "
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Error when uploading file: "
<< local_file.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*m_LogFile << " Error when uploading file: " << local_file.c_str()
*this->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;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
@ -390,7 +394,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
// always cleanup
::curl_easy_cleanup(curl);
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file
<< std::endl);
}
}
@ -410,7 +414,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
cmCTest::tm_SetOfStrings::const_iterator file;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
/* get a curl handle */
@ -418,10 +422,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
if(curl)
{
// Using proxy
if ( m_HTTPProxyType > 0 )
if ( this->HTTPProxyType > 0 )
{
curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str());
switch (m_HTTPProxyType)
curl_easy_setopt(curl, CURLOPT_PROXY, this->HTTPProxy.c_str());
switch (this->HTTPProxyType)
{
case 2:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
@ -431,10 +435,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (m_HTTPProxyAuth.size() > 0)
if (this->HTTPProxyAuth.size() > 0)
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
m_HTTPProxyAuth.c_str());
this->HTTPProxyAuth.c_str());
}
}
}
@ -485,22 +489,22 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
cmStdString turl
= 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: "
*this->LogFile << "Trigger url: " << turl.c_str() << std::endl;
cmCTestLog(this->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: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when triggering: "
<< turl.c_str() << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Error message was: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*m_LogFile << "\tTrigerring failed with error: " << error_buffer
*this->LogFile << "\tTrigerring failed with error: " << error_buffer
<< std::endl
<< " Error message was: " << error_buffer << std::endl
<< " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
cmCTestLog(m_CTest, ERROR_MESSAGE, "CURL output: ["
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
::curl_easy_cleanup(curl);
@ -510,24 +514,24 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
if ( chunk.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL output: ["
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
{
cmCTestLog(m_CTest, DEBUG, "CURL debug output: ["
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size())
<< "]" << std::endl);
}
// always cleanup
::curl_easy_cleanup(curl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
}
}
::curl_global_cleanup();
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Dart server triggered..."
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..."
<< std::endl);
return true;
}
@ -557,7 +561,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
int problems = 0;
cmCTest::tm_SetOfStrings::const_iterator file;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
int retVal;
@ -569,10 +573,10 @@ 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]
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0]
<< "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl);
*m_LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
*this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl;
cmsysProcess_SetCommand(cp, &*argv.begin());
@ -582,7 +586,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(data, length));
}
@ -595,32 +599,32 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
retVal = cmsysProcess_GetExitValue(cp);
if ( retVal != 0 )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: "
<< retVal << std::endl);
*m_LogFile << "\tSCP returned: " << retVal << std::endl;
*this->LogFile << "\tSCP returned: " << retVal << std::endl;
problems ++;
}
}
else if(result == cmsysProcess_State_Exception)
{
retVal = cmsysProcess_GetExitException(cp);
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was an exception: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was an exception: "
<< retVal << std::endl);
*m_LogFile << "\tThere was an exception: " << retVal << std::endl;
*this->LogFile << "\tThere was an exception: " << retVal << std::endl;
problems ++;
}
else if(result == cmsysProcess_State_Expired)
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tThere was a timeout"
cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was a timeout"
<< std::endl);
*m_LogFile << "\tThere was a timeout" << std::endl;
*this->LogFile << "\tThere was a timeout" << std::endl;
problems ++;
}
else if(result == cmsysProcess_State_Error)
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "\tError executing SCP: "
cmCTestLog(this->CTest, ERROR_MESSAGE, "\tError executing SCP: "
<< cmsysProcess_GetErrorString(cp) << std::endl);
*m_LogFile << "\tError executing SCP: "
*this->LogFile << "\tError executing SCP: "
<< cmsysProcess_GetErrorString(cp) << std::endl;
problems ++;
}
@ -651,9 +655,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
xmlrpc_env_init(&env);
/* Call the famous server at UserLand. */
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submitting to: "
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submitting to: "
<< realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl);
cmCTest::tm_SetOfStrings::const_iterator file;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
xmlrpc_value *result;
@ -663,12 +667,12 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
local_file = localprefix + "/" + *file;
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submit file: "
cmCTestLog(this->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: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file.c_str() << std::endl);
return false;
}
@ -677,7 +681,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
FILE* fp = fopen(local_file.c_str(), "rb");
if ( !fp )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot open file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot open file: "
<< local_file.c_str() << std::endl);
return false;
}
@ -687,7 +691,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
delete [] fileBuffer;
fclose(fp);
cmCTestLog(m_CTest, ERROR_MESSAGE, " Cannot read file: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot read file: "
<< local_file.c_str() << std::endl);
return false;
}
@ -702,7 +706,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
if ( env.fault_occurred )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Submission problem: "
cmCTestLog(this->CTest, ERROR_MESSAGE, " Submission problem: "
<< env.fault_string << " (" << env.fault_code << ")" << std::endl);
xmlrpc_env_clean(&env);
xmlrpc_client_cleanup();
@ -725,10 +729,10 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
int cmCTestSubmitHandler::ProcessHandler()
{
const std::string &buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
= this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
@ -736,12 +740,12 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( getenv("HTTP_PROXY") )
{
m_HTTPProxyType = 1;
m_HTTPProxy = getenv("HTTP_PROXY");
this->HTTPProxyType = 1;
this->HTTPProxy = getenv("HTTP_PROXY");
if ( getenv("HTTP_PROXY_PORT") )
{
m_HTTPProxy += ":";
m_HTTPProxy += getenv("HTTP_PROXY_PORT");
this->HTTPProxy += ":";
this->HTTPProxy += getenv("HTTP_PROXY_PORT");
}
if ( getenv("HTTP_PROXY_TYPE") )
{
@ -749,36 +753,36 @@ int cmCTestSubmitHandler::ProcessHandler()
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
m_HTTPProxyType = 1;
this->HTTPProxyType = 1;
}
else if ( type == "SOCKS4" )
{
m_HTTPProxyType = 2;
this->HTTPProxyType = 2;
}
else if ( type == "SOCKS5" )
{
m_HTTPProxyType = 3;
this->HTTPProxyType = 3;
}
}
if ( getenv("HTTP_PROXY_USER") )
{
m_HTTPProxyAuth = getenv("HTTP_PROXY_USER");
this->HTTPProxyAuth = getenv("HTTP_PROXY_USER");
}
if ( getenv("HTTP_PROXY_PASSWD") )
{
m_HTTPProxyAuth += ":";
m_HTTPProxyAuth += getenv("HTTP_PROXY_PASSWD");
this->HTTPProxyAuth += ":";
this->HTTPProxyAuth += getenv("HTTP_PROXY_PASSWD");
}
}
if ( getenv("FTP_PROXY") )
{
m_FTPProxyType = 1;
m_FTPProxy = getenv("FTP_PROXY");
this->FTPProxyType = 1;
this->FTPProxy = getenv("FTP_PROXY");
if ( getenv("FTP_PROXY_PORT") )
{
m_FTPProxy += ":";
m_FTPProxy += getenv("FTP_PROXY_PORT");
this->FTPProxy += ":";
this->FTPProxy += getenv("FTP_PROXY_PORT");
}
if ( getenv("FTP_PROXY_TYPE") )
{
@ -786,48 +790,48 @@ int cmCTestSubmitHandler::ProcessHandler()
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
m_FTPProxyType = 1;
this->FTPProxyType = 1;
}
else if ( type == "SOCKS4" )
{
m_FTPProxyType = 2;
this->FTPProxyType = 2;
}
else if ( type == "SOCKS5" )
{
m_FTPProxyType = 3;
this->FTPProxyType = 3;
}
}
}
if ( m_HTTPProxy.size() > 0 )
if ( this->HTTPProxy.size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " << m_HTTPProxy
<< std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: "
<< this->HTTPProxy << std::endl);
}
if ( m_FTPProxy.size() > 0 )
if ( this->FTPProxy.size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use FTP Proxy: " << m_FTPProxy
<< std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: "
<< this->FTPProxy << std::endl);
}
cmGeneratedFileStream ofs;
this->StartLogFile("Submit", ofs);
cmCTest::tm_SetOfStrings files;
cmCTest::SetOfStrings files;
std::string prefix = this->GetSubmitResultsPrefix();
// TODO:
// Check if test is enabled
m_CTest->AddIfExists(files, "Update.xml");
m_CTest->AddIfExists(files, "Configure.xml");
m_CTest->AddIfExists(files, "Build.xml");
m_CTest->AddIfExists(files, "Test.xml");
if ( m_CTest->AddIfExists(files, "Coverage.xml") )
this->CTest->AddIfExists(files, "Update.xml");
this->CTest->AddIfExists(files, "Configure.xml");
this->CTest->AddIfExists(files, "Build.xml");
this->CTest->AddIfExists(files, "Test.xml");
if ( this->CTest->AddIfExists(files, "Coverage.xml") )
{
cmCTest::tm_VectorOfStrings gfiles;
cmCTest::VectorOfStrings gfiles;
std::string gpath
= buildDirectory + "/Testing/" + m_CTest->GetCurrentTag();
= buildDirectory + "/Testing/" + this->CTest->GetCurrentTag();
std::string::size_type glen = gpath.size() + 1;
gpath = gpath + "/CoverageLog*";
cmCTestLog(m_CTest, DEBUG, "Globbing for: " << gpath.c_str()
cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath.c_str()
<< std::endl);
if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) )
{
@ -835,23 +839,23 @@ int cmCTestSubmitHandler::ProcessHandler()
for ( cc = 0; cc < gfiles.size(); cc ++ )
{
gfiles[cc] = gfiles[cc].substr(glen);
cmCTestLog(m_CTest, DEBUG, "Glob file: " << gfiles[cc].c_str()
cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc].c_str()
<< std::endl);
files.insert(gfiles[cc]);
}
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem globbing" << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem globbing" << std::endl);
}
}
m_CTest->AddIfExists(files, "DynamicAnalysis.xml");
m_CTest->AddIfExists(files, "Purify.xml");
m_CTest->AddIfExists(files, "Notes.xml");
this->CTest->AddIfExists(files, "DynamicAnalysis.xml");
this->CTest->AddIfExists(files, "Purify.xml");
this->CTest->AddIfExists(files, "Notes.xml");
cmCTest::tm_SetOfStrings::iterator it;
for ( it = m_CTest->GetSubmitFiles()->begin();
it != m_CTest->GetSubmitFiles()->end();
cmCTest::SetOfStrings::iterator it;
for ( it = this->CTest->GetSubmitFiles()->begin();
it != this->CTest->GetSubmitFiles()->end();
++ it )
{
files.insert(files.end(), *it);
@ -867,177 +871,184 @@ int cmCTestSubmitHandler::ProcessHandler()
cnt ++;
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Submit files (using "
<< m_CTest->GetCTestConfiguration("DropMethod") << ")"
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using "
<< this->CTest->GetCTestConfiguration("DropMethod") << ")"
<< std::endl);
this->SetLogFile(&ofs);
if ( m_CTest->GetCTestConfiguration("DropMethod") == "" ||
m_CTest->GetCTestConfiguration("DropMethod") == "ftp" )
if ( this->CTest->GetCTestConfiguration("DropMethod") == "" ||
this->CTest->GetCTestConfiguration("DropMethod") == "ftp" )
{
ofs << "Using drop method: FTP" << std::endl;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using FTP submit method"
cmCTestLog(this->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(
this->CTest->GetCTestConfiguration("DropSiteUser")) + ":" +
cmCTest::MakeURLSafe(this->CTest->GetCTestConfiguration(
"DropSitePassword")) + "@" +
m_CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe(m_CTest->GetCTestConfiguration("DropLocation"));
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
this->CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe(
this->CTest->GetCTestConfiguration("DropLocation"));
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, m_CTest->GetCTestConfiguration(
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration(
"DropSiteUser").c_str());
if ( m_CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, ":******");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "@");
cmCTestLog(this->CTest, HANDLER_OUTPUT, "@");
}
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSite")
<< m_CTest->GetCTestConfiguration("DropLocation") << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSite")
<< this->CTest->GetCTestConfiguration("DropLocation") << std::endl);
if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/"
+ m_CTest->GetCurrentTag(),
+ this->CTest->GetCurrentTag(),
files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via FTP"
cmCTestLog(this->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"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method"
<< std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite")
<< " Trigger site: "
<< this->CTest->GetCTestConfiguration("TriggerSite")
<< std::endl);
if ( !this->TriggerUsingHTTP(files, prefix,
m_CTest->GetCTestConfiguration("TriggerSite")) )
this->CTest->GetCTestConfiguration("TriggerSite")) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
else if ( m_CTest->GetCTestConfiguration("DropMethod") == "http" )
else if ( this->CTest->GetCTestConfiguration("DropMethod") == "http" )
{
ofs << "Using drop method: HTTP" << std::endl;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using HTTP submit method"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method"
<< std::endl
<< " Drop site: http://");
std::string url = "http://";
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
url += m_CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSiteUser").c_str());
if ( m_CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str());
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
{
url += ":" + m_CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(m_CTest, HANDLER_OUTPUT, ":******");
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
}
url += "@";
cmCTestLog(m_CTest, HANDLER_OUTPUT, "@");
cmCTestLog(this->CTest, HANDLER_OUTPUT, "@");
}
url += m_CTest->GetCTestConfiguration("DropSite") +
m_CTest->GetCTestConfiguration("DropLocation");
cmCTestLog(m_CTest, HANDLER_OUTPUT,
m_CTest->GetCTestConfiguration("DropSite")
<< m_CTest->GetCTestConfiguration("DropLocation") << std::endl);
url += this->CTest->GetCTestConfiguration("DropSite") +
this->CTest->GetCTestConfiguration("DropLocation");
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSite")
<< this->CTest->GetCTestConfiguration("DropLocation") << std::endl);
if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" +
m_CTest->GetCurrentTag(), files, prefix, url) )
this->CTest->GetCurrentTag(), files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method"
<< std::endl
<< " Trigger site: " << m_CTest->GetCTestConfiguration("TriggerSite")
<< " Trigger site: "
<< this->CTest->GetCTestConfiguration("TriggerSite")
<< std::endl);
if ( !this->TriggerUsingHTTP(files, prefix,
m_CTest->GetCTestConfiguration("TriggerSite")) )
this->CTest->GetCTestConfiguration("TriggerSite")) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
else if ( m_CTest->GetCTestConfiguration("DropMethod") == "xmlrpc" )
else if ( this->CTest->GetCTestConfiguration("DropMethod") == "xmlrpc" )
{
ofs << "Using drop method: XML-RPC" << std::endl;
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Using XML-RPC submit method"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using XML-RPC submit method"
<< std::endl);
std::string url = m_CTest->GetCTestConfiguration("DropSite");
prefix = m_CTest->GetCTestConfiguration("DropLocation");
std::string url = this->CTest->GetCTestConfiguration("DropSite");
prefix = this->CTest->GetCTestConfiguration("DropLocation");
if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" +
m_CTest->GetCurrentTag(), files, prefix, url) )
this->CTest->GetCurrentTag(), files, prefix, url) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl);
ofs << " Submission successful" << std::endl;
return 0;
}
else if ( m_CTest->GetCTestConfiguration("DropMethod") == "scp" )
else if ( this->CTest->GetCTestConfiguration("DropMethod") == "scp" )
{
std::string url;
std::string oldWorkingDirectory;
if ( m_CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{
url += m_CTest->GetCTestConfiguration("DropSiteUser") + "@";
url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@";
}
url += m_CTest->GetCTestConfiguration("DropSite") + ":" +
m_CTest->GetCTestConfiguration("DropLocation");
url += this->CTest->GetCTestConfiguration("DropSite") + ":" +
this->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
oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(buildDirectory.c_str());
if ( !this->SubmitUsingSCP(m_CTest->GetCTestConfiguration("ScpCommand"),
"Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) )
if ( !this->SubmitUsingSCP(
this->CTest->GetCTestConfiguration("ScpCommand"),
"Testing/"+this->CTest->GetCurrentTag(), files, prefix, url) )
{
cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str());
cmCTestLog(m_CTest, ERROR_MESSAGE, " Problems when submitting via SCP"
cmCTestLog(this->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"
cmCTestLog(this->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(this->CTest, ERROR_MESSAGE, " Unknown submission method: \""
<< this->CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl);
return -1;
}
//----------------------------------------------------------------------------
std::string cmCTestSubmitHandler::GetSubmitResultsPrefix()
{
std::string name = m_CTest->GetCTestConfiguration("Site") +
"___" + m_CTest->GetCTestConfiguration("BuildName") +
"___" + m_CTest->GetCurrentTag() + "-" +
m_CTest->GetTestModelString() + "___XML___";
std::string name = this->CTest->GetCTestConfiguration("Site") +
"___" + this->CTest->GetCTestConfiguration("BuildName") +
"___" + this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestModelString() + "___XML___";
return name;
}

View File

@ -31,7 +31,7 @@ public:
cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler);
cmCTestSubmitHandler();
~cmCTestSubmitHandler() { m_LogFile = 0; }
~cmCTestSubmitHandler() { this->LogFile = 0; }
/*
* The main entry point for this class
@ -41,7 +41,7 @@ public:
void Initialize();
private:
void SetLogFile(std::ostream* ost) { m_LogFile = ost; }
void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
/**
* Submit file using various ways
@ -71,12 +71,12 @@ private:
std::string GetSubmitResultsPrefix();
cmStdString m_HTTPProxy;
int m_HTTPProxyType;
cmStdString m_HTTPProxyAuth;
cmStdString m_FTPProxy;
int m_FTPProxyType;
std::ostream* m_LogFile;
cmStdString HTTPProxy;
int HTTPProxyType;
cmStdString HTTPProxyAuth;
cmStdString FTPProxy;
int FTPProxyType;
std::ostream* LogFile;
};
#endif

View File

@ -21,17 +21,17 @@
cmCTestTestCommand::cmCTestTestCommand()
{
m_Arguments[ctt_START] = "START";
m_Arguments[ctt_END] = "END";
m_Arguments[ctt_STRIDE] = "STRIDE";
m_Arguments[ctt_LAST] = 0;
m_Last = ctt_LAST;
this->Arguments[ctt_START] = "START";
this->Arguments[ctt_END] = "END";
this->Arguments[ctt_STRIDE] = "STRIDE";
this->Arguments[ctt_LAST] = 0;
this->Last = ctt_LAST;
}
cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
{
const char* ctestTimeout = m_Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
double timeout = m_CTest->GetTimeOut();
double timeout = this->CTest->GetTimeOut();
if ( ctestTimeout )
{
timeout = atof(ctestTimeout);
@ -44,24 +44,25 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
timeout = 600;
}
}
m_CTest->SetTimeOut(timeout);
this->CTest->SetTimeOut(timeout);
cmCTestGenericHandler* handler = this->InitializeActualHandler();
if ( m_Values[ctt_START] || m_Values[ctt_END] || m_Values[ctt_STRIDE] )
if ( this->Values[ctt_START] || this->Values[ctt_END] ||
this->Values[ctt_STRIDE] )
{
cmOStringStream testsToRunString;
if ( m_Values[ctt_START] )
if ( this->Values[ctt_START] )
{
testsToRunString << m_Values[ctt_START];
testsToRunString << this->Values[ctt_START];
}
testsToRunString << ",";
if ( m_Values[ctt_END] )
if ( this->Values[ctt_END] )
{
testsToRunString << m_Values[ctt_END];
testsToRunString << this->Values[ctt_END];
}
testsToRunString << ",";
if ( m_Values[ctt_STRIDE] )
if ( this->Values[ctt_STRIDE] )
{
testsToRunString << m_Values[ctt_STRIDE];
testsToRunString << this->Values[ctt_STRIDE];
}
handler->SetOption("TestsToRunInformation",
testsToRunString.str().c_str());
@ -71,6 +72,6 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
{
return m_CTest->GetInitializedHandler("test");
return this->CTest->GetInitializedHandler("test");
}

View File

@ -38,8 +38,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestTestCommand* ni = new cmCTestTestCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ public:
* intersection or the union of the lists. By default it is the
* intersection.
*/
void SetUseUnion(bool val) { m_UseUnion = val; }
void SetUseUnion(bool val) { this->UseUnion = val; }
/**
* This method is called when reading CTest custom file
@ -75,16 +75,16 @@ public:
struct cmCTestTestResult
{
std::string m_Name;
std::string m_Path;
std::string m_FullCommandLine;
double m_ExecutionTime;
int m_ReturnValue;
int m_Status;
std::string m_CompletionStatus;
std::string m_Output;
std::string m_RegressionImages;
int m_TestCount;
std::string Name;
std::string Path;
std::string FullCommandLine;
double ExecutionTime;
int ReturnValue;
int Status;
std::string CompletionStatus;
std::string Output;
std::string RegressionImages;
int TestCount;
};
void Initialize();
@ -92,13 +92,13 @@ public:
protected:
struct cmCTestTestProperties
{
cmStdString m_Name;
cmStdString m_Directory;
std::vector<std::string> m_Args;
std::vector<cmsys::RegularExpression> m_ErrorRegularExpressions;
std::vector<cmsys::RegularExpression> m_RequiredRegularExpressions;
bool m_IsInBasedOnREOptions;
bool m_WillFail;
cmStdString Name;
cmStdString Directory;
std::vector<std::string> Args;
std::vector<cmsys::RegularExpression> ErrorRegularExpressions;
std::vector<cmsys::RegularExpression> RequiredRegularExpressions;
bool IsInBasedOnREOptions;
bool WillFail;
};
@ -107,15 +107,15 @@ protected:
virtual void GenerateTestCommand(std::vector<const char*>& args);
int ExecuteCommands(std::vector<cmStdString>& vec);
double m_ElapsedTestingTime;
double ElapsedTestingTime;
typedef std::vector<cmCTestTestResult> tm_TestResultsVector;
tm_TestResultsVector m_TestResults;
typedef std::vector<cmCTestTestResult> TestResultsVector;
TestResultsVector TestResults;
std::vector<cmStdString> m_CustomTestsIgnore;
std::string m_StartTest;
std::string m_EndTest;
bool m_MemCheck;
std::vector<cmStdString> CustomTestsIgnore;
std::string StartTest;
std::string EndTest;
bool MemCheck;
private:
enum { // Program statuses
@ -144,7 +144,7 @@ private:
std::vector<cmStdString> &failed);
typedef std::vector<cmCTestTestProperties> tm_ListOfTests;
typedef std::vector<cmCTestTestProperties> ListOfTests;
/**
* Get the list of tests in directory and subdirectories.
*/
@ -158,21 +158,21 @@ private:
const char* GetTestStatus(int status);
void ExpandTestsToRunInformation(int numPossibleTests);
std::vector<cmStdString> m_CustomPreTest;
std::vector<cmStdString> m_CustomPostTest;
std::vector<cmStdString> CustomPreTest;
std::vector<cmStdString> CustomPostTest;
int m_CustomMaximumPassedTestOutputSize;
int m_CustomMaximumFailedTestOutputSize;
int CustomMaximumPassedTestOutputSize;
int CustomMaximumFailedTestOutputSize;
std::vector<int> m_TestsToRun;
std::vector<int> TestsToRun;
bool m_UseIncludeRegExp;
bool m_UseExcludeRegExp;
bool m_UseExcludeRegExpFirst;
std::string m_IncludeRegExp;
std::string m_ExcludeRegExp;
cmsys::RegularExpression m_IncludeTestsRegularExpression;
cmsys::RegularExpression m_ExcludeTestsRegularExpression;
bool UseIncludeRegExpFlag;
bool UseExcludeRegExpFlag;
bool UseExcludeRegExpFirst;
std::string IncludeRegExp;
std::string ExcludeRegExp;
cmsys::RegularExpression IncludeTestsRegularExpression;
cmsys::RegularExpression ExcludeTestsRegularExpression;
std::string GenerateRegressionImages(const std::string& xml);
@ -180,11 +180,11 @@ private:
bool CleanTestOutput(std::string& output, size_t length);
std::string TestsToRunString;
bool m_UseUnion;
tm_ListOfTests m_TestList;
cmsys::RegularExpression m_DartStuff;
bool UseUnion;
ListOfTests TestList;
cmsys::RegularExpression DartStuff;
std::ostream* m_LogFile;
std::ostream* LogFile;
};
#endif

View File

@ -69,17 +69,17 @@ bool cmCTestUpdateCommand::InitialPass(
}
}
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"UpdateCommand", "CTEST_UPDATE_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"UpdateOptions", "CTEST_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"CVSCommand", "CTEST_CVS_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"SVNCommand", "CTEST_SVN_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
this->CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile,
"SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
const char* initialCheckoutCommand
@ -89,7 +89,8 @@ bool cmCTestUpdateCommand::InitialPass(
initialCheckoutCommand = m_Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
}
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("update");
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("update");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate update handler");

View File

@ -36,8 +36,8 @@ public:
virtual cmCommand* Clone()
{
cmCTestUpdateCommand* ni = new cmCTestUpdateCommand;
ni->m_CTest = this->m_CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
return ni;
}

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -34,7 +34,7 @@
#include "windows.h"
#endif
#include <stdlib.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
@ -63,22 +63,22 @@ class cmCTestUpdateHandlerSVNXMLParser : public cmXMLParser
public:
struct t_CommitLog
{
int m_Revision;
std::string m_Author;
std::string m_Date;
std::string m_Message;
int Revision;
std::string Author;
std::string Date;
std::string Message;
};
cmCTestUpdateHandlerSVNXMLParser(cmCTestUpdateHandler* up)
: cmXMLParser(), m_UpdateHandler(up), m_MinRevision(-1), m_MaxRevision(-1)
: cmXMLParser(), UpdateHandler(up), MinRevision(-1), MaxRevision(-1)
{
}
int Parse(const char* str)
{
m_MinRevision = -1;
m_MaxRevision = -1;
this->MinRevision = -1;
this->MaxRevision = -1;
int res = this->cmXMLParser::Parse(str);
if ( m_MinRevision == -1 || m_MaxRevision == -1 )
if ( this->MinRevision == -1 || this->MaxRevision == -1 )
{
return 0;
}
@ -87,63 +87,68 @@ public:
typedef std::vector<t_CommitLog> t_VectorOfCommits;
t_VectorOfCommits* GetCommits() { return &m_Commits; }
int GetMinRevision() { return m_MinRevision; }
int GetMaxRevision() { return m_MaxRevision; }
t_VectorOfCommits* GetCommits() { return &this->Commits; }
int GetMinRevision() { return this->MinRevision; }
int GetMaxRevision() { return this->MaxRevision; }
protected:
void StartElement(const char* name, const char** atts)
{
if ( strcmp(name, "logentry") == 0 )
{
m_CommitLog = t_CommitLog();
this->CommitLog = t_CommitLog();
const char* rev = this->FindAttribute(atts, "revision");
if ( rev)
{
m_CommitLog.m_Revision = atoi(rev);
if ( m_MinRevision < 0 || m_MinRevision > m_CommitLog.m_Revision )
this->CommitLog.Revision = atoi(rev);
if ( this->MinRevision < 0 ||
this->MinRevision > this->CommitLog.Revision )
{
m_MinRevision = m_CommitLog.m_Revision;
this->MinRevision = this->CommitLog.Revision;
}
if ( m_MaxRevision < 0 || m_MaxRevision < m_CommitLog.m_Revision )
if ( this->MaxRevision < 0 ||
this->MaxRevision < this->CommitLog.Revision )
{
m_MaxRevision = m_CommitLog.m_Revision;
this->MaxRevision = this->CommitLog.Revision;
}
}
}
m_CharacterData.erase(m_CharacterData.begin(), m_CharacterData.end());
this->CharacterData.erase(
this->CharacterData.begin(), this->CharacterData.end());
}
void EndElement(const char* name)
{
if ( strcmp(name, "logentry") == 0 )
{
cmCTestLog(m_UpdateHandler->GetCTestInstance(), HANDLER_VERBOSE_OUTPUT,
"\tRevision: " << m_CommitLog.m_Revision<< std::endl
<< "\tAuthor: " << m_CommitLog.m_Author.c_str() << std::endl
<< "\tDate: " << m_CommitLog.m_Date.c_str() << std::endl
<< "\tMessage: " << m_CommitLog.m_Message.c_str() << std::endl);
m_Commits.push_back(m_CommitLog);
cmCTestLog(this->UpdateHandler->GetCTestInstance(),
HANDLER_VERBOSE_OUTPUT,
"\tRevision: " << this->CommitLog.Revision<< std::endl
<< "\tAuthor: " << this->CommitLog.Author.c_str() << std::endl
<< "\tDate: " << this->CommitLog.Date.c_str() << std::endl
<< "\tMessage: " << this->CommitLog.Message.c_str() << std::endl);
this->Commits.push_back(this->CommitLog);
}
else if ( strcmp(name, "author") == 0 )
{
m_CommitLog.m_Author.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
this->CommitLog.Author.assign(&(*(this->CharacterData.begin())),
this->CharacterData.size());
}
else if ( strcmp(name, "date") == 0 )
{
m_CommitLog.m_Date.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
this->CommitLog.Date.assign(&(*(this->CharacterData.begin())),
this->CharacterData.size());
}
else if ( strcmp(name, "msg") == 0 )
{
m_CommitLog.m_Message.assign(&(*(m_CharacterData.begin())),
m_CharacterData.size());
this->CommitLog.Message.assign(&(*(this->CharacterData.begin())),
this->CharacterData.size());
}
m_CharacterData.erase(m_CharacterData.begin(), m_CharacterData.end());
this->CharacterData.erase(this->CharacterData.begin(),
this->CharacterData.end());
}
void CharacterDataHandler(const char* data, int length)
{
m_CharacterData.insert(m_CharacterData.end(), data, data+length);
this->CharacterData.insert(this->CharacterData.end(), data, data+length);
}
const char* FindAttribute( const char** atts, const char* attribute )
{
@ -164,13 +169,13 @@ protected:
}
private:
std::vector<char> m_CharacterData;
cmCTestUpdateHandler* m_UpdateHandler;
t_CommitLog m_CommitLog;
std::vector<char> CharacterData;
cmCTestUpdateHandler* UpdateHandler;
t_CommitLog CommitLog;
t_VectorOfCommits m_Commits;
int m_MinRevision;
int m_MaxRevision;
t_VectorOfCommits Commits;
int MinRevision;
int MaxRevision;
};
//**********************************************************************
//----------------------------------------------------------------------
@ -189,11 +194,11 @@ void cmCTestUpdateHandler::Initialize()
//----------------------------------------------------------------------
int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
{
cmCTestLog(m_CTest, DEBUG, "Determine update type from command: " << cmd
cmCTestLog(this->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);
cmCTestLog(this->CTest, DEBUG, "Type specified: " << type << std::endl);
std::string stype = cmSystemTools::LowerCase(type);
if ( stype.find("cvs") != std::string::npos )
{
@ -206,8 +211,8 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
}
else
{
cmCTestLog(m_CTest, DEBUG, "Type not specified, check command: " << cmd
<< std::endl);
cmCTestLog(this->CTest, DEBUG, "Type not specified, check command: "
<< cmd << std::endl);
std::string stype = cmSystemTools::LowerCase(cmd);
if ( stype.find("cvs") != std::string::npos )
{
@ -219,8 +224,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(this->CTest, DEBUG, "Check directory: "
<< sourceDirectory.c_str() << std::endl);
sourceDirectory += "/.svn";
if ( cmSystemTools::FileExists(sourceDirectory.c_str()) )
{
@ -254,50 +259,52 @@ int cmCTestUpdateHandler::ProcessHandler()
const char* sourceDirectory = this->GetOption("SourceDirectory");
if ( !sourceDirectory )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
cmGeneratedFileStream ofs;
if ( !m_CTest->GetShowOnly() )
if ( !this->CTest->GetShowOnly() )
{
this->StartLogFile("Update", ofs);
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Updating the repository" << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT,
"Updating the repository" << std::endl);
const char* initialCheckoutCommand = this->GetOption("InitialCheckout");
if ( initialCheckoutCommand )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->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 "
cmCTestLog(this->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(this->CTest, HANDLER_OUTPUT,
" Perform checkout in directory: " << parent.c_str() << std::endl);
if ( !cmSystemTools::MakeDirectory(parent.c_str()) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create parent directory: " << parent.c_str()
<< " of the source directory: " << sourceDirectory << std::endl);
return -1;
}
ofs << "* Run initial checkout" << std::endl;
ofs << " Command: " << initialCheckoutCommand << std::endl;
cmCTestLog(m_CTest, DEBUG, " Before: "
cmCTestLog(this->CTest, DEBUG, " Before: "
<< initialCheckoutCommand << std::endl);
bool retic = m_CTest->RunCommand(initialCheckoutCommand, &goutput,
bool retic = this->CTest->RunCommand(initialCheckoutCommand, &goutput,
&errors, &retVal, parent.c_str(), 0 /* Timeout */);
cmCTestLog(m_CTest, DEBUG, " After: "
cmCTestLog(this->CTest, DEBUG, " After: "
<< initialCheckoutCommand << std::endl);
ofs << " Output: " << goutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
@ -306,26 +313,27 @@ int cmCTestUpdateHandler::ProcessHandler()
cmOStringStream ostr;
ostr << "Problem running initial checkout Output [" << goutput
<< "] Errors [" << errors << "]";
cmCTestLog(m_CTest, ERROR_MESSAGE, ostr.str().c_str() << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, ostr.str().c_str() << std::endl);
checkoutErrorMessages += ostr.str();
updateProducedError = true;
}
m_CTest->InitializeFromCommand(m_Command);
this->CTest->InitializeFromCommand(this->Command);
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Updating the repository: "
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: "
<< sourceDirectory << std::endl);
// Get update command
std::string updateCommand = m_CTest->GetCTestConfiguration("UpdateCommand");
std::string updateCommand
= this->CTest->GetCTestConfiguration("UpdateCommand");
if ( updateCommand.empty() )
{
updateCommand = m_CTest->GetCTestConfiguration("CVSCommand");
updateCommand = this->CTest->GetCTestConfiguration("CVSCommand");
if ( updateCommand.empty() )
{
updateCommand = m_CTest->GetCTestConfiguration("SVNCommand");
updateCommand = this->CTest->GetCTestConfiguration("SVNCommand");
if ( updateCommand.empty() )
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find CVSCommand, SVNCommand, or UpdateCommand key in the "
"DartConfiguration.tcl" << std::endl);
return -1;
@ -343,39 +351,40 @@ int cmCTestUpdateHandler::ProcessHandler()
else
{
updateType = this->DetermineType(updateCommand.c_str(),
m_CTest->GetCTestConfiguration("UpdateType").c_str());
this->CTest->GetCTestConfiguration("UpdateType").c_str());
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use "
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use "
<< cmCTestUpdateHandlerUpdateToString(updateType) << " repository type"
<< std::endl;);
// And update options
std::string updateOptions = m_CTest->GetCTestConfiguration("UpdateOptions");
std::string updateOptions
= this->CTest->GetCTestConfiguration("UpdateOptions");
if ( updateOptions.empty() )
{
switch (updateType)
{
case cmCTestUpdateHandler::e_CVS:
updateOptions = m_CTest->GetCTestConfiguration("CVSUpdateOptions");
updateOptions = this->CTest->GetCTestConfiguration("CVSUpdateOptions");
if ( updateOptions.empty() )
{
updateOptions = "-dP";
}
break;
case cmCTestUpdateHandler::e_SVN:
updateOptions = m_CTest->GetCTestConfiguration("SVNUpdateOptions");
updateOptions = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
break;
}
}
// Get update time
std::string extra_update_opts;
if ( m_CTest->GetTestModel() == cmCTest::NIGHTLY )
if ( this->CTest->GetTestModel() == cmCTest::NIGHTLY )
{
struct tm* t = m_CTest->GetNightlyTime(
m_CTest->GetCTestConfiguration("NightlyStartTime"),
m_CTest->GetTomorrowTag());
struct tm* t = this->CTest->GetNightlyTime(
this->CTest->GetCTestConfiguration("NightlyStartTime"),
this->CTest->GetTomorrowTag());
char current_time[1024];
sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d",
t->tm_year + 1900,
@ -427,14 +436,14 @@ int cmCTestUpdateHandler::ProcessHandler()
//
if ( !command.empty() )
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"* Get repository information: " << command.c_str() << std::endl);
if ( !m_CTest->GetShowOnly() )
if ( !this->CTest->GetShowOnly() )
{
ofs << "* Get repository information" << std::endl;
ofs << " Command: " << command.c_str() << std::endl;
res = m_CTest->RunCommand(command.c_str(), &goutput, &errors,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
res = this->CTest->RunCommand(command.c_str(), &goutput, &errors,
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
ofs << " Output: " << goutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
@ -457,7 +466,7 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string currentRevisionString
= current_revision_regex.match(1);
svn_current_revision = atoi(currentRevisionString.c_str());
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Old revision of repository is: " << svn_current_revision
<< std::endl);
}
@ -467,7 +476,7 @@ int cmCTestUpdateHandler::ProcessHandler()
}
else
{
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Update with command: " << command << std::endl);
}
}
@ -475,18 +484,19 @@ int cmCTestUpdateHandler::ProcessHandler()
//
// Now update repository and remember what files were updated
//
cmGeneratedFileStream os;
//
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Update", os) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open log file" << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file"
<< std::endl);
}
std::string start_time = m_CTest->CurrentTime();
std::string start_time = this->CTest->CurrentTime();
double elapsed_time_start = cmSystemTools::GetTime();
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "* Update repository: "
<< command.c_str() << std::endl);
if ( !m_CTest->GetShowOnly() )
if ( !this->CTest->GetShowOnly() )
{
command = "";
switch( updateType )
@ -496,8 +506,8 @@ int cmCTestUpdateHandler::ProcessHandler()
" " + extra_update_opts;
ofs << "* Update repository: " << std::endl;
ofs << " Command: " << command.c_str() << std::endl;
res = m_CTest->RunCommand(command.c_str(), &goutput, &errors,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
res = this->CTest->RunCommand(command.c_str(), &goutput, &errors,
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
ofs << " Output: " << goutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
break;
@ -508,17 +518,17 @@ 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,
bool res1 = this->CTest->RunCommand(command.c_str(), &partialOutput,
&errors,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
ofs << " Output: " << partialOutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
goutput = partialOutput;
command = updateCommand + " status";
ofs << "* Status repository: " << std::endl;
ofs << " Command: " << command.c_str() << std::endl;
res = m_CTest->RunCommand(command.c_str(), &partialOutput, &errors,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
res = this->CTest->RunCommand(command.c_str(), &partialOutput,
&errors, &retVal, sourceDirectory, 0 /*this->TimeOut*/);
ofs << " Output: " << partialOutput.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
goutput += partialOutput;
@ -541,15 +551,15 @@ int cmCTestUpdateHandler::ProcessHandler()
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Update mode=\"Client\" Generator=\"ctest-"
<< cmVersion::GetCMakeVersion() << "\">\n"
<< "\t<Site>" << m_CTest->GetCTestConfiguration("Site") << "</Site>\n"
<< "\t<BuildName>" << m_CTest->GetCTestConfiguration("BuildName")
<< "\t<Site>" << this->CTest->GetCTestConfiguration("Site") << "</Site>\n"
<< "\t<BuildName>" << this->CTest->GetCTestConfiguration("BuildName")
<< "</BuildName>\n"
<< "\t<BuildStamp>" << m_CTest->GetCurrentTag() << "-"
<< m_CTest->GetTestModelString() << "</BuildStamp>" << std::endl;
<< "\t<BuildStamp>" << this->CTest->GetCurrentTag() << "-"
<< this->CTest->GetTestModelString() << "</BuildStamp>" << std::endl;
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<UpdateCommand>" << m_CTest->MakeXMLSafe(command)
<< "\t<UpdateCommand>" << this->CTest->MakeXMLSafe(command)
<< "</UpdateCommand>\n"
<< "\t<UpdateType>" << m_CTest->MakeXMLSafe(
<< "\t<UpdateType>" << this->CTest->MakeXMLSafe(
cmCTestUpdateHandlerUpdateToString(updateType))
<< "</UpdateType>\n";
@ -584,9 +594,9 @@ int cmCTestUpdateHandler::ProcessHandler()
bool first_file = true;
cmCTestUpdateHandler::AuthorsToUpdatesMap authors_files_map;
int num_updated = 0;
int num_modified = 0;
int num_conflicting = 0;
int numUpdated = 0;
int numModiefied = 0;
int numConflicting = 0;
// In subversion, get the latest revision
if ( updateType == cmCTestUpdateHandler::e_SVN )
{
@ -601,19 +611,20 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( svn_latest_revision <= 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem determining the current "
cmCTestLog(this->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,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Current revision of repository is: " << svn_latest_revision
<< std::endl);
}
}
cmCTestLog(m_CTest, HANDLER_OUTPUT,
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Gathering version information (each . represents one updated file):"
<< std::endl);
int file_count = 0;
@ -630,9 +641,9 @@ int cmCTestUpdateHandler::ProcessHandler()
{
if ( file_count == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " " << std::flush);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << std::flush);
}
cmCTestLog(m_CTest, HANDLER_OUTPUT, "." << std::flush);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
std::string upChar = file_update_line.match(1);
std::string upFile = file_update_line.match(2);
char mod = upChar[0];
@ -647,7 +658,7 @@ int cmCTestUpdateHandler::ProcessHandler()
modifiedOrConflict = true;
}
const char* file = upFile.c_str();
cmCTestLog(m_CTest, DEBUG, "Line" << cc << ": " << mod << " - "
cmCTestLog(this->CTest, DEBUG, "Line" << cc << ": " << mod << " - "
<< file << std::endl);
std::string output;
@ -677,14 +688,14 @@ int cmCTestUpdateHandler::ProcessHandler()
}
break;
}
cmCTestLog(m_CTest, DEBUG, "Do log: " << logcommand << std::endl);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLog(this->CTest, DEBUG, "Do log: " << logcommand << std::endl);
cmCTestLog(this->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,
&retVal, sourceDirectory, 0 /*m_TimeOut*/);
res = this->CTest->RunCommand(logcommand.c_str(), &output, &errors,
&retVal, sourceDirectory, 0 /*this->TimeOut*/);
ofs << " Output: " << output.c_str() << std::endl;
ofs << " Errors: " << errors.c_str() << std::endl;
if ( ofs )
@ -694,7 +705,7 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( res && retVal == 0)
{
cmCTestLog(m_CTest, DEBUG, output << std::endl);
cmCTestLog(this->CTest, DEBUG, output << std::endl);
std::string::size_type sline = 0;
std::string srevision1 = "Unknown";
std::string sdate1 = "Unknown";
@ -778,13 +789,13 @@ int cmCTestUpdateHandler::ProcessHandler()
srevision1 = str.str();
if (!svn_status_line_regex.find(output))
{
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Bad output from SVN status command. "
"The file name returned: \""
<< svn_status_line_regex.match(4)
@ -812,27 +823,27 @@ int cmCTestUpdateHandler::ProcessHandler()
int maxrev = parser.GetMaxRevision();
cmCTestUpdateHandlerSVNXMLParser::
t_VectorOfCommits::iterator it;
for ( it = parser.GetCommits()->begin();
it != parser.GetCommits()->end();
for ( it = parser.GetCommits()->begin();
it != parser.GetCommits()->end();
++ it )
{
if ( it->m_Revision == maxrev )
if ( it->Revision == maxrev )
{
cmOStringStream mRevStream;
mRevStream << maxrev;
srevision1 = mRevStream.str();
sauthor1 = it->m_Author;
comment1 = it->m_Message;
sdate1 = it->m_Date;
sauthor1 = it->Author;
comment1 = it->Message;
sdate1 = it->Date;
}
else if ( it->m_Revision == minrev )
else if ( it->Revision == minrev )
{
cmOStringStream mRevStream;
mRevStream << minrev;
srevision2 = mRevStream.str();
sauthor2 = it->m_Author;
comment2 = it->m_Message;
sdate2 = it->m_Date;
sauthor2 = it->Author;
comment2 = it->Message;
sdate2 = it->Date;
}
}
}
@ -869,30 +880,30 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( mod == 'C' )
{
num_conflicting ++;
numConflicting ++;
os << "\t<Conflicting>" << std::endl;
}
else if ( mod == 'G' )
{
num_conflicting ++;
numConflicting ++;
os << "\t<Conflicting>" << std::endl;
}
else if ( mod == 'M' )
{
num_modified ++;
numModiefied ++;
os << "\t<Modified>" << std::endl;
}
else
{
num_updated ++;
numUpdated ++;
os << "\t<Updated>" << std::endl;
}
if ( srevision2 == "Unknown" )
{
srevision2 = srevision1;
}
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "File: " << path.c_str()
<< " / " << fname.c_str() << " was updated by "
cmCTestLog(this->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) << "\">"
@ -968,28 +979,28 @@ int cmCTestUpdateHandler::ProcessHandler()
}
if ( file_count )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
}
if ( num_updated )
if ( numUpdated )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_updated
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numUpdated
<< " updated files" << std::endl);
}
if ( num_modified )
if ( numModiefied )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_modified
<< " locally modified files"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numModiefied
<< " locally modified files"
<< std::endl);
}
if ( num_conflicting )
if ( numConflicting )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Found " << num_conflicting
<< " conflicting files"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numConflicting
<< " conflicting files"
<< std::endl);
}
if ( num_modified == 0 && num_conflicting == 0 && num_updated == 0 )
if ( numModiefied == 0 && numConflicting == 0 && numUpdated == 0 )
{
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Project is up-to-date"
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Project is up-to-date"
<< std::endl);
}
if ( !first_file )
@ -1013,36 +1024,37 @@ int cmCTestUpdateHandler::ProcessHandler()
os << "\t</Author>" << std::endl;
}
cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
std::string end_time = m_CTest->CurrentTime();
cmCTestLog(this->CTest, DEBUG, "End" << std::endl);
std::string end_time = this->CTest->CurrentTime();
os << "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "<ElapsedMinutes>" <<
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "<ElapsedMinutes>" <<
static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>\n"
<< "\t<UpdateReturnStatus>";
if ( num_modified > 0 || num_conflicting > 0 )
if ( numModiefied > 0 || numConflicting > 0 )
{
os << "Update error: There are modified or conflicting files in the "
"repository";
cmCTestLog(m_CTest, ERROR_MESSAGE,
cmCTestLog(this->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);
os << this->CTest->MakeXMLSafe(checkoutErrorMessages);
cmCTestLog(this->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, "Output: " << goutput << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error(s) when updating the project" << std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, "Output: "
<< goutput << std::endl);
return -1;
}
return count;

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -39,7 +39,7 @@ public:
* The main entry point for this class
*/
int ProcessHandler();
cmCTestUpdateHandler();
enum {
@ -53,13 +53,13 @@ public:
* Initialize handler
*/
virtual void Initialize();
private:
// Some structures needed for update
struct StringPair :
struct StringPair :
public std::pair<std::string, std::string>{};
struct UpdateFiles : public std::vector<StringPair>{};
struct AuthorsToUpdatesMap :
struct AuthorsToUpdatesMap :
public std::map<std::string, UpdateFiles>{};
// Determine the type of version control

View File

@ -690,7 +690,7 @@ bool cmCTest::OpenOutputFile(const std::string& path,
}
//----------------------------------------------------------------------
bool cmCTest::AddIfExists(tm_SetOfStrings& files, const char* file)
bool cmCTest::AddIfExists(SetOfStrings& files, const char* file)
{
if ( this->CTestFileExists(file) )
{
@ -1160,9 +1160,9 @@ void cmCTest::EndXML(std::ostream& ostr)
//----------------------------------------------------------------------
int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
const cmCTest::tm_VectorOfStrings& files)
const cmCTest::VectorOfStrings& files)
{
cmCTest::tm_VectorOfStrings::const_iterator it;
cmCTest::VectorOfStrings::const_iterator it;
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<?xml-stylesheet type=\"text/xsl\" "
"href=\"Dart/Source/Server/XSL/Build.xsl "
@ -1865,8 +1865,8 @@ void cmCTest::SetNotesFiles(const char* notes)
//----------------------------------------------------------------------
int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
{
tm_VectorOfStrings dirs;
tm_VectorOfStrings ndirs;
VectorOfStrings dirs;
VectorOfStrings ndirs;
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
@ -1905,7 +1905,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
//----------------------------------------------------------------------
void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def,
tm_VectorOfStrings& vec)
VectorOfStrings& vec)
{
if ( !def)
{

View File

@ -49,8 +49,8 @@ class cmCTestCommand;
class cmCTest
{
public:
typedef std::vector<cmStdString> tm_VectorOfStrings;
typedef std::set<cmStdString> tm_SetOfStrings;
typedef std::vector<cmStdString> VectorOfStrings;
typedef std::set<cmStdString> SetOfStrings;
///! Process Command line arguments
int Run(std::vector<std::string>const&, std::string* output = 0);
@ -100,7 +100,7 @@ public:
* Check if CTest file exists
*/
bool CTestFileExists(const std::string& filename);
bool AddIfExists(tm_SetOfStrings& files, const char* file);
bool AddIfExists(SetOfStrings& files, const char* file);
/**
* Set the cmake test
@ -130,7 +130,7 @@ public:
void SetNotesFiles(const char* notes);
static void PopulateCustomVector(cmMakefile* mf, const char* definition,
tm_VectorOfStrings& vec);
VectorOfStrings& vec);
static void PopulateCustomInteger(cmMakefile* mf, const char* def,
int& val);
@ -288,7 +288,7 @@ public:
//! Add file to be submitted
void AddSubmitFile(const char* name);
tm_SetOfStrings* GetSubmitFiles() { return &m_SubmitFiles; }
SetOfStrings* GetSubmitFiles() { return &m_SubmitFiles; }
private:
std::string m_ConfigType;
@ -324,11 +324,11 @@ private:
};
//! Map of configuration properties
typedef std::map<cmStdString, cmStdString> tm_CTestConfigurationMap;
typedef std::map<cmStdString, cmStdString> CTestConfigurationMap;
std::string m_CTestConfigFile;
tm_CTestConfigurationMap m_CTestConfiguration;
tm_CTestConfigurationMap m_CTestConfigurationOverwrites;
CTestConfigurationMap m_CTestConfiguration;
CTestConfigurationMap m_CTestConfigurationOverwrites;
int m_Tests[LAST_TEST];
std::string m_CurrentTag;
@ -364,7 +364,7 @@ private:
//! Create not from files.
int GenerateCTestNotesOutput(std::ostream& os,
const tm_VectorOfStrings& files);
const VectorOfStrings& files);
///! Find the running cmake
void FindRunningCMake(const char* arg0);