diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.cxx | 28 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.h | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 32 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.h | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 6 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 55 | ||||
-rw-r--r-- | Source/cmCTest.h | 5 | ||||
-rw-r--r-- | Source/ctest.cxx | 5 |
8 files changed, 120 insertions, 19 deletions
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 4c39842..563c7b6 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -54,9 +54,37 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* 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(); + } } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 9efa113..2b84ded 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -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; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 515cf75..aa77c75 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -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); diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index f651bc8..3962d03 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -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); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 8d5effa..b20388c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -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" ) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 839cced..cfba26b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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 ) @@ -2151,6 +2167,27 @@ bool cmCTest::GetProduceXML() } //---------------------------------------------------------------------- +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) { this->SubmitFiles.insert(name); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index b73f8ce..14bdfcc 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -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; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index ce6235d..d55597f 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -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 " |