mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 10:39:28 -05:00
cmCTestGenericHandler::GetOption returns cmProp
This commit is contained in:
@@ -72,13 +72,13 @@ void cmCTestGenericHandler::Initialize()
|
|||||||
this->MultiOptions = this->PersistentMultiOptions;
|
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);
|
auto remit = this->Options.find(op);
|
||||||
if (remit == this->Options.end()) {
|
if (remit == this->Options.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return remit->second.c_str();
|
return cmProp(remit->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> cmCTestGenericHandler::GetMultiOption(
|
std::vector<std::string> cmCTestGenericHandler::GetMultiOption(
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "cmCTest.h"
|
#include "cmCTest.h"
|
||||||
|
#include "cmProperty.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
class cmGeneratedFileStream;
|
class cmGeneratedFileStream;
|
||||||
@@ -87,7 +88,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetPersistentOption(const std::string& op, const char* value);
|
void SetPersistentOption(const std::string& op, const char* value);
|
||||||
void SetOption(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
|
* 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 curl failed for any reason, or checksum fails, wait and retry
|
||||||
//
|
//
|
||||||
if (res != CURLE_OK || this->HasErrors) {
|
if (res != CURLE_OK || this->HasErrors) {
|
||||||
std::string retryDelay = this->GetOption("RetryDelay") == nullptr
|
std::string retryDelay = *this->GetOption("RetryDelay");
|
||||||
? ""
|
std::string retryCount = *this->GetOption("RetryCount");
|
||||||
: this->GetOption("RetryDelay");
|
|
||||||
std::string retryCount = this->GetOption("RetryCount") == nullptr
|
|
||||||
? ""
|
|
||||||
: this->GetOption("RetryCount");
|
|
||||||
|
|
||||||
auto delay = cmDuration(
|
auto delay = cmDuration(
|
||||||
retryDelay.empty()
|
retryDelay.empty()
|
||||||
@@ -522,12 +518,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
|||||||
bool internalTest = cmIsOn(this->GetOption("InternalTest"));
|
bool internalTest = cmIsOn(this->GetOption("InternalTest"));
|
||||||
|
|
||||||
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
|
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
|
||||||
std::string retryDelayString = this->GetOption("RetryDelay") == nullptr
|
std::string retryDelayString = *this->GetOption("RetryDelay");
|
||||||
? ""
|
std::string retryCountString = *this->GetOption("RetryCount");
|
||||||
: this->GetOption("RetryDelay");
|
|
||||||
std::string retryCountString = this->GetOption("RetryCount") == nullptr
|
|
||||||
? ""
|
|
||||||
: this->GetOption("RetryCount");
|
|
||||||
auto retryDelay = std::chrono::seconds(0);
|
auto retryDelay = std::chrono::seconds(0);
|
||||||
if (!retryDelayString.empty()) {
|
if (!retryDelayString.empty()) {
|
||||||
unsigned long retryDelayValue = 0;
|
unsigned long retryDelayValue = 0;
|
||||||
@@ -716,8 +708,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
|||||||
|
|
||||||
int cmCTestSubmitHandler::ProcessHandler()
|
int cmCTestSubmitHandler::ProcessHandler()
|
||||||
{
|
{
|
||||||
const char* cdashUploadFile = this->GetOption("CDashUploadFile");
|
cmProp cdashUploadFile = this->GetOption("CDashUploadFile");
|
||||||
const char* cdashUploadType = this->GetOption("CDashUploadType");
|
cmProp cdashUploadType = this->GetOption("CDashUploadType");
|
||||||
if (cdashUploadFile && cdashUploadType) {
|
if (cdashUploadFile && cdashUploadType) {
|
||||||
return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType);
|
return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ bool cmCTestTestHandler::ProcessOptions()
|
|||||||
if (cmIsOn(this->GetOption("ScheduleRandom"))) {
|
if (cmIsOn(this->GetOption("ScheduleRandom"))) {
|
||||||
this->CTest->SetScheduleType("Random");
|
this->CTest->SetScheduleType("Random");
|
||||||
}
|
}
|
||||||
if (const char* repeat = this->GetOption("Repeat")) {
|
if (cmProp repeat = this->GetOption("Repeat")) {
|
||||||
cmsys::RegularExpression repeatRegex(
|
cmsys::RegularExpression repeatRegex(
|
||||||
"^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$");
|
"^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$");
|
||||||
if (repeatRegex.find(repeat)) {
|
if (repeatRegex.find(repeat)) {
|
||||||
@@ -546,7 +546,7 @@ bool cmCTestTestHandler::ProcessOptions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->GetOption("ParallelLevel")) {
|
if (this->GetOption("ParallelLevel")) {
|
||||||
this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
|
this->CTest->SetParallelLevel(std::stoi(this->GetOption("ParallelLevel")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->GetOption("StopOnFailure")) {
|
if (this->GetOption("StopOnFailure")) {
|
||||||
@@ -557,7 +557,7 @@ bool cmCTestTestHandler::ProcessOptions()
|
|||||||
this->IncludeLabelRegularExpressions);
|
this->IncludeLabelRegularExpressions);
|
||||||
BuildLabelRE(this->GetMultiOption("ExcludeLabelRegularExpression"),
|
BuildLabelRE(this->GetMultiOption("ExcludeLabelRegularExpression"),
|
||||||
this->ExcludeLabelRegularExpressions);
|
this->ExcludeLabelRegularExpressions);
|
||||||
const char* val = this->GetOption("IncludeRegularExpression");
|
cmProp val = this->GetOption("IncludeRegularExpression");
|
||||||
if (val) {
|
if (val) {
|
||||||
this->UseIncludeRegExp();
|
this->UseIncludeRegExp();
|
||||||
this->SetIncludeRegExp(val);
|
this->SetIncludeRegExp(val);
|
||||||
@@ -569,19 +569,19 @@ bool cmCTestTestHandler::ProcessOptions()
|
|||||||
}
|
}
|
||||||
val = this->GetOption("ExcludeFixtureRegularExpression");
|
val = this->GetOption("ExcludeFixtureRegularExpression");
|
||||||
if (val) {
|
if (val) {
|
||||||
this->ExcludeFixtureRegExp = val;
|
this->ExcludeFixtureRegExp = *val;
|
||||||
}
|
}
|
||||||
val = this->GetOption("ExcludeFixtureSetupRegularExpression");
|
val = this->GetOption("ExcludeFixtureSetupRegularExpression");
|
||||||
if (val) {
|
if (val) {
|
||||||
this->ExcludeFixtureSetupRegExp = val;
|
this->ExcludeFixtureSetupRegExp = *val;
|
||||||
}
|
}
|
||||||
val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
|
val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
|
||||||
if (val) {
|
if (val) {
|
||||||
this->ExcludeFixtureCleanupRegExp = val;
|
this->ExcludeFixtureCleanupRegExp = *val;
|
||||||
}
|
}
|
||||||
val = this->GetOption("ResourceSpecFile");
|
val = this->GetOption("ResourceSpecFile");
|
||||||
if (val) {
|
if (val) {
|
||||||
this->ResourceSpecFile = val;
|
this->ResourceSpecFile = *val;
|
||||||
}
|
}
|
||||||
this->SetRerunFailed(cmIsOn(this->GetOption("RerunFailed")));
|
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;
|
this->IncludeRegExp = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCTestTestHandler::SetExcludeRegExp(const char* arg)
|
void cmCTestTestHandler::SetExcludeRegExp(const std::string& arg)
|
||||||
{
|
{
|
||||||
this->ExcludeRegExp = arg;
|
this->ExcludeRegExp = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
|
void cmCTestTestHandler::SetTestsToRunInformation(cmProp in)
|
||||||
{
|
{
|
||||||
if (!in) {
|
if (!in) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->TestsToRunString = in;
|
this->TestsToRunString = *in;
|
||||||
// if the argument is a file, then read it and use the contents as the
|
// if the argument is a file, then read it and use the contents as the
|
||||||
// string
|
// string
|
||||||
if (cmSystemTools::FileExists(in)) {
|
if (cmSystemTools::FileExists(in)) {
|
||||||
cmsys::ifstream fin(in);
|
cmsys::ifstream fin(in->c_str());
|
||||||
unsigned long filelen = cmSystemTools::FileLength(in);
|
unsigned long filelen = cmSystemTools::FileLength(in);
|
||||||
auto buff = cm::make_unique<char[]>(filelen + 1);
|
auto buff = cm::make_unique<char[]>(filelen + 1);
|
||||||
fin.getline(buff.get(), filelen);
|
fin.getline(buff.get(), filelen);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "cmCTestResourceSpec.h"
|
#include "cmCTestResourceSpec.h"
|
||||||
#include "cmDuration.h"
|
#include "cmDuration.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
|
#include "cmProperty.h"
|
||||||
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmXMLWriter;
|
class cmXMLWriter;
|
||||||
@@ -65,8 +66,8 @@ public:
|
|||||||
/// them on
|
/// them on
|
||||||
void UseIncludeRegExp();
|
void UseIncludeRegExp();
|
||||||
void UseExcludeRegExp();
|
void UseExcludeRegExp();
|
||||||
void SetIncludeRegExp(const char*);
|
void SetIncludeRegExp(const std::string&);
|
||||||
void SetExcludeRegExp(const char*);
|
void SetExcludeRegExp(const std::string&);
|
||||||
|
|
||||||
void SetMaxIndex(int n) { this->MaxIndex = n; }
|
void SetMaxIndex(int n) { this->MaxIndex = n; }
|
||||||
int GetMaxIndex() { return this->MaxIndex; }
|
int GetMaxIndex() { return this->MaxIndex; }
|
||||||
@@ -81,7 +82,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! pass the -I argument down
|
//! pass the -I argument down
|
||||||
void SetTestsToRunInformation(const char*);
|
void SetTestsToRunInformation(cmProp);
|
||||||
|
|
||||||
cmCTestTestHandler();
|
cmCTestTestHandler();
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "cmCTestSVN.h"
|
#include "cmCTestSVN.h"
|
||||||
#include "cmCTestVC.h"
|
#include "cmCTestVC.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmProperty.h"
|
||||||
#include "cmStringAlgorithms.h"
|
#include "cmStringAlgorithms.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmVersion.h"
|
#include "cmVersion.h"
|
||||||
@@ -108,7 +109,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
|||||||
static_cast<void>(fixLocale);
|
static_cast<void>(fixLocale);
|
||||||
|
|
||||||
// Get source dir
|
// Get source dir
|
||||||
const char* sourceDirectory = this->GetOption("SourceDirectory");
|
cmProp sourceDirectory = this->GetOption("SourceDirectory");
|
||||||
if (!sourceDirectory) {
|
if (!sourceDirectory) {
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
|
"Cannot find SourceDirectory key in the DartConfiguration.tcl"
|
||||||
@@ -257,7 +258,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
|||||||
return updated && loadedMods ? numUpdated : -1;
|
return updated && loadedMods ? numUpdated : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmCTestUpdateHandler::DetectVCS(const char* dir)
|
int cmCTestUpdateHandler::DetectVCS(const std::string& dir)
|
||||||
{
|
{
|
||||||
std::string sourceDirectory = dir;
|
std::string sourceDirectory = dir;
|
||||||
cmCTestOptionalLog(this->CTest, DEBUG,
|
cmCTestOptionalLog(this->CTest, DEBUG,
|
||||||
|
|||||||
@@ -59,6 +59,6 @@ private:
|
|||||||
std::string UpdateCommand;
|
std::string UpdateCommand;
|
||||||
int UpdateType;
|
int UpdateType;
|
||||||
|
|
||||||
int DetectVCS(const char* dir);
|
int DetectVCS(const std::string& dir);
|
||||||
bool SelectVCS();
|
bool SelectVCS();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user