diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 62d60d05db..d72c8ec16b 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -3,7 +3,6 @@ #include "cmCTestGenericHandler.h" #include -#include #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 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) diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 6c464ddc0c..d5d2b41c05 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -6,11 +6,9 @@ #include #include -#include #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; - using t_StringToMultiString = - std::map>; - - /** - * 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 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; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b255d2cf84..84fde4361e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -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)) { diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index b5c35d5a5b..a8c07cd645 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -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; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e7ca5d184e..2a409d5172 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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 const& args, diff --git a/Source/cmCTest.h b/Source/cmCTest.h index f0649d2073..2c0575b467 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -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();