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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ bool cmCTestRunScriptCommand::InitialPass(
{ {
if(args.size() < 1 ) if(args.size() < 1 )
{ {
m_CTestScriptHandler->RunCurrentScript(); this->CTestScriptHandler->RunCurrentScript();
return true; return true;
} }
@ -31,7 +31,7 @@ bool cmCTestRunScriptCommand::InitialPass(
unsigned int i; unsigned int i;
for (i = 0; i < args.size(); ++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; return true;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -66,22 +66,22 @@ bool cmCTestStartCommand::InitialPass(
"as an argument or set CTEST_BINARY_DIRECTORY"); "as an argument or set CTEST_BINARY_DIRECTORY");
return false; return false;
} }
m_CTest->EmptyCTestConfiguration(); this->CTest->EmptyCTestConfiguration();
m_CTest->SetCTestConfiguration("SourceDirectory", src_dir); this->CTest->SetCTestConfiguration("SourceDirectory", src_dir);
m_CTest->SetCTestConfiguration("BuildDirectory", bld_dir); this->CTest->SetCTestConfiguration("BuildDirectory", bld_dir);
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
<< std::endl << smodel << std::endl
<< " Source directory: " << src_dir << std::endl << " Source directory: " << src_dir << std::endl
<< " Build directory: " << bld_dir << std::endl); << " Build directory: " << bld_dir << std::endl);
m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF"); m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
m_CTest->SetSuppressUpdatingCTestConfiguration(true); this->CTest->SetSuppressUpdatingCTestConfiguration(true);
int model = m_CTest->GetTestModelFromString(smodel); int model = this->CTest->GetTestModelFromString(smodel);
m_CTest->SetTestModel(model); this->CTest->SetTestModel(model);
m_CTest->SetProduceXML(true); 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() virtual cmCommand* Clone()
{ {
cmCTestStartCommand* ni = new cmCTestStartCommand; cmCTestStartCommand* ni = new cmCTestStartCommand;
ni->m_CTest = this->m_CTest; ni->CTest = this->CTest;
ni->m_CTestScriptHandler = this->m_CTestScriptHandler; ni->CTestScriptHandler = this->CTestScriptHandler;
return ni; return ni;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc. All rights reserved. Copyright (c) 2002 Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
@ -39,7 +39,7 @@ public:
* The main entry point for this class * The main entry point for this class
*/ */
int ProcessHandler(); int ProcessHandler();
cmCTestUpdateHandler(); cmCTestUpdateHandler();
enum { enum {
@ -53,13 +53,13 @@ public:
* Initialize handler * Initialize handler
*/ */
virtual void Initialize(); virtual void Initialize();
private: private:
// Some structures needed for update // Some structures needed for update
struct StringPair : struct StringPair :
public std::pair<std::string, std::string>{}; public std::pair<std::string, std::string>{};
struct UpdateFiles : public std::vector<StringPair>{}; struct UpdateFiles : public std::vector<StringPair>{};
struct AuthorsToUpdatesMap : struct AuthorsToUpdatesMap :
public std::map<std::string, UpdateFiles>{}; public std::map<std::string, UpdateFiles>{};
// Determine the type of version control // 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) ) if ( this->CTestFileExists(file) )
{ {
@ -1160,9 +1160,9 @@ void cmCTest::EndXML(std::ostream& ostr)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTest::GenerateCTestNotesOutput(std::ostream& os, 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" os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<?xml-stylesheet type=\"text/xsl\" " << "<?xml-stylesheet type=\"text/xsl\" "
"href=\"Dart/Source/Server/XSL/Build.xsl " "href=\"Dart/Source/Server/XSL/Build.xsl "
@ -1865,8 +1865,8 @@ void cmCTest::SetNotesFiles(const char* notes)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTest::ReadCustomConfigurationFileTree(const char* dir) int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
{ {
tm_VectorOfStrings dirs; VectorOfStrings dirs;
tm_VectorOfStrings ndirs; VectorOfStrings ndirs;
cmake cm; cmake cm;
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
@ -1905,7 +1905,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def,
tm_VectorOfStrings& vec) VectorOfStrings& vec)
{ {
if ( !def) if ( !def)
{ {

View File

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