diff options
author | David Cole <david.cole@kitware.com> | 2009-02-03 16:52:54 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-02-03 16:52:54 (GMT) |
commit | 6f88b29121274b7479ee7b2eb8da9a3c83d8c950 (patch) | |
tree | caeeb08e088fa4c6fde9fa9d009b627fa7fe1426 /Source/CTest/cmCTestSubmitCommand.cxx | |
parent | a1d7f82d6845a496eef7520936e07221b49eb70c (diff) | |
download | CMake-6f88b29121274b7479ee7b2eb8da9a3c83d8c950.zip CMake-6f88b29121274b7479ee7b2eb8da9a3c83d8c950.tar.gz CMake-6f88b29121274b7479ee7b2eb8da9a3c83d8c950.tar.bz2 |
ENH: Add FILES arg to the ctest_submit command. BUG: Propagate the IsCDash setting properly to the ctest configuration during a submit. Also, do not propagate TriggerSite for projects submitting to CDash. No triggers are necessary with CDash.
Diffstat (limited to 'Source/CTest/cmCTestSubmitCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 123 |
1 files changed, 107 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 2e435a7..7dfa461 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -30,31 +30,66 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() = this->Makefile->GetDefinition("CTEST_DROP_LOCATION"); const char* ctestTriggerSite = this->Makefile->GetDefinition("CTEST_TRIGGER_SITE"); + bool ctestDropSiteCDash + = this->Makefile->IsOn("CTEST_DROP_SITE_CDASH"); if ( !ctestDropMethod ) { ctestDropMethod = "http"; } - if ( !ctestDropSite ) - { - ctestDropSite = "public.kitware.com"; - } - if ( !ctestDropLocation ) + + if ( ctestDropSiteCDash ) { - ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi"; + // drop site is a CDash server... + // + if ( !ctestDropSite ) + { + // error: CDash requires CTEST_DROP_SITE definition + // in CTestConfig.cmake + } + if ( !ctestDropLocation ) + { + // error: CDash requires CTEST_DROP_LOCATION definition + // in CTestConfig.cmake + } } - if ( !ctestTriggerSite ) + else { - ctestTriggerSite - = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: " - << ctestTriggerSite << std::endl;); + // drop site is a *NOT* a CDash server... + // + // Keep all this code in case anybody out there is still + // using newer CMake with non-CDash servers + // + if ( !ctestDropSite ) + { + ctestDropSite = "public.kitware.com"; + } + if ( !ctestDropLocation ) + { + ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi"; + } + if ( !ctestTriggerSite ) + { + ctestTriggerSite + = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: " + << ctestTriggerSite << std::endl;); + } } - this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); - this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); + this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); + this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation); - this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + + this->CTest->SetCTestConfiguration("IsCDash", + ctestDropSiteCDash ? "TRUE" : "FALSE"); + + // Only propagate TriggerSite for non-CDash projects: + // + if ( !ctestDropSiteCDash ) + { + this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + } this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER"); @@ -79,6 +114,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() } this->CTest->GenerateNotesFile(newNotesFiles); } + const char* extraFilesVariable = this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES"); if (extraFilesVariable) @@ -108,16 +144,44 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() return 0; } + // If no FILES or PARTS given, *all* PARTS are submitted by default. + // + // If FILES are given, but not PARTS, only the FILES are submitted + // and *no* PARTS are submitted. + // (This is why we select the empty "noParts" set in the + // FilesMentioned block below...) + // + // If PARTS are given, only the selected PARTS are submitted. + // + // If both PARTS and FILES are given, only the selected PARTS *and* + // all the given FILES are submitted. + + // If given explicit FILES to submit, pass them to the handler. + // + if(this->FilesMentioned) + { + // Intentionally select *no* PARTS. (Pass an empty set.) If PARTS + // were also explicitly mentioned, they will be selected below... + // But FILES with no PARTS mentioned should just submit the FILES + // without any of the default parts. + // + std::set<cmCTest::Part> noParts; + static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts); + + static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files); + } + // If a PARTS option was given, select only the named parts for submission. - if(!this->Parts.empty()) + // + if(this->PartsMentioned) { static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts); } + return handler; } - //---------------------------------------------------------------------------- bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) { @@ -125,6 +189,14 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) if(arg == "PARTS") { this->ArgumentDoing = ArgumentDoingParts; + this->PartsMentioned = true; + return true; + } + + if(arg == "FILES") + { + this->ArgumentDoing = ArgumentDoingFiles; + this->FilesMentioned = true; return true; } @@ -132,6 +204,7 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) return this->Superclass::CheckArgumentKeyword(arg); } + //---------------------------------------------------------------------------- bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) { @@ -153,6 +226,24 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) return true; } + if(this->ArgumentDoing == ArgumentDoingFiles) + { + cmStdString filename(arg); + if(cmSystemTools::FileExists(filename.c_str())) + { + this->Files.insert(filename); + } + else + { + cmOStringStream e; + e << "File \"" << filename << "\" does not exist. Cannot submit " + << "a non-existent file."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->ArgumentDoing = ArgumentDoingError; + } + return true; + } + // Look for other arguments. return this->Superclass::CheckArgumentValue(arg); } |