summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorAdriaan de Groot <groot@kde.org>2021-03-20 05:53:14 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-03-28 01:04:05 (GMT)
commit44ad3f0b7f7e0aaf96e5cfd672d07a70e1b76410 (patch)
treea6da9b5be6095fffcb7072ae6cf040d7c54ba2e5 /Source/cmCTest.cxx
parent61fd90b90c9dfec154aee7fb4d97574921e651d1 (diff)
downloadCMake-44ad3f0b7f7e0aaf96e5cfd672d07a70e1b76410.zip
CMake-44ad3f0b7f7e0aaf96e5cfd672d07a70e1b76410.tar.gz
CMake-44ad3f0b7f7e0aaf96e5cfd672d07a70e1b76410.tar.bz2
ctest: Support multiple -L and -LE options to mean "AND"
Fixes: #21087
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx29
1 files changed, 19 insertions, 10 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 4228d30..0dfd1bd 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2108,17 +2108,17 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
} else if (this->CheckArgument(arg, "-L"_s, "--label-regex") &&
i < args.size() - 1) {
i++;
- this->GetTestHandler()->SetPersistentOption("LabelRegularExpression",
- args[i].c_str());
- this->GetMemCheckHandler()->SetPersistentOption("LabelRegularExpression",
- args[i].c_str());
+ this->GetTestHandler()->AddPersistentMultiOption("LabelRegularExpression",
+ args[i]);
+ this->GetMemCheckHandler()->AddPersistentMultiOption(
+ "LabelRegularExpression", args[i]);
} else if (this->CheckArgument(arg, "-LE"_s, "--label-exclude") &&
i < args.size() - 1) {
i++;
- this->GetTestHandler()->SetPersistentOption(
- "ExcludeLabelRegularExpression", args[i].c_str());
- this->GetMemCheckHandler()->SetPersistentOption(
- "ExcludeLabelRegularExpression", args[i].c_str());
+ this->GetTestHandler()->AddPersistentMultiOption(
+ "ExcludeLabelRegularExpression", args[i]);
+ this->GetMemCheckHandler()->AddPersistentMultiOption(
+ "ExcludeLabelRegularExpression", args[i]);
}
else if (this->CheckArgument(arg, "-E"_s, "--exclude-regex") &&
@@ -2268,6 +2268,15 @@ void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& 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)
{
@@ -2419,7 +2428,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
if (expandedPreset->Filter->Include) {
this->SetPersistentOptionIfNotEmpty(
expandedPreset->Filter->Include->Name, "IncludeRegularExpression");
- this->SetPersistentOptionIfNotEmpty(
+ this->AddPersistentMultiOptionIfNotEmpty(
expandedPreset->Filter->Include->Label, "LabelRegularExpression");
if (expandedPreset->Filter->Include->Index) {
@@ -2452,7 +2461,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
if (expandedPreset->Filter->Exclude) {
this->SetPersistentOptionIfNotEmpty(
expandedPreset->Filter->Exclude->Name, "ExcludeRegularExpression");
- this->SetPersistentOptionIfNotEmpty(
+ this->AddPersistentMultiOptionIfNotEmpty(
expandedPreset->Filter->Exclude->Label,
"ExcludeLabelRegularExpression");