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/cmCTestSubmitHandler.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/cmCTestSubmitHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 0e19259..11e3343 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1084,10 +1084,16 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, std::string const& typeString) { - if(!cmSystemTools::FileExists(file)) + if (file.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Upload file not found: " << file << "\n"); + "Upload file not specified\n"); + return -1; + } + if (!cmSystemTools::FileExists(file)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Upload file not found: '" << file << "'\n"); return -1; } cmCTestCurl curl(this->CTest); @@ -1118,6 +1124,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script")); cmake* cm = ch->GetCMake(); const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL); + // TODO: Encode values for a URL instead of trusting caller. std::ostringstream str; str << "project=" << this->CTest->GetCTestConfiguration("ProjectName") << "&"; @@ -1214,8 +1221,7 @@ int cmCTestSubmitHandler::ProcessHandler() const char* cdashUploadType = this->GetOption("CDashUploadType"); if(cdashUploadFile && cdashUploadType) { - return this->HandleCDashUploadFile(std::string(cdashUploadFile), - std::string(cdashUploadType)); + return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType); } std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash"); // cdash does not need to trigger so just return true |