CTest: Remove unneeded code
This commit is contained in:
parent
70dfb24957
commit
914a355810
@ -3,7 +3,6 @@
|
||||
#include "cmCTestGenericHandler.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
@ -21,99 +20,16 @@ cmCTestGenericHandler::cmCTestGenericHandler()
|
||||
|
||||
cmCTestGenericHandler::~cmCTestGenericHandler() = default;
|
||||
|
||||
namespace {
|
||||
/* Modify the given `map`, setting key `op` to `value` if `value`
|
||||
* is non-null, otherwise removing key `op` (if it exists).
|
||||
*/
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, const std::string& value)
|
||||
{
|
||||
map[op] = value;
|
||||
}
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, cmValue value)
|
||||
{
|
||||
if (!value) {
|
||||
map.erase(op);
|
||||
return;
|
||||
}
|
||||
|
||||
map[op] = *value;
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op, cmValue value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
cmValue value)
|
||||
{
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::AddMultiOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->MultiOptions[op].emplace_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::AddPersistentMultiOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->MultiOptions[op].emplace_back(value);
|
||||
this->PersistentMultiOptions[op].emplace_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::Initialize(cmCTest* ctest)
|
||||
{
|
||||
this->CTest = ctest;
|
||||
this->AppendXML = false;
|
||||
this->TestLoad = 0;
|
||||
this->Options = this->PersistentOptions;
|
||||
this->MultiOptions = this->PersistentMultiOptions;
|
||||
|
||||
this->SetVerbose(ctest->GetExtraVerbose());
|
||||
this->SetSubmitIndex(ctest->GetSubmitIndex());
|
||||
}
|
||||
|
||||
cmValue cmCTestGenericHandler::GetOption(const std::string& op)
|
||||
{
|
||||
auto remit = this->Options.find(op);
|
||||
if (remit == this->Options.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return cmValue(remit->second);
|
||||
}
|
||||
|
||||
std::vector<std::string> cmCTestGenericHandler::GetMultiOption(
|
||||
const std::string& optionName) const
|
||||
{
|
||||
// Avoid inserting a key, which MultiOptions[op] would do.
|
||||
auto remit = this->MultiOptions.find(optionName);
|
||||
if (remit == this->MultiOptions.end()) {
|
||||
return {};
|
||||
}
|
||||
return remit->second;
|
||||
}
|
||||
|
||||
bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
|
||||
const char* name,
|
||||
cmGeneratedFileStream& xofs)
|
||||
|
@ -6,11 +6,9 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
class cmGeneratedFileStream;
|
||||
class cmMakefile;
|
||||
@ -59,42 +57,6 @@ public:
|
||||
virtual ~cmCTestGenericHandler();
|
||||
|
||||
using t_StringToString = std::map<std::string, std::string>;
|
||||
using t_StringToMultiString =
|
||||
std::map<std::string, std::vector<std::string>>;
|
||||
|
||||
/**
|
||||
* Options collect a single value from flags; passing the
|
||||
* flag multiple times on the command-line *overwrites* values,
|
||||
* and only the last one specified counts. Set an option to
|
||||
* nullptr to "unset" it.
|
||||
*
|
||||
* The value is stored as a string. The values set for single
|
||||
* and multi-options (see below) live in different spaces,
|
||||
* so calling a single-getter for a key that has only been set
|
||||
* as a multi-value will return nullptr.
|
||||
*/
|
||||
void SetPersistentOption(const std::string& op, const std::string& value);
|
||||
void SetPersistentOption(const std::string& op, cmValue value);
|
||||
void SetOption(const std::string& op, const std::string& value);
|
||||
void SetOption(const std::string& op, cmValue value);
|
||||
cmValue GetOption(const std::string& op);
|
||||
|
||||
/**
|
||||
* Multi-Options collect one or more values from flags; passing
|
||||
* the flag multiple times on the command-line *adds* values,
|
||||
* rather than overwriting the previous values.
|
||||
*
|
||||
* Adding an empty value does nothing.
|
||||
*
|
||||
* The value is stored as a vector of strings. The values set for single
|
||||
* (see above) and multi-options live in different spaces,
|
||||
* so calling a multi-getter for a key that has only been set
|
||||
* as a single-value will return an empty vector.
|
||||
*/
|
||||
void AddPersistentMultiOption(const std::string& optionName,
|
||||
const std::string& value);
|
||||
void AddMultiOption(const std::string& optionName, const std::string& value);
|
||||
std::vector<std::string> GetMultiOption(const std::string& op) const;
|
||||
|
||||
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
|
||||
int GetSubmitIndex() { return this->SubmitIndex; }
|
||||
@ -115,10 +77,6 @@ protected:
|
||||
unsigned long TestLoad;
|
||||
cmSystemTools::OutputOption HandlerVerbose;
|
||||
cmCTest* CTest;
|
||||
t_StringToString Options;
|
||||
t_StringToString PersistentOptions;
|
||||
t_StringToMultiString MultiOptions;
|
||||
t_StringToMultiString PersistentMultiOptions;
|
||||
t_StringToString LogFileNames;
|
||||
|
||||
int SubmitIndex;
|
||||
|
@ -359,16 +359,6 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::SetCMakeVariables(cmMakefile& mf)
|
||||
{
|
||||
mf.AddDefinition("CTEST_CUSTOM_PRE_TEST",
|
||||
cmList(this->CustomPreTest).to_string());
|
||||
mf.AddDefinition("CTEST_CUSTOM_POST_TEST",
|
||||
cmList(this->CustomPostTest).to_string());
|
||||
mf.AddDefinition("CTEST_CUSTOM_TESTS_IGNORE",
|
||||
cmList(this->CustomTestsIgnore).to_string());
|
||||
}
|
||||
|
||||
int cmCTestTestHandler::PreProcessHandler()
|
||||
{
|
||||
if (!this->ExecuteCommands(this->CustomPreTest)) {
|
||||
|
@ -229,11 +229,6 @@ public:
|
||||
// Support for writing test results in JUnit XML format.
|
||||
void SetJUnitXMLFileName(const std::string& id);
|
||||
|
||||
/**
|
||||
* Set CMake variables from CTest Options
|
||||
*/
|
||||
void SetCMakeVariables(cmMakefile& mf);
|
||||
|
||||
protected:
|
||||
using SetOfTests =
|
||||
std::set<cmCTestTestHandler::cmCTestTestResult, cmCTestTestResultLess>;
|
||||
|
@ -1620,24 +1620,6 @@ bool cmCTest::AddVariableDefinition(const std::string& arg)
|
||||
return false;
|
||||
}
|
||||
|
||||
void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->GetTestHandler()->SetPersistentOption(optionName, value);
|
||||
this->GetMemCheckHandler()->SetPersistentOption(optionName, value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTest::AddPersistentMultiOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->GetTestHandler()->AddPersistentMultiOption(optionName, value);
|
||||
this->GetMemCheckHandler()->AddPersistentMultiOption(optionName, value);
|
||||
}
|
||||
}
|
||||
|
||||
bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
bool listPresets)
|
||||
{
|
||||
@ -3365,8 +3347,6 @@ void cmCTest::SetCMakeVariables(cmMakefile& mf)
|
||||
set("CTEST_TLS_VERSION", "TLSVersion");
|
||||
set("CTEST_CURL_OPTIONS", "CurlOptions");
|
||||
set("CTEST_SUBMIT_INACTIVITY_TIMEOUT", "SubmitInactivityTimeout");
|
||||
|
||||
this->GetTestHandler()->SetCMakeVariables(mf);
|
||||
}
|
||||
|
||||
bool cmCTest::RunCommand(std::vector<std::string> const& args,
|
||||
|
@ -448,11 +448,6 @@ public:
|
||||
cmCTestTestOptions const& GetTestOptions() const;
|
||||
|
||||
private:
|
||||
void SetPersistentOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName);
|
||||
void AddPersistentMultiOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName);
|
||||
|
||||
int GenerateNotesFile(const std::string& files);
|
||||
|
||||
void BlockTestErrorDiagnostics();
|
||||
|
Loading…
Reference in New Issue
Block a user