ENH: Add support for special tracks, fix options of handlers so that the -R, -U, and so on work in the new style scripting
This commit is contained in:
parent
185c282bd3
commit
2d81046ae2
|
@ -53,10 +53,38 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value)
|
|||
this->Options[op] = value;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void cmCTestGenericHandler::SetPersistentOption(const char* op, const char* value)
|
||||
{
|
||||
if ( !op )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !value )
|
||||
{
|
||||
cmCTestGenericHandler::t_StringToString::iterator remit
|
||||
= this->PersistentOptions.find(op);
|
||||
if ( remit != this->PersistentOptions.end() )
|
||||
{
|
||||
this->PersistentOptions.erase(remit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this->PersistentOptions[op] = value;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void cmCTestGenericHandler::Initialize()
|
||||
{
|
||||
this->Options.clear();
|
||||
t_StringToString::iterator it;
|
||||
for ( it = this->PersistentOptions.begin();
|
||||
it != this->PersistentOptions.end();
|
||||
++ it )
|
||||
{
|
||||
this->Options[it->first.c_str()] = it->second.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -75,6 +75,8 @@ public:
|
|||
|
||||
typedef std::map<cmStdString,cmStdString> t_StringToString;
|
||||
|
||||
|
||||
void SetPersistentOption(const char* op, const char* value);
|
||||
void SetOption(const char* op, const char* value);
|
||||
const char* GetOption(const char* op);
|
||||
|
||||
|
@ -93,6 +95,7 @@ protected:
|
|||
bool HandlerVerbose;
|
||||
cmCTest *CTest;
|
||||
t_StringToString Options;
|
||||
t_StringToString PersistentOptions;
|
||||
|
||||
cmCTestCommand* Command;
|
||||
int SubmitIndex;
|
||||
|
|
|
@ -29,22 +29,32 @@ bool cmCTestStartCommand::InitialPass(
|
|||
return false;
|
||||
}
|
||||
|
||||
const char* smodel = args[0].c_str();
|
||||
size_t cnt = 0;
|
||||
const char* smodel = args[cnt].c_str();
|
||||
const char* src_dir = 0;
|
||||
const char* bld_dir = 0;
|
||||
|
||||
if ( args.size() >= 2 )
|
||||
cnt++;
|
||||
|
||||
this->CTest->SetSpecificTrack(0);
|
||||
if ( cnt < args.size() -1 )
|
||||
{
|
||||
src_dir = args[1].c_str();
|
||||
if ( args.size() == 3 )
|
||||
if ( args[cnt] == "TRACK" )
|
||||
{
|
||||
bld_dir = args[2].c_str();
|
||||
cnt ++;
|
||||
this->CTest->SetSpecificTrack(args[cnt].c_str());
|
||||
cnt ++;
|
||||
}
|
||||
}
|
||||
if ( args.size() > 3 )
|
||||
|
||||
if ( cnt < args.size() )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
src_dir = args[cnt].c_str();
|
||||
cnt ++;
|
||||
if ( cnt < args.size() )
|
||||
{
|
||||
bld_dir = args[cnt].c_str();
|
||||
}
|
||||
}
|
||||
if ( !src_dir )
|
||||
{
|
||||
|
@ -74,6 +84,12 @@ bool cmCTestStartCommand::InitialPass(
|
|||
<< smodel << std::endl
|
||||
<< " Source directory: " << src_dir << std::endl
|
||||
<< " Build directory: " << bld_dir << std::endl);
|
||||
const char* track = this->CTest->GetSpecificTrack();
|
||||
if ( track )
|
||||
{
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
||||
" Track: " << track << std::endl);
|
||||
}
|
||||
|
||||
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
|
||||
this->CTest->SetSuppressUpdatingCTestConfiguration(true);
|
||||
|
|
|
@ -66,11 +66,12 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_START(Model [source [binary]])\n"
|
||||
" CTEST_START(Model [TRACK <track>] [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.";
|
||||
"CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY. If the track is "
|
||||
"specified, the submissions will go to the specified track.";
|
||||
}
|
||||
|
||||
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
|
||||
|
|
|
@ -874,6 +874,12 @@ int cmCTestSubmitHandler::ProcessHandler()
|
|||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using "
|
||||
<< this->CTest->GetCTestConfiguration("DropMethod") << ")"
|
||||
<< std::endl);
|
||||
const char* specificTrack = this->CTest->GetSpecificTrack();
|
||||
if ( specificTrack )
|
||||
{
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Send to track: "
|
||||
<< specificTrack << std::endl);
|
||||
}
|
||||
this->SetLogFile(&ofs);
|
||||
if ( this->CTest->GetCTestConfiguration("DropMethod") == "" ||
|
||||
this->CTest->GetCTestConfiguration("DropMethod") == "ftp" )
|
||||
|
|
|
@ -784,7 +784,7 @@ int cmCTest::ProcessTests()
|
|||
if ( this->Tests[UPDATE_TEST] || this->Tests[ALL_TEST] )
|
||||
{
|
||||
cmCTestGenericHandler* uphandler = this->GetHandler("update");
|
||||
uphandler->SetOption("SourceDirectory",
|
||||
uphandler->SetPersistentOption("SourceDirectory",
|
||||
this->GetCTestConfiguration("SourceDirectory").c_str());
|
||||
update_count = uphandler->ProcessHandler();
|
||||
if ( update_count < 0 )
|
||||
|
@ -887,6 +887,10 @@ int cmCTest::ProcessTests()
|
|||
//----------------------------------------------------------------------
|
||||
std::string cmCTest::GetTestModelString()
|
||||
{
|
||||
if ( !this->SpecificTrack.empty() )
|
||||
{
|
||||
return this->SpecificTrack;
|
||||
}
|
||||
switch ( this->TestModel )
|
||||
{
|
||||
case cmCTest::NIGHTLY:
|
||||
|
@ -1337,6 +1341,11 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||
this->Debug = true;
|
||||
this->ShowLineNumbers = true;
|
||||
}
|
||||
if(this->CheckArgument(arg, "--track") && i < args.size() - 1)
|
||||
{
|
||||
i++;
|
||||
this->SpecificTrack = args[i];
|
||||
}
|
||||
if(this->CheckArgument(arg, "--show-line-numbers"))
|
||||
{
|
||||
this->ShowLineNumbers = true;
|
||||
|
@ -1690,22 +1699,22 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||
i < args.size() - 1)
|
||||
{
|
||||
i++;
|
||||
this->GetHandler("test")->SetOption("TestsToRunInformation",
|
||||
this->GetHandler("test")->SetPersistentOption("TestsToRunInformation",
|
||||
args[i].c_str());
|
||||
this->GetHandler("memcheck")->SetOption("TestsToRunInformation",
|
||||
this->GetHandler("memcheck")->SetPersistentOption("TestsToRunInformation",
|
||||
args[i].c_str());
|
||||
}
|
||||
if(this->CheckArgument(arg, "-U", "--union"))
|
||||
{
|
||||
this->GetHandler("test")->SetOption("UseUnion", "true");
|
||||
this->GetHandler("memcheck")->SetOption("UseUnion", "true");
|
||||
this->GetHandler("test")->SetPersistentOption("UseUnion", "true");
|
||||
this->GetHandler("memcheck")->SetPersistentOption("UseUnion", "true");
|
||||
}
|
||||
if(this->CheckArgument(arg, "-R", "--tests-regex") && i < args.size() - 1)
|
||||
{
|
||||
i++;
|
||||
this->GetHandler("test")->SetOption("IncludeRegularExpression",
|
||||
this->GetHandler("test")->SetPersistentOption("IncludeRegularExpression",
|
||||
args[i].c_str());
|
||||
this->GetHandler("memcheck")->SetOption("IncludeRegularExpression",
|
||||
this->GetHandler("memcheck")->SetPersistentOption("IncludeRegularExpression",
|
||||
args[i].c_str());
|
||||
}
|
||||
|
||||
|
@ -1713,9 +1722,9 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
|
|||
i < args.size() - 1)
|
||||
{
|
||||
i++;
|
||||
this->GetHandler("test")->SetOption("ExcludeRegularExpression",
|
||||
this->GetHandler("test")->SetPersistentOption("ExcludeRegularExpression",
|
||||
args[i].c_str());
|
||||
this->GetHandler("memcheck")->SetOption("ExcludeRegularExpression",
|
||||
this->GetHandler("memcheck")->SetPersistentOption("ExcludeRegularExpression",
|
||||
args[i].c_str());
|
||||
}
|
||||
|
||||
|
@ -1930,6 +1939,9 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf,
|
|||
{
|
||||
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
|
||||
<< fname.c_str() << std::endl);
|
||||
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
|
||||
cmSystemTools::ResetErrorOccuredFlag();
|
||||
|
||||
if ( !mf->ReadListFile(0, fname.c_str()) ||
|
||||
cmSystemTools::GetErrorOccuredFlag() )
|
||||
{
|
||||
|
@ -1938,6 +1950,10 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf,
|
|||
<< fname.c_str() << std::endl);
|
||||
}
|
||||
found = true;
|
||||
if ( erroroc )
|
||||
{
|
||||
cmSystemTools::SetErrorOccured();
|
||||
}
|
||||
}
|
||||
|
||||
if ( !fast )
|
||||
|
@ -2150,6 +2166,27 @@ bool cmCTest::GetProduceXML()
|
|||
return this->ProduceXML;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const char* cmCTest::GetSpecificTrack()
|
||||
{
|
||||
if ( this->SpecificTrack.empty() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return this->SpecificTrack.c_str();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void cmCTest::SetSpecificTrack(const char* track)
|
||||
{
|
||||
if ( !track )
|
||||
{
|
||||
this->SpecificTrack = "";
|
||||
return;
|
||||
}
|
||||
this->SpecificTrack = track;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void cmCTest::AddSubmitFile(const char* name)
|
||||
{
|
||||
|
|
|
@ -297,6 +297,10 @@ public:
|
|||
std::vector<cmStdString> &GetInitialCommandLineArguments()
|
||||
{ return this->InitialCommandLineArguments; };
|
||||
|
||||
//! Set the track to submit to
|
||||
void SetSpecificTrack(const char* track);
|
||||
const char* GetSpecificTrack();
|
||||
|
||||
private:
|
||||
std::string ConfigType;
|
||||
bool Verbose;
|
||||
|
@ -342,6 +346,7 @@ private:
|
|||
bool TomorrowTag;
|
||||
|
||||
int TestModel;
|
||||
std::string SpecificTrack;
|
||||
|
||||
double TimeOut;
|
||||
|
||||
|
|
|
@ -97,6 +97,11 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
|
|||
"This option tells ctest to act as a Dart client "
|
||||
"and perform some action such as start, build, test etc. "
|
||||
"Combining -M and -T is similar to -D"},
|
||||
{"--track <track>", "Specify the track to submit dashboard to",
|
||||
"Submit dashboard to specified track instead of default one. By "
|
||||
"default, the dashboard is submitted to Nightly, Experimental, or "
|
||||
"Continuous track, but by specifying this option, the track can be "
|
||||
"arbitrary."},
|
||||
{"-S <script>, --script <script>", "Execute a dashboard for a "
|
||||
"configuration",
|
||||
"This option tells ctest to load in a configuration script which sets "
|
||||
|
|
Loading…
Reference in New Issue