diff options
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.h | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 20 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 24 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.h | 2 |
7 files changed, 30 insertions, 35 deletions
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 48cc0e4..bd33055 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -72,13 +72,13 @@ void cmCTestGenericHandler::Initialize() this->MultiOptions = this->PersistentMultiOptions; } -const char* cmCTestGenericHandler::GetOption(const std::string& op) +cmProp cmCTestGenericHandler::GetOption(const std::string& op) { auto remit = this->Options.find(op); if (remit == this->Options.end()) { return nullptr; } - return remit->second.c_str(); + return cmProp(remit->second); } std::vector<std::string> cmCTestGenericHandler::GetMultiOption( diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index e846fd9..0b8b224 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -11,6 +11,7 @@ #include <stddef.h> #include "cmCTest.h" +#include "cmProperty.h" #include "cmSystemTools.h" class cmGeneratedFileStream; @@ -87,7 +88,7 @@ public: */ void SetPersistentOption(const std::string& op, const char* value); void SetOption(const std::string& op, const char* value); - const char* GetOption(const std::string& op); + cmProp GetOption(const std::string& op); /** * Multi-Options collect one or more values from flags; passing diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index bf938e4..9322bd5 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -357,12 +357,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( // If curl failed for any reason, or checksum fails, wait and retry // if (res != CURLE_OK || this->HasErrors) { - std::string retryDelay = this->GetOption("RetryDelay") == nullptr - ? "" - : this->GetOption("RetryDelay"); - std::string retryCount = this->GetOption("RetryCount") == nullptr - ? "" - : this->GetOption("RetryCount"); + std::string retryDelay = *this->GetOption("RetryDelay"); + std::string retryCount = *this->GetOption("RetryCount"); auto delay = cmDuration( retryDelay.empty() @@ -522,12 +518,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, bool internalTest = cmIsOn(this->GetOption("InternalTest")); // Get RETRY_COUNT and RETRY_DELAY values if they were set. - std::string retryDelayString = this->GetOption("RetryDelay") == nullptr - ? "" - : this->GetOption("RetryDelay"); - std::string retryCountString = this->GetOption("RetryCount") == nullptr - ? "" - : this->GetOption("RetryCount"); + std::string retryDelayString = *this->GetOption("RetryDelay"); + std::string retryCountString = *this->GetOption("RetryCount"); auto retryDelay = std::chrono::seconds(0); if (!retryDelayString.empty()) { unsigned long retryDelayValue = 0; @@ -716,8 +708,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, int cmCTestSubmitHandler::ProcessHandler() { - const char* cdashUploadFile = this->GetOption("CDashUploadFile"); - const char* cdashUploadType = this->GetOption("CDashUploadType"); + cmProp cdashUploadFile = this->GetOption("CDashUploadFile"); + cmProp cdashUploadType = this->GetOption("CDashUploadType"); if (cdashUploadFile && cdashUploadType) { return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 00c1443..c41b661 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -521,7 +521,7 @@ bool cmCTestTestHandler::ProcessOptions() if (cmIsOn(this->GetOption("ScheduleRandom"))) { this->CTest->SetScheduleType("Random"); } - if (const char* repeat = this->GetOption("Repeat")) { + if (cmProp repeat = this->GetOption("Repeat")) { cmsys::RegularExpression repeatRegex( "^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$"); if (repeatRegex.find(repeat)) { @@ -546,7 +546,7 @@ bool cmCTestTestHandler::ProcessOptions() } } if (this->GetOption("ParallelLevel")) { - this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel"))); + this->CTest->SetParallelLevel(std::stoi(this->GetOption("ParallelLevel"))); } if (this->GetOption("StopOnFailure")) { @@ -557,7 +557,7 @@ bool cmCTestTestHandler::ProcessOptions() this->IncludeLabelRegularExpressions); BuildLabelRE(this->GetMultiOption("ExcludeLabelRegularExpression"), this->ExcludeLabelRegularExpressions); - const char* val = this->GetOption("IncludeRegularExpression"); + cmProp val = this->GetOption("IncludeRegularExpression"); if (val) { this->UseIncludeRegExp(); this->SetIncludeRegExp(val); @@ -569,19 +569,19 @@ bool cmCTestTestHandler::ProcessOptions() } val = this->GetOption("ExcludeFixtureRegularExpression"); if (val) { - this->ExcludeFixtureRegExp = val; + this->ExcludeFixtureRegExp = *val; } val = this->GetOption("ExcludeFixtureSetupRegularExpression"); if (val) { - this->ExcludeFixtureSetupRegExp = val; + this->ExcludeFixtureSetupRegExp = *val; } val = this->GetOption("ExcludeFixtureCleanupRegularExpression"); if (val) { - this->ExcludeFixtureCleanupRegExp = val; + this->ExcludeFixtureCleanupRegExp = *val; } val = this->GetOption("ResourceSpecFile"); if (val) { - this->ResourceSpecFile = val; + this->ResourceSpecFile = *val; } this->SetRerunFailed(cmIsOn(this->GetOption("RerunFailed"))); @@ -2081,26 +2081,26 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml, } } -void cmCTestTestHandler::SetIncludeRegExp(const char* arg) +void cmCTestTestHandler::SetIncludeRegExp(const std::string& arg) { this->IncludeRegExp = arg; } -void cmCTestTestHandler::SetExcludeRegExp(const char* arg) +void cmCTestTestHandler::SetExcludeRegExp(const std::string& arg) { this->ExcludeRegExp = arg; } -void cmCTestTestHandler::SetTestsToRunInformation(const char* in) +void cmCTestTestHandler::SetTestsToRunInformation(cmProp in) { if (!in) { return; } - this->TestsToRunString = in; + this->TestsToRunString = *in; // if the argument is a file, then read it and use the contents as the // string if (cmSystemTools::FileExists(in)) { - cmsys::ifstream fin(in); + cmsys::ifstream fin(in->c_str()); unsigned long filelen = cmSystemTools::FileLength(in); auto buff = cm::make_unique<char[]>(filelen + 1); fin.getline(buff.get(), filelen); diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index f2da320..585a336 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -22,6 +22,7 @@ #include "cmCTestResourceSpec.h" #include "cmDuration.h" #include "cmListFileCache.h" +#include "cmProperty.h" class cmMakefile; class cmXMLWriter; @@ -65,8 +66,8 @@ public: /// them on void UseIncludeRegExp(); void UseExcludeRegExp(); - void SetIncludeRegExp(const char*); - void SetExcludeRegExp(const char*); + void SetIncludeRegExp(const std::string&); + void SetExcludeRegExp(const std::string&); void SetMaxIndex(int n) { this->MaxIndex = n; } int GetMaxIndex() { return this->MaxIndex; } @@ -81,7 +82,7 @@ public: } //! pass the -I argument down - void SetTestsToRunInformation(const char*); + void SetTestsToRunInformation(cmProp); cmCTestTestHandler(); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 57cc024..7c7c380 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -17,6 +17,7 @@ #include "cmCTestSVN.h" #include "cmCTestVC.h" #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmVersion.h" @@ -108,7 +109,7 @@ int cmCTestUpdateHandler::ProcessHandler() static_cast<void>(fixLocale); // Get source dir - const char* sourceDirectory = this->GetOption("SourceDirectory"); + cmProp sourceDirectory = this->GetOption("SourceDirectory"); if (!sourceDirectory) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find SourceDirectory key in the DartConfiguration.tcl" @@ -257,7 +258,7 @@ int cmCTestUpdateHandler::ProcessHandler() return updated && loadedMods ? numUpdated : -1; } -int cmCTestUpdateHandler::DetectVCS(const char* dir) +int cmCTestUpdateHandler::DetectVCS(const std::string& dir) { std::string sourceDirectory = dir; cmCTestOptionalLog(this->CTest, DEBUG, diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 25bbb2f..70269ea 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -59,6 +59,6 @@ private: std::string UpdateCommand; int UpdateType; - int DetectVCS(const char* dir); + int DetectVCS(const std::string& dir); bool SelectVCS(); }; |