diff options
author | Kitware Robot <kwrobot@kitware.com> | 2018-06-01 13:53:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-06-01 13:53:42 (GMT) |
commit | d7204e649ed4ebb19bb341b4e49eb51514364922 (patch) | |
tree | d9ac3ded5ae6899be7188795011743fe3e6da0a6 /Source/CTest/cmCTestSubmitHandler.cxx | |
parent | 12fed3edb107c949671043196fa94c542b45452a (diff) | |
download | CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.zip CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.tar.gz CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.tar.bz2 |
Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`. Use `clang-format` version 6.0.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/CTest/cmCTestSubmitHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 174 |
1 files changed, 102 insertions, 72 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3bab81e..cae3d4c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -28,9 +28,9 @@ #include "cmake.h" #if defined(CTEST_USE_XMLRPC) -#include "cmVersion.h" -#include "cm_sys_stat.h" -#include "cm_xmlrpc.h" +# include "cmVersion.h" +# include "cm_sys_stat.h" +# include "cm_xmlrpc.h" #endif #define SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT 120 @@ -248,14 +248,16 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, res = ::curl_easy_perform(curl); if (!chunk.empty()) { - cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl, this->Quiet); } if (!chunkDebug.empty()) { cmCTestOptionalLog( - this->CTest, DEBUG, "CURL debug output: [" + this->CTest, DEBUG, + "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl, this->Quiet); @@ -263,8 +265,9 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, fclose(ftpfile); if (res) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Error when uploading file: " << local_file + << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " << local_file @@ -274,7 +277,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, // avoid dereference of empty vector if (!chunk.empty()) { *this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size()); - cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); } @@ -418,8 +422,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } } std::string upload_as = url + - ((url.find('?') == std::string::npos) ? '?' : '&') + "FileName=" + - ofile; + ((url.find('?') == std::string::npos) ? '?' : '&') + + "FileName=" + ofile; upload_as += "&MD5="; @@ -475,7 +479,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, res = ::curl_easy_perform(curl); if (!chunk.empty()) { - cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl, this->Quiet); @@ -483,7 +488,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } if (!chunkDebug.empty()) { cmCTestOptionalLog( - this->CTest, DEBUG, "CURL debug output: [" + this->CTest, DEBUG, + "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl, this->Quiet); @@ -537,7 +543,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if (!chunk.empty()) { cmCTestOptionalLog( - this->CTest, DEBUG, "CURL output: [" + this->CTest, DEBUG, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl, this->Quiet); @@ -552,8 +559,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, fclose(ftpfile); if (res) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Error when uploading file: " << local_file + << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " << local_file @@ -565,7 +573,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, *this->LogFile << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl; - cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); } @@ -612,7 +621,8 @@ void cmCTestSubmitHandler::ParseResponse( } if (this->HasWarnings || this->HasErrors) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Server Response:\n" + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Server Response:\n" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n"); } } @@ -689,8 +699,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, } } std::string turl = url + - ((url.find('?') == std::string::npos) ? '?' : '&') + "xmlfile=" + - ofile; + ((url.find('?') == std::string::npos) ? '?' : '&') + + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl << std::endl; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " << turl << std::endl, this->Quiet); @@ -709,7 +719,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, *this->LogFile << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl; - cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); } @@ -719,14 +730,16 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, } if (!chunk.empty()) { - cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, + "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl, this->Quiet); } if (!chunkDebug.empty()) { cmCTestOptionalLog( - this->CTest, DEBUG, "CURL debug output: [" + this->CTest, DEBUG, + "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << std::endl, this->Quiet); @@ -777,9 +790,9 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, argv[1] = lfname.c_str(); std::string rfname = url + "/" + remoteprefix + file; argv[2] = rfname.c_str(); - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" - << argv[0] << "\" \"" << argv[1] << "\" \"" << argv[2] - << "\"" << std::endl, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" + << argv[2] << "\"" << std::endl, this->Quiet); *this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" << argv[2] << "\"" << std::endl; @@ -824,13 +837,14 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, *this->LogFile << "\tThere was an exception: " << retVal << std::endl; problems++; } else if (result == cmsysProcess_State_Expired) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was a timeout" - << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "\tThere was a timeout" << std::endl); *this->LogFile << "\tThere was a timeout" << std::endl; problems++; } else if (result == cmsysProcess_State_Error) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "\tError executing SCP: " - << cmsysProcess_GetErrorString(cp) << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "\tError executing SCP: " << cmsysProcess_GetErrorString(cp) + << std::endl); *this->LogFile << "\tError executing SCP: " << cmsysProcess_GetErrorString(cp) << std::endl; problems++; @@ -864,8 +878,9 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix, lfname += "/" + file; std::string rfname = destination + "/" + remoteprefix + file; cmSystemTools::CopyFileAlways(lfname, rfname); - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " - << lfname << " to " << rfname << std::endl, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Copy file: " << lfname << " to " << rfname + << std::endl, this->Quiet); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; @@ -892,8 +907,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( xmlrpc_env_init(&env); /* Call the famous server at UserLand. */ - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " - << realURL << " (" << remoteprefix << ")" << std::endl, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submitting to: " << realURL << " (" << remoteprefix + << ")" << std::endl, this->Quiet); for (std::string const& file : files) { xmlrpc_value* result; @@ -916,8 +932,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( // make sure the file is not too big. if (static_cast<off_t>(static_cast<size_t>(st.st_size)) != static_cast<off_t>(st.st_size)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " File too big: " << local_file - << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + " File too big: " << local_file << std::endl); return false; } size_t fileSize = static_cast<size_t>(st.st_size); @@ -947,9 +963,10 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( delete[] fileBuffer; if (env.fault_occurred) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " Submission problem: " - << env.fault_string << " (" << env.fault_code << ")" - << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Submission problem: " << env.fault_string << " (" + << env.fault_code << ")" + << std::endl); xmlrpc_env_clean(&env); xmlrpc_client_cleanup(); return false; @@ -1004,8 +1021,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, return -1; } if (!cmSystemTools::FileExists(file)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Upload file not found: '" - << file << "'\n"); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Upload file not found: '" << file << "'\n"); return -1; } cmCTestCurl curl(this->CTest); @@ -1040,8 +1057,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, unsigned long retryDelayValue = 0; if (!cmSystemTools::StringToULong(retryDelayString.c_str(), &retryDelayValue)) { - cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " - << retryDelayString << std::endl); + cmCTestLog(this->CTest, WARNING, + "Invalid value for 'RETRY_DELAY' : " << retryDelayString + << std::endl); } else { retryDelay = std::chrono::seconds(retryDelayValue); } @@ -1049,8 +1067,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, unsigned long retryCount = 0; if (!retryCountString.empty()) { if (!cmSystemTools::StringToULong(retryCountString.c_str(), &retryCount)) { - cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " - << retryCountString << std::endl); + cmCTestLog(this->CTest, WARNING, + "Invalid value for 'RETRY_DELAY' : " << retryCountString + << std::endl); } } @@ -1118,7 +1137,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, } } if (!internalTest && !requestSucceeded) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in HttpRequest\n" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error in HttpRequest\n" << response); return -1; } @@ -1128,7 +1148,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, Json::Value json; Json::Reader reader; if (!internalTest && !reader.parse(response, json)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "error parsing json string [" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "error parsing json string [" << response << "]\n" << reader.getFormattedErrorMessages() << "\n"); return -1; @@ -1195,12 +1216,14 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, } if (!uploadSucceeded) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "error uploading to CDash. " - << file << " " << url << " " << fstr.str()); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "error uploading to CDash. " << file << " " << url << " " + << fstr.str()); return -1; } if (!reader.parse(response, json)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "error parsing json string [" + cmCTestLog(this->CTest, ERROR_MESSAGE, + "error parsing json string [" << response << "]\n" << reader.getFormattedErrorMessages() << "\n"); return -1; @@ -1357,7 +1380,8 @@ int cmCTestSubmitHandler::ProcessHandler() cnt++; } } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "Submit files (using " << this->CTest->GetCTestConfiguration("DropMethod") << ")" << std::endl, this->Quiet); @@ -1380,8 +1404,9 @@ int cmCTestSubmitHandler::ProcessHandler() std::string url = "ftp://"; url += cmCTest::MakeURLSafe( this->CTest->GetCTestConfiguration("DropSiteUser")) + - ":" + cmCTest::MakeURLSafe( - this->CTest->GetCTestConfiguration("DropSitePassword")) + + ":" + + cmCTest::MakeURLSafe( + this->CTest->GetCTestConfiguration("DropSitePassword")) + "@" + this->CTest->GetCTestConfiguration("DropSite") + cmCTest::MakeURLSafe(this->CTest->GetCTestConfiguration("DropLocation")); if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { @@ -1409,12 +1434,13 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } if (!this->CDash) { - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" - << std::endl - << " Trigger site: " - << this->CTest->GetCTestConfiguration("TriggerSite") << std::endl, - this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" + << std::endl + << " Trigger site: " + << this->CTest->GetCTestConfiguration("TriggerSite") + << std::endl, + this->Quiet); if (!this->TriggerUsingHTTP( files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) { @@ -1466,12 +1492,13 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } if (!this->CDash) { - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" - << std::endl - << " Trigger site: " - << this->CTest->GetCTestConfiguration("TriggerSite") << std::endl, - this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" + << std::endl + << " Trigger site: " + << this->CTest->GetCTestConfiguration("TriggerSite") + << std::endl, + this->Quiet); if (!this->TriggerUsingHTTP( files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) { @@ -1482,15 +1509,17 @@ int cmCTestSubmitHandler::ProcessHandler() } } if (this->HasErrors) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Errors occurred during " - "submission." + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Errors occurred during " + "submission." << std::endl); ofs << " Errors occurred during submission. " << std::endl; } else { - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, " Submission successful" - << (this->HasWarnings ? ", with warnings." : "") << std::endl, - this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submission successful" + << (this->HasWarnings ? ", with warnings." : "") + << std::endl, + this->Quiet); ofs << " Submission successful" << (this->HasWarnings ? ", with warnings." : "") << std::endl; } @@ -1587,8 +1616,9 @@ int cmCTestSubmitHandler::ProcessHandler() return 0; } - cmCTestLog(this->CTest, ERROR_MESSAGE, " Unknown submission method: \"" - << dropMethod << "\"" << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Unknown submission method: \"" << dropMethod << "\"" + << std::endl); return -1; } |