summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-08 21:07:36 (GMT)
committerBrad King <brad.king@kitware.com>2024-03-08 21:25:33 (GMT)
commit1a4837641e8fad5d8a0c611ca1c70543c5748fe2 (patch)
tree7155dfda7d5000b14d5f9992a6d773103c371542
parentd52c66bfb3ec6bbf79fab9ef6ff4cdc9ba27a45b (diff)
downloadCMake-1a4837641e8fad5d8a0c611ca1c70543c5748fe2.zip
CMake-1a4837641e8fad5d8a0c611ca1c70543c5748fe2.tar.gz
CMake-1a4837641e8fad5d8a0c611ca1c70543c5748fe2.tar.bz2
ctest: Remove unnecessary and ambiguous tests-from-file comment syntax
Test names can contain `#`. Since we ignore lines that do not match any test names anyway, "commenting" can still work without explicit syntax. Also drop whitespace trimming for similar reasons. Fixes: #25741
-rw-r--r--Help/manual/ctest.1.rst4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx7
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList.txt3
-rw-r--r--Tests/RunCMake/ctest_test/TestsFromFile-TestList.txt3
4 files changed, 10 insertions, 7 deletions
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 602a82d..aa95ac6 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -242,7 +242,7 @@ Run Tests
This option tells CTest to run the tests which are listed in the given
file. The file must contain one exact test name per line.
- Lines can be commented out using a ``#``.
+ Lines that do not exactly match any test names are ignored.
This option can be combined with the other options like
``-R``, ``-E``, ``-L`` or ``-LE``.
@@ -254,7 +254,7 @@ Run Tests
This option tells CTest to NOT run the tests which are listed in the given
file. The file must contain one exact test name per line.
- Lines can be commented out using a ``#``.
+ Lines that do not exactly match any test names are ignored.
This option can be combined with the other options like
``-R``, ``-E``, ``-L`` or ``-LE``.
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 63ff8d1..dae205c 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2037,12 +2037,9 @@ cm::optional<std::set<std::string>> cmCTestTestHandler::ReadTestListFile(
std::set<std::string> testNames;
std::string line;
while (cmSystemTools::GetLineFromStream(ifs, line)) {
- std::string trimmed = cmTrimWhitespace(line);
- if (trimmed.empty() || (trimmed[0] == '#')) {
- continue;
+ if (!line.empty()) {
+ testNames.insert(line);
}
-
- testNames.insert(trimmed);
}
result = std::move(testNames);
} else {
diff --git a/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList.txt b/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList.txt
index 91f6504..975a21c 100644
--- a/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList.txt
+++ b/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList.txt
@@ -1,2 +1,5 @@
Test1
+
+est
+ Test11
# Test11
diff --git a/Tests/RunCMake/ctest_test/TestsFromFile-TestList.txt b/Tests/RunCMake/ctest_test/TestsFromFile-TestList.txt
index 91f6504..975a21c 100644
--- a/Tests/RunCMake/ctest_test/TestsFromFile-TestList.txt
+++ b/Tests/RunCMake/ctest_test/TestsFromFile-TestList.txt
@@ -1,2 +1,5 @@
Test1
+
+est
+ Test11
# Test11