mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 09:59:20 -05:00
Merge topic 'no-stringly-typed-variables'
5497eba1a0CTestUpdate: Prefer concrete variables over map entries8cac63814cCTestSubmit: Prefer concrete variables over map entries Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9935
This commit is contained in:
@@ -164,15 +164,16 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
handler->SetHttpHeaders(this->HttpHeaders);
|
||||
}
|
||||
|
||||
handler->SetOption("RetryDelay", this->RetryDelay);
|
||||
handler->SetOption("RetryCount", this->RetryCount);
|
||||
handler->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF");
|
||||
handler->RetryDelay = this->RetryDelay;
|
||||
handler->RetryCount = this->RetryCount;
|
||||
handler->InternalTest = this->InternalTest;
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
|
||||
if (this->CDashUpload) {
|
||||
handler->SetOption("CDashUploadFile", this->CDashUploadFile);
|
||||
handler->SetOption("CDashUploadType", this->CDashUploadType);
|
||||
handler->CDashUpload = true;
|
||||
handler->CDashUploadFile = this->CDashUploadFile;
|
||||
handler->CDashUploadType = this->CDashUploadType;
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
||||
|
||||
upload_as += "&MD5=";
|
||||
|
||||
if (this->GetOption("InternalTest").IsOn()) {
|
||||
if (this->InternalTest) {
|
||||
upload_as += "ffffffffffffffffffffffffffffffff";
|
||||
} else {
|
||||
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
|
||||
@@ -365,8 +365,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
||||
bool successful_submission = response_code == 200;
|
||||
|
||||
if (!successful_submission || this->HasErrors) {
|
||||
std::string retryDelay = *this->GetOption("RetryDelay");
|
||||
std::string retryCount = *this->GetOption("RetryCount");
|
||||
std::string retryDelay = this->RetryDelay;
|
||||
std::string retryCount = this->RetryCount;
|
||||
|
||||
auto delay = cmDuration(
|
||||
retryDelay.empty()
|
||||
@@ -525,11 +525,11 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
||||
fields = url.substr(pos + 1);
|
||||
url.erase(pos);
|
||||
}
|
||||
bool internalTest = this->GetOption("InternalTest").IsOn();
|
||||
bool internalTest = this->InternalTest;
|
||||
|
||||
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
|
||||
std::string retryDelayString = *this->GetOption("RetryDelay");
|
||||
std::string retryCountString = *this->GetOption("RetryCount");
|
||||
std::string retryDelayString = this->RetryDelay;
|
||||
std::string retryCountString = this->RetryCount;
|
||||
auto retryDelay = std::chrono::seconds(0);
|
||||
if (!retryDelayString.empty()) {
|
||||
unsigned long retryDelayValue = 0;
|
||||
@@ -718,10 +718,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
||||
|
||||
int cmCTestSubmitHandler::ProcessHandler()
|
||||
{
|
||||
cmValue cdashUploadFile = this->GetOption("CDashUploadFile");
|
||||
cmValue cdashUploadType = this->GetOption("CDashUploadType");
|
||||
if (cdashUploadFile && cdashUploadType) {
|
||||
return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType);
|
||||
if (this->CDashUpload) {
|
||||
return this->HandleCDashUploadFile(this->CDashUploadFile,
|
||||
this->CDashUploadType);
|
||||
}
|
||||
|
||||
const std::string& buildDirectory =
|
||||
|
||||
@@ -88,4 +88,14 @@ private:
|
||||
std::set<std::string> Files;
|
||||
std::vector<std::string> CommandLineHttpHeaders;
|
||||
std::vector<std::string> HttpHeaders;
|
||||
|
||||
bool CDashUpload = false;
|
||||
bool InternalTest = false;
|
||||
|
||||
std::string CDashUploadFile;
|
||||
std::string CDashUploadType;
|
||||
std::string RetryCount;
|
||||
std::string RetryDelay;
|
||||
|
||||
friend class cmCTestSubmitCommand;
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
|
||||
this->SetError("source directory not specified. Please use SOURCE tag");
|
||||
return nullptr;
|
||||
}
|
||||
handler->SetOption("SourceDirectory", source_dir);
|
||||
handler->SourceDirectory = source_dir;
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
#include "cmVersion.h"
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
@@ -109,8 +108,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
||||
static_cast<void>(fixLocale);
|
||||
|
||||
// Get source dir
|
||||
cmValue sourceDirectory = this->GetOption("SourceDirectory");
|
||||
if (!sourceDirectory) {
|
||||
if (this->SourceDirectory.empty()) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
|
||||
<< std::endl);
|
||||
@@ -123,7 +121,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
||||
}
|
||||
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||
" Updating the repository: " << *sourceDirectory
|
||||
" Updating the repository: " << this->SourceDirectory
|
||||
<< std::endl,
|
||||
this->Quiet);
|
||||
|
||||
@@ -163,7 +161,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
||||
break;
|
||||
}
|
||||
vc->SetCommandLineTool(this->UpdateCommand);
|
||||
vc->SetSourceDirectory(*sourceDirectory);
|
||||
vc->SetSourceDirectory(this->SourceDirectory);
|
||||
|
||||
// Cleanup the working tree.
|
||||
vc->Cleanup();
|
||||
@@ -301,7 +299,7 @@ bool cmCTestUpdateHandler::SelectVCS()
|
||||
this->UpdateCommand = this->CTest->GetCTestConfiguration("UpdateCommand");
|
||||
|
||||
// Detect the VCS managing the source tree.
|
||||
this->UpdateType = this->DetectVCS(this->GetOption("SourceDirectory"));
|
||||
this->UpdateType = this->DetectVCS(this->SourceDirectory);
|
||||
if (this->UpdateType == e_UNKNOWN) {
|
||||
// The source tree does not have a recognized VCS. Check the
|
||||
// configuration value or command name.
|
||||
|
||||
@@ -59,8 +59,11 @@ private:
|
||||
|
||||
// The VCS command to update the working tree.
|
||||
std::string UpdateCommand;
|
||||
std::string SourceDirectory;
|
||||
int UpdateType;
|
||||
|
||||
int DetectVCS(const std::string& dir);
|
||||
bool SelectVCS();
|
||||
|
||||
friend class cmCTestUpdateCommand;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user