diff options
author | Brad King <brad.king@kitware.com> | 2015-01-15 20:23:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-01-20 14:33:21 (GMT) |
commit | 6dd980e0ef1254a6c3098488e6677f5eb4f40a86 (patch) | |
tree | f7d0568c3dbbc7ea23976f67ae016aab638fcb3e /Source/CTest/cmCTestSubmitCommand.cxx | |
parent | 5dc33f89b5405f1fbcefb9783ea2050a3686d7de (diff) | |
download | CMake-6dd980e0ef1254a6c3098488e6677f5eb4f40a86.zip CMake-6dd980e0ef1254a6c3098488e6677f5eb4f40a86.tar.gz CMake-6dd980e0ef1254a6c3098488e6677f5eb4f40a86.tar.bz2 |
ctest_submit: Make CDASH_UPLOAD mode arguments more strict
Disallow mixing of arguments from different command signatures.
Extend the RunCMake.CTestSubmit test to cover such error cases.
Diffstat (limited to 'Source/CTest/cmCTestSubmitCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index dcd7982..cc3514f 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -145,7 +145,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() static_cast<cmCTestSubmitHandler*>(handler)->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF"); - if(this->CDashUploadFile.size()) + if (this->CDashUpload) { static_cast<cmCTestSubmitHandler*>(handler)-> SetOption("CDashUploadFile", this->CDashUploadFile.c_str()); @@ -155,51 +155,65 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() return handler; } +//---------------------------------------------------------------------------- +bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + this->CDashUpload = !args.empty() && args[0] == "CDASH_UPLOAD"; + return this->cmCTestHandlerCommand::InitialPass(args, status); +} //---------------------------------------------------------------------------- bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) { - // Look for arguments specific to this command. - if(arg == "PARTS") + if (this->CDashUpload) { - this->ArgumentDoing = ArgumentDoingParts; - this->PartsMentioned = true; - return true; - } + if(arg == "CDASH_UPLOAD") + { + this->ArgumentDoing = ArgumentDoingCDashUpload; + return true; + } - if(arg == "FILES") - { - this->ArgumentDoing = ArgumentDoingFiles; - this->FilesMentioned = true; - return true; + if(arg == "CDASH_UPLOAD_TYPE") + { + this->ArgumentDoing = ArgumentDoingCDashUploadType; + return true; + } } - - if(arg == "RETRY_COUNT") + else { - this->ArgumentDoing = ArgumentDoingRetryCount; - return true; - } + // Look for arguments specific to this command. + if(arg == "PARTS") + { + this->ArgumentDoing = ArgumentDoingParts; + this->PartsMentioned = true; + return true; + } - if(arg == "RETRY_DELAY") - { - this->ArgumentDoing = ArgumentDoingRetryDelay; - return true; - } + if(arg == "FILES") + { + this->ArgumentDoing = ArgumentDoingFiles; + this->FilesMentioned = true; + return true; + } - if(arg == "CDASH_UPLOAD") - { - this->ArgumentDoing = ArgumentDoingCDashUpload; - return true; - } - if(arg == "CDASH_UPLOAD_TYPE") - { - this->ArgumentDoing = ArgumentDoingCDashUploadType; - return true; - } - if(arg == "INTERNAL_TEST_CHECKSUM") - { - this->InternalTest = true; - return true; + if(arg == "RETRY_COUNT") + { + this->ArgumentDoing = ArgumentDoingRetryCount; + return true; + } + + if(arg == "RETRY_DELAY") + { + this->ArgumentDoing = ArgumentDoingRetryDelay; + return true; + } + + if(arg == "INTERNAL_TEST_CHECKSUM") + { + this->InternalTest = true; + return true; + } } // Look for other arguments. @@ -260,11 +274,14 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) if(this->ArgumentDoing == ArgumentDoingCDashUpload) { + this->ArgumentDoing = ArgumentDoingNone; this->CDashUploadFile = arg; return true; } + if(this->ArgumentDoing == ArgumentDoingCDashUploadType) { + this->ArgumentDoing = ArgumentDoingNone; this->CDashUploadType = arg; return true; } |