diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 602a82db61..aa95ac6415 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 63ff8d16b1..dae205c084 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2037,12 +2037,9 @@ cm::optional> cmCTestTestHandler::ReadTestListFile( std::set 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 91f65043d1..975a21c777 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 91f65043d1..975a21c777 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