ENH: Cleanups and add CTEST_START command
This commit is contained in:
parent
ad5115d00f
commit
8fe1686510
@ -151,6 +151,7 @@ SET(CMTEST_SRCS ctest.cxx cmCTest.cxx
|
|||||||
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
|
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
|
||||||
CTest/cmCTestRunScriptCommand.cxx
|
CTest/cmCTestRunScriptCommand.cxx
|
||||||
CTest/cmCTestSleepCommand.cxx
|
CTest/cmCTestSleepCommand.cxx
|
||||||
|
CTest/cmCTestStartCommand.cxx
|
||||||
CTest/cmCTestMemCheckHandler.cxx
|
CTest/cmCTestMemCheckHandler.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ int cmCTestCoverageHandler::ProcessHandler()
|
|||||||
|
|
||||||
std::string coverage_start_time = m_CTest->CurrentTime();
|
std::string coverage_start_time = m_CTest->CurrentTime();
|
||||||
|
|
||||||
std::string testingDir = m_CTest->GetToplevelPath() + "/Testing";
|
std::string testingDir = m_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());
|
||||||
|
@ -316,7 +316,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
|||||||
m_MemoryTesterOptions = m_CTest->GetDartConfiguration("ValgrindCommandOptions");
|
m_MemoryTesterOptions = m_CTest->GetDartConfiguration("ValgrindCommandOptions");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MemoryTesterOutputFile = m_CTest->GetToplevelPath() + "/Testing/Temporary/MemoryChecker.log";
|
m_MemoryTesterOutputFile = m_CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
|
||||||
m_MemoryTesterOutputFile = cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str());
|
m_MemoryTesterOutputFile = cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str());
|
||||||
|
|
||||||
if ( m_MemoryTester.find("valgrind") != std::string::npos )
|
if ( m_MemoryTester.find("valgrind") != std::string::npos )
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "cmCTestEmptyBinaryDirectoryCommand.h"
|
#include "cmCTestEmptyBinaryDirectoryCommand.h"
|
||||||
#include "cmCTestRunScriptCommand.h"
|
#include "cmCTestRunScriptCommand.h"
|
||||||
#include "cmCTestSleepCommand.h"
|
#include "cmCTestSleepCommand.h"
|
||||||
|
#include "cmCTestStartCommand.h"
|
||||||
|
|
||||||
#define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log"
|
#define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log"
|
||||||
|
|
||||||
@ -157,6 +158,15 @@ void cmCTestScriptHandler::UpdateElapsedTime()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
|
||||||
|
{
|
||||||
|
cmCTestCommand* newCom = command;
|
||||||
|
newCom->m_CTest = m_CTest;
|
||||||
|
newCom->m_CTestScriptHandler = this;
|
||||||
|
m_CMake->AddCommand(newCom);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// this sets up some variables for thew script to use, creates the required
|
// this sets up some variables for thew script to use, creates the required
|
||||||
// cmake instance and generators, and then reads in the script
|
// cmake instance and generators, and then reads in the script
|
||||||
@ -209,18 +219,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
|
|||||||
// add any ctest specific commands, probably should have common superclass
|
// add any ctest specific commands, probably should have common superclass
|
||||||
// for ctest commands to clean this up. If a couple more commands are
|
// for ctest commands to clean this up. If a couple more commands are
|
||||||
// created with the same format lets do that - ken
|
// created with the same format lets do that - ken
|
||||||
cmCTestCommand* newCom = new cmCTestRunScriptCommand;
|
this->AddCTestCommand(new cmCTestRunScriptCommand);
|
||||||
newCom->m_CTest = m_CTest;
|
this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
|
||||||
newCom->m_CTestScriptHandler = this;
|
this->AddCTestCommand(new cmCTestSleepCommand);
|
||||||
m_CMake->AddCommand(newCom);
|
this->AddCTestCommand(new cmCTestStartCommand);
|
||||||
newCom = new cmCTestEmptyBinaryDirectoryCommand;
|
|
||||||
newCom->m_CTest = m_CTest;
|
|
||||||
newCom->m_CTestScriptHandler = this;
|
|
||||||
m_CMake->AddCommand(newCom);
|
|
||||||
newCom = new cmCTestSleepCommand;
|
|
||||||
newCom->m_CTest = m_CTest;
|
|
||||||
newCom->m_CTestScriptHandler = this;
|
|
||||||
m_CMake->AddCommand(newCom);
|
|
||||||
|
|
||||||
// add the script arg if defined
|
// add the script arg if defined
|
||||||
if (script_arg.size())
|
if (script_arg.size())
|
||||||
|
@ -26,6 +26,7 @@ class cmMakefile;
|
|||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmGlobalGenerator;
|
class cmGlobalGenerator;
|
||||||
class cmake;
|
class cmake;
|
||||||
|
class cmCTestCommand;
|
||||||
|
|
||||||
/** \class cmCTestScriptHandler
|
/** \class cmCTestScriptHandler
|
||||||
* \brief A class that handles ctest -S invocations
|
* \brief A class that handles ctest -S invocations
|
||||||
@ -116,6 +117,9 @@ private:
|
|||||||
int RunConfigurationScript(const std::string& script);
|
int RunConfigurationScript(const std::string& script);
|
||||||
int RunConfigurationDashboard();
|
int RunConfigurationDashboard();
|
||||||
|
|
||||||
|
// Add ctest command
|
||||||
|
void AddCTestCommand(cmCTestCommand* command);
|
||||||
|
|
||||||
std::vector<cmStdString> m_ConfigurationScripts;
|
std::vector<cmStdString> m_ConfigurationScripts;
|
||||||
|
|
||||||
bool m_Backup;
|
bool m_Backup;
|
||||||
|
78
Source/CTest/cmCTestStartCommand.cxx
Normal file
78
Source/CTest/cmCTestStartCommand.cxx
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
Program: CMake - Cross-Platform Makefile Generator
|
||||||
|
Module: $RCSfile$
|
||||||
|
Language: C++
|
||||||
|
Date: $Date$
|
||||||
|
Version: $Revision$
|
||||||
|
|
||||||
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
||||||
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. See the above copyright notices for more information.
|
||||||
|
|
||||||
|
=========================================================================*/
|
||||||
|
#include "cmCTestStartCommand.h"
|
||||||
|
|
||||||
|
#include "cmCTest.h"
|
||||||
|
|
||||||
|
bool cmCTestStartCommand::InitialPass(
|
||||||
|
std::vector<std::string> const& args)
|
||||||
|
{
|
||||||
|
if (args.size() < 1)
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* smodel = args[0].c_str();
|
||||||
|
const char* src_dir = 0;
|
||||||
|
const char* bld_dir = 0;
|
||||||
|
|
||||||
|
if ( args.size() >= 2 )
|
||||||
|
{
|
||||||
|
src_dir = args[1].c_str();
|
||||||
|
if ( args.size() == 3 )
|
||||||
|
{
|
||||||
|
bld_dir = args[2].c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( args.size() > 3 )
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !src_dir )
|
||||||
|
{
|
||||||
|
src_dir = m_Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
|
||||||
|
}
|
||||||
|
if ( !bld_dir)
|
||||||
|
{
|
||||||
|
bld_dir = m_Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
|
||||||
|
}
|
||||||
|
if ( !src_dir )
|
||||||
|
{
|
||||||
|
this->SetError("source directory not specified. Specify source directory as an argument or set CTEST_SOURCE_DIRECTORY");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !bld_dir)
|
||||||
|
{
|
||||||
|
this->SetError("binary directory not specified. Specify binary directory as an argument or set CTEST_BINARY_DIRECTORY");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Run dashboard with model " << smodel
|
||||||
|
<< " for src dir: " << src_dir << " and binary dir: " << bld_dir << std::endl;
|
||||||
|
|
||||||
|
int model = m_CTest->GetTestModelFromString(smodel);
|
||||||
|
m_CTest->SetTestModel(model);
|
||||||
|
m_CTest->SetProduceXML(true);
|
||||||
|
if ( !m_CTest->Initialize(bld_dir) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
81
Source/CTest/cmCTestStartCommand.h
Normal file
81
Source/CTest/cmCTestStartCommand.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
Program: CMake - Cross-Platform Makefile Generator
|
||||||
|
Module: $RCSfile$
|
||||||
|
Language: C++
|
||||||
|
Date: $Date$
|
||||||
|
Version: $Revision$
|
||||||
|
|
||||||
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
||||||
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. See the above copyright notices for more information.
|
||||||
|
|
||||||
|
=========================================================================*/
|
||||||
|
#ifndef cmCTestStartCommand_h
|
||||||
|
#define cmCTestStartCommand_h
|
||||||
|
|
||||||
|
#include "cmCTestCommand.h"
|
||||||
|
|
||||||
|
/** \class cmCTestStart
|
||||||
|
* \brief Run a ctest script
|
||||||
|
*
|
||||||
|
* cmCTestStartCommand defineds the command to start the nightly testing.
|
||||||
|
*/
|
||||||
|
class cmCTestStartCommand : public cmCTestCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
cmCTestStartCommand() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a virtual constructor for the command.
|
||||||
|
*/
|
||||||
|
virtual cmCommand* Clone()
|
||||||
|
{
|
||||||
|
cmCTestStartCommand* ni = new cmCTestStartCommand;
|
||||||
|
ni->m_CTest = this->m_CTest;
|
||||||
|
ni->m_CTestScriptHandler = this->m_CTestScriptHandler;
|
||||||
|
return ni;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the command is first encountered in
|
||||||
|
* the CMakeLists.txt file.
|
||||||
|
*/
|
||||||
|
virtual bool InitialPass(std::vector<std::string> const& args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
*/
|
||||||
|
virtual const char* GetName() { return "CTEST_START";}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Succinct documentation.
|
||||||
|
*/
|
||||||
|
virtual const char* GetTerseDocumentation()
|
||||||
|
{
|
||||||
|
return "Starts the testing for a given model";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More documentation.
|
||||||
|
*/
|
||||||
|
virtual const char* GetFullDocumentation()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" CTEST_START(Model [source [binary]])\n"
|
||||||
|
"Starts the testing for a given model. The command should be called after "
|
||||||
|
"the binary directory is initialized. If the 'source' and 'binary' "
|
||||||
|
"directory are not specified, it reads the CTEST_SOURCE_DIRECTORY and "
|
||||||
|
"CTEST_BINARY_DIRECTORY.";
|
||||||
|
}
|
||||||
|
|
||||||
|
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -227,7 +227,7 @@ cmCTest::cmCTest()
|
|||||||
m_BuildNoClean = false;
|
m_BuildNoClean = false;
|
||||||
m_BuildTwoConfig = false;
|
m_BuildTwoConfig = false;
|
||||||
m_Verbose = false;
|
m_Verbose = false;
|
||||||
m_DartMode = false;
|
m_ProduceXML = false;
|
||||||
m_ShowOnly = false;
|
m_ShowOnly = false;
|
||||||
m_RunConfigurationScript = false;
|
m_RunConfigurationScript = false;
|
||||||
m_TestModel = cmCTest::EXPERIMENTAL;
|
m_TestModel = cmCTest::EXPERIMENTAL;
|
||||||
@ -266,23 +266,23 @@ cmCTest::~cmCTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmCTest::Initialize()
|
int cmCTest::Initialize(const char* binary_dir)
|
||||||
{
|
{
|
||||||
if(!m_InteractiveDebugMode)
|
if(!m_InteractiveDebugMode)
|
||||||
{
|
{
|
||||||
this->BlockTestErrorDiagnostics();
|
this->BlockTestErrorDiagnostics();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ToplevelPath = cmSystemTools::GetCurrentWorkingDirectory();
|
m_BinaryDir = binary_dir;
|
||||||
cmSystemTools::ConvertToUnixSlashes(m_ToplevelPath);
|
cmSystemTools::ConvertToUnixSlashes(m_BinaryDir);
|
||||||
if ( !this->ReadCustomConfigurationFileTree(m_ToplevelPath.c_str()) )
|
if ( !this->ReadCustomConfigurationFileTree(m_BinaryDir.c_str()) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this->UpdateCTestConfiguration();
|
this->UpdateCTestConfiguration();
|
||||||
if ( m_DartMode )
|
if ( m_ProduceXML )
|
||||||
{
|
{
|
||||||
std::string testingDir = m_ToplevelPath + "/Testing";
|
std::string testingDir = m_BinaryDir + "/Testing";
|
||||||
if ( cmSystemTools::FileExists(testingDir.c_str()) )
|
if ( cmSystemTools::FileExists(testingDir.c_str()) )
|
||||||
{
|
{
|
||||||
if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) )
|
if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) )
|
||||||
@ -410,7 +410,7 @@ void cmCTest::UpdateCTestConfiguration()
|
|||||||
m_DartConfiguration[key] = value;
|
m_DartConfiguration[key] = value;
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
if ( m_DartMode )
|
if ( m_ProduceXML )
|
||||||
{
|
{
|
||||||
m_TimeOut = atoi(m_DartConfiguration["TimeOut"].c_str());
|
m_TimeOut = atoi(m_DartConfiguration["TimeOut"].c_str());
|
||||||
m_CompressXMLFiles = cmSystemTools::IsOn(m_DartConfiguration["CompressSubmission"].c_str());
|
m_CompressXMLFiles = cmSystemTools::IsOn(m_DartConfiguration["CompressSubmission"].c_str());
|
||||||
@ -495,7 +495,7 @@ bool cmCTest::OpenOutputFile(const std::string& path,
|
|||||||
const std::string& name, cmGeneratedFileStream& stream,
|
const std::string& name, cmGeneratedFileStream& stream,
|
||||||
bool compress)
|
bool compress)
|
||||||
{
|
{
|
||||||
std::string testingDir = m_ToplevelPath + "/Testing";
|
std::string testingDir = m_BinaryDir + "/Testing";
|
||||||
if ( path.size() > 0 )
|
if ( path.size() > 0 )
|
||||||
{
|
{
|
||||||
testingDir += "/" + path;
|
testingDir += "/" + path;
|
||||||
@ -574,7 +574,7 @@ int cmCTest::SubmitResults()
|
|||||||
if ( this->AddIfExists(files, "Coverage.xml") )
|
if ( this->AddIfExists(files, "Coverage.xml") )
|
||||||
{
|
{
|
||||||
cmCTest::tm_VectorOfStrings gfiles;
|
cmCTest::tm_VectorOfStrings gfiles;
|
||||||
std::string gpath = m_ToplevelPath + "/Testing/" + m_CurrentTag;
|
std::string gpath = m_BinaryDir + "/Testing/" + m_CurrentTag;
|
||||||
std::string::size_type glen = gpath.size() + 1;
|
std::string::size_type glen = gpath.size() + 1;
|
||||||
gpath = gpath + "/CoverageLog*";
|
gpath = gpath + "/CoverageLog*";
|
||||||
//std::cout << "Globbing for: " << gpath.c_str() << std::endl;
|
//std::cout << "Globbing for: " << gpath.c_str() << std::endl;
|
||||||
@ -623,7 +623,7 @@ int cmCTest::SubmitResults()
|
|||||||
cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" +
|
cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" +
|
||||||
m_DartConfiguration["DropSite"] +
|
m_DartConfiguration["DropSite"] +
|
||||||
cmCTest::MakeURLSafe(m_DartConfiguration["DropLocation"]);
|
cmCTest::MakeURLSafe(m_DartConfiguration["DropLocation"]);
|
||||||
if ( !submit.SubmitUsingFTP(m_ToplevelPath+"/Testing/"+m_CurrentTag,
|
if ( !submit.SubmitUsingFTP(m_BinaryDir+"/Testing/"+m_CurrentTag,
|
||||||
files, prefix, url) )
|
files, prefix, url) )
|
||||||
{
|
{
|
||||||
std::cerr << " Problems when submitting via FTP" << std::endl;
|
std::cerr << " Problems when submitting via FTP" << std::endl;
|
||||||
@ -655,7 +655,7 @@ int cmCTest::SubmitResults()
|
|||||||
url += "@";
|
url += "@";
|
||||||
}
|
}
|
||||||
url += m_DartConfiguration["DropSite"] + m_DartConfiguration["DropLocation"];
|
url += m_DartConfiguration["DropSite"] + m_DartConfiguration["DropLocation"];
|
||||||
if ( !submit.SubmitUsingHTTP(m_ToplevelPath+"/Testing/"+m_CurrentTag, files, prefix, url) )
|
if ( !submit.SubmitUsingHTTP(m_BinaryDir+"/Testing/"+m_CurrentTag, files, prefix, url) )
|
||||||
{
|
{
|
||||||
std::cerr << " Problems when submitting via HTTP" << std::endl;
|
std::cerr << " Problems when submitting via HTTP" << std::endl;
|
||||||
ofs << " Problems when submitting via HTTP" << std::endl;
|
ofs << " Problems when submitting via HTTP" << std::endl;
|
||||||
@ -681,7 +681,7 @@ int cmCTest::SubmitResults()
|
|||||||
url += m_DartConfiguration["DropSite"] + ":" + m_DartConfiguration["DropLocation"];
|
url += m_DartConfiguration["DropSite"] + ":" + m_DartConfiguration["DropLocation"];
|
||||||
|
|
||||||
if ( !submit.SubmitUsingSCP(m_DartConfiguration["ScpCommand"],
|
if ( !submit.SubmitUsingSCP(m_DartConfiguration["ScpCommand"],
|
||||||
m_ToplevelPath+"/Testing/"+m_CurrentTag, files, prefix, url) )
|
m_BinaryDir+"/Testing/"+m_CurrentTag, files, prefix, url) )
|
||||||
{
|
{
|
||||||
std::cerr << " Problems when submitting via SCP" << std::endl;
|
std::cerr << " Problems when submitting via SCP" << std::endl;
|
||||||
ofs << " Problems when submitting via SCP" << std::endl;
|
ofs << " Problems when submitting via SCP" << std::endl;
|
||||||
@ -696,7 +696,7 @@ int cmCTest::SubmitResults()
|
|||||||
|
|
||||||
bool cmCTest::CTestFileExists(const std::string& filename)
|
bool cmCTest::CTestFileExists(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::string testingDir = m_ToplevelPath + "/Testing/" + m_CurrentTag + "/" +
|
std::string testingDir = m_BinaryDir + "/Testing/" + m_CurrentTag + "/" +
|
||||||
filename;
|
filename;
|
||||||
return cmSystemTools::FileExists(testingDir.c_str());
|
return cmSystemTools::FileExists(testingDir.c_str());
|
||||||
}
|
}
|
||||||
@ -780,7 +780,7 @@ int cmCTest::ProcessTests()
|
|||||||
}
|
}
|
||||||
if ( !notest )
|
if ( !notest )
|
||||||
{
|
{
|
||||||
std::string notes_dir = m_ToplevelPath + "/Testing/Notes";
|
std::string notes_dir = m_BinaryDir + "/Testing/Notes";
|
||||||
if ( cmSystemTools::FileIsDirectory(notes_dir.c_str()) )
|
if ( cmSystemTools::FileIsDirectory(notes_dir.c_str()) )
|
||||||
{
|
{
|
||||||
cmsys::Directory d;
|
cmsys::Directory d;
|
||||||
@ -1218,7 +1218,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||||||
}
|
}
|
||||||
if( arg.find("-D",0) == 0 && i < args.size() - 1 )
|
if( arg.find("-D",0) == 0 && i < args.size() - 1 )
|
||||||
{
|
{
|
||||||
this->m_DartMode = true;
|
this->m_ProduceXML = true;
|
||||||
i++;
|
i++;
|
||||||
std::string targ = args[i];
|
std::string targ = args[i];
|
||||||
if ( targ == "Experimental" )
|
if ( targ == "Experimental" )
|
||||||
@ -1419,7 +1419,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||||||
if( ( arg.find("-T",0) == 0 ) &&
|
if( ( arg.find("-T",0) == 0 ) &&
|
||||||
(i < args.size() -1) )
|
(i < args.size() -1) )
|
||||||
{
|
{
|
||||||
this->m_DartMode = true;
|
this->m_ProduceXML = true;
|
||||||
i++;
|
i++;
|
||||||
if ( !this->SetTest(args[i].c_str(), false) )
|
if ( !this->SetTest(args[i].c_str(), false) )
|
||||||
{
|
{
|
||||||
@ -1496,7 +1496,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||||||
|
|
||||||
if(arg.find("-A",0) == 0 && i < args.size() - 1)
|
if(arg.find("-A",0) == 0 && i < args.size() - 1)
|
||||||
{
|
{
|
||||||
this->m_DartMode = true;
|
this->m_ProduceXML = true;
|
||||||
this->SetTest("Notes");
|
this->SetTest("Notes");
|
||||||
i++;
|
i++;
|
||||||
this->SetNotesFiles(args[i].c_str());
|
this->SetNotesFiles(args[i].c_str());
|
||||||
@ -1617,7 +1617,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !this->Initialize() )
|
if ( !this->Initialize(cmSystemTools::GetCurrentWorkingDirectory().c_str()) )
|
||||||
{
|
{
|
||||||
res = 12;
|
res = 12;
|
||||||
}
|
}
|
||||||
@ -2285,9 +2285,9 @@ std::string cmCTest::GetCurrentTag()
|
|||||||
return m_CurrentTag;
|
return m_CurrentTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmCTest::GetToplevelPath()
|
std::string cmCTest::GetBinaryDir()
|
||||||
{
|
{
|
||||||
return m_ToplevelPath;
|
return m_BinaryDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmCTest::GetConfigType()
|
std::string cmCTest::GetConfigType()
|
||||||
@ -2300,7 +2300,12 @@ bool cmCTest::GetShowOnly()
|
|||||||
return m_ShowOnly;
|
return m_ShowOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCTest::SetProduceXML(bool v)
|
||||||
|
{
|
||||||
|
m_ProduceXML = v;
|
||||||
|
}
|
||||||
|
|
||||||
bool cmCTest::GetProduceXML()
|
bool cmCTest::GetProduceXML()
|
||||||
{
|
{
|
||||||
return m_DartMode;
|
return m_ProduceXML;
|
||||||
}
|
}
|
||||||
|
110
Source/cmCTest.h
110
Source/cmCTest.h
@ -38,7 +38,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Initialize and finalize testing
|
* Initialize and finalize testing
|
||||||
*/
|
*/
|
||||||
int Initialize();
|
int Initialize(const char* binary_dir);
|
||||||
void Finalize();
|
void Finalize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,13 +110,51 @@ public:
|
|||||||
//! Set the notes files to be created.
|
//! Set the notes files to be created.
|
||||||
void SetNotesFiles(const char* notes);
|
void SetNotesFiles(const char* notes);
|
||||||
|
|
||||||
std::string m_ConfigType;
|
static void PopulateCustomVector(cmMakefile* mf, const char* definition,
|
||||||
bool m_Verbose;
|
tm_VectorOfStrings& vec);
|
||||||
bool m_DartMode;
|
static void PopulateCustomInteger(cmMakefile* mf, const char* def, int& val);
|
||||||
|
|
||||||
bool m_ForceNewCTestProcess;
|
///! Get the current time as string
|
||||||
|
std::string CurrentTime();
|
||||||
|
|
||||||
|
///! Open file in the output directory and set the stream
|
||||||
|
bool OpenOutputFile(const std::string& path,
|
||||||
|
const std::string& name,
|
||||||
|
cmGeneratedFileStream& stream,
|
||||||
|
bool compress = false);
|
||||||
|
|
||||||
bool m_RunConfigurationScript;
|
///! Convert string to something that is XML safe
|
||||||
|
static std::string MakeXMLSafe(const std::string&);
|
||||||
|
|
||||||
|
///! Should we only show what we would do?
|
||||||
|
bool GetShowOnly();
|
||||||
|
|
||||||
|
//! Start CTest XML output file
|
||||||
|
void StartXML(std::ostream& ostr);
|
||||||
|
|
||||||
|
//! End CTest XML output file
|
||||||
|
void EndXML(std::ostream& ostr);
|
||||||
|
|
||||||
|
//! Run command specialized for make and configure. Returns process status
|
||||||
|
// and retVal is return value or exception.
|
||||||
|
int RunMakeCommand(const char* command, std::string* output,
|
||||||
|
int* retVal, const char* dir, bool verbose, int timeout,
|
||||||
|
std::ofstream& ofs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the current tag
|
||||||
|
*/
|
||||||
|
std::string GetCurrentTag();
|
||||||
|
|
||||||
|
//! Get the path to the build tree
|
||||||
|
std::string GetBinaryDir();
|
||||||
|
|
||||||
|
//! Get the short path to the file. This means if the file is in binary or
|
||||||
|
//source directory, it will become /.../relative/path/to/file
|
||||||
|
std::string GetShortPathToFile(const char* fname);
|
||||||
|
|
||||||
|
//! Get the path to CTest
|
||||||
|
const char* GetCTestExecutable() { return m_CTestSelf.c_str(); }
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EXPERIMENTAL,
|
EXPERIMENTAL,
|
||||||
@ -134,60 +172,29 @@ public:
|
|||||||
COVERAGE_ERRORS = 0x20
|
COVERAGE_ERRORS = 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
int GenerateNotesFile(const char* files);
|
|
||||||
|
|
||||||
bool OpenOutputFile(const std::string& path,
|
|
||||||
const std::string& name,
|
|
||||||
cmGeneratedFileStream& stream,
|
|
||||||
bool compress = false);
|
|
||||||
static std::string MakeXMLSafe(const std::string&);
|
|
||||||
static std::string MakeURLSafe(const std::string&);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the current tag
|
|
||||||
*/
|
|
||||||
std::string GetCurrentTag();
|
|
||||||
|
|
||||||
///! Get the current time as string
|
|
||||||
std::string CurrentTime();
|
|
||||||
|
|
||||||
///! Should we only show what we would do?
|
|
||||||
bool GetShowOnly();
|
|
||||||
|
|
||||||
///! Are we producing XML
|
///! Are we producing XML
|
||||||
bool GetProduceXML();
|
bool GetProduceXML();
|
||||||
|
void SetProduceXML(bool v);
|
||||||
|
|
||||||
//! Start CTest XML output file
|
|
||||||
void StartXML(std::ostream& ostr);
|
|
||||||
|
|
||||||
//! End CTest XML output file
|
|
||||||
void EndXML(std::ostream& ostr);
|
|
||||||
|
|
||||||
//! Run command specialized for make and configure. Returns process status
|
|
||||||
// and retVal is return value or exception.
|
|
||||||
int RunMakeCommand(const char* command, std::string* output,
|
|
||||||
int* retVal, const char* dir, bool verbose, int timeout,
|
|
||||||
std::ofstream& ofs);
|
|
||||||
|
|
||||||
static void PopulateCustomVector(cmMakefile* mf, const char* definition,
|
|
||||||
tm_VectorOfStrings& vec);
|
|
||||||
static void PopulateCustomInteger(cmMakefile* mf, const char* def, int& val);
|
|
||||||
|
|
||||||
std::string GetToplevelPath();
|
|
||||||
|
|
||||||
//! Run command specialized for tests. Returns process status and retVal is
|
//! Run command specialized for tests. Returns process status and retVal is
|
||||||
// return value or exception.
|
// return value or exception.
|
||||||
int RunTest(std::vector<const char*> args, std::string* output, int *retVal,
|
int RunTest(std::vector<const char*> args, std::string* output, int *retVal,
|
||||||
std::ostream* logfile);
|
std::ostream* logfile);
|
||||||
|
|
||||||
//! Get the path to CTest
|
|
||||||
const char* GetCTestExecutable() { return m_CTestSelf.c_str(); }
|
|
||||||
|
|
||||||
//! Get the short path to the file. This means if the file is in binary or
|
|
||||||
//source directory, it will become /.../relative/path/to/file
|
|
||||||
std::string GetShortPathToFile(const char* fname);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
std::string m_ConfigType;
|
||||||
|
bool m_Verbose;
|
||||||
|
bool m_ProduceXML;
|
||||||
|
|
||||||
|
bool m_ForceNewCTestProcess;
|
||||||
|
|
||||||
|
bool m_RunConfigurationScript;
|
||||||
|
|
||||||
|
int GenerateNotesFile(const char* files);
|
||||||
|
|
||||||
|
static std::string MakeURLSafe(const std::string&);
|
||||||
|
|
||||||
// these are helper classes
|
// these are helper classes
|
||||||
typedef std::map<cmStdString,cmCTestGenericHandler*> t_TestingHandlers;
|
typedef std::map<cmStdString,cmCTestGenericHandler*> t_TestingHandlers;
|
||||||
t_TestingHandlers m_TestingHandlers;
|
t_TestingHandlers m_TestingHandlers;
|
||||||
@ -212,7 +219,6 @@ private:
|
|||||||
//! Map of configuration properties
|
//! Map of configuration properties
|
||||||
typedef std::map<cmStdString, cmStdString> tm_DartConfigurationMap;
|
typedef std::map<cmStdString, cmStdString> tm_DartConfigurationMap;
|
||||||
|
|
||||||
std::string m_ToplevelPath;
|
|
||||||
tm_DartConfigurationMap m_DartConfiguration;
|
tm_DartConfigurationMap m_DartConfiguration;
|
||||||
int m_Tests[LAST_TEST];
|
int m_Tests[LAST_TEST];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user