mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
cmCTestGenericHandler::GetOption returns cmProp
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -59,6 +59,6 @@ private:
|
||||
std::string UpdateCommand;
|
||||
int UpdateType;
|
||||
|
||||
int DetectVCS(const char* dir);
|
||||
int DetectVCS(const std::string& dir);
|
||||
bool SelectVCS();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user