mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-11 20:11:10 -05:00
Merge topic 'ctest-tests-from-file'
ca0a9def2ectest: Exit with failure when tests-from-file input is missing60433fc6e8Tests: Generalize ctest tests-from-file test cases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9317
This commit is contained in:
@@ -1846,11 +1846,15 @@ bool cmCTestTestHandler::GetListOfTests()
|
||||
}
|
||||
|
||||
if (!this->TestListFile.empty()) {
|
||||
this->TestsToRunByName = this->ReadTestListFile(this->TestListFile);
|
||||
if (!this->ReadTestListFile(this->TestListFile, this->TestsToRunByName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!this->ExcludeTestListFile.empty()) {
|
||||
this->TestsToExcludeByName =
|
||||
this->ReadTestListFile(this->ExcludeTestListFile);
|
||||
if (!this->ReadTestListFile(this->ExcludeTestListFile,
|
||||
this->TestsToExcludeByName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
@@ -2021,11 +2025,10 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> cmCTestTestHandler::ReadTestListFile(
|
||||
const std::string& testListFileName) const
|
||||
bool cmCTestTestHandler::ReadTestListFile(
|
||||
std::string const& testListFileName, std::set<std::string>& testNames) const
|
||||
{
|
||||
std::set<std::string> testNames;
|
||||
|
||||
testNames.clear();
|
||||
cmsys::ifstream ifs(testListFileName.c_str());
|
||||
if (ifs) {
|
||||
std::string line;
|
||||
@@ -2044,9 +2047,10 @@ std::set<std::string> cmCTestTestHandler::ReadTestListFile(
|
||||
"Problem reading test list file: "
|
||||
<< testListFileName
|
||||
<< " while generating list of tests to run." << std::endl);
|
||||
return false;
|
||||
}
|
||||
|
||||
return testNames;
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
|
||||
|
||||
@@ -341,8 +341,8 @@ private:
|
||||
std::string GetTestStatus(cmCTestTestResult const&);
|
||||
void ExpandTestsToRunInformation(size_t numPossibleTests);
|
||||
void ExpandTestsToRunInformationForRerunFailed();
|
||||
std::set<std::string> ReadTestListFile(
|
||||
const std::string& testListFileName) const;
|
||||
bool ReadTestListFile(std::string const& testListFileName,
|
||||
std::set<std::string>& testNames) const;
|
||||
|
||||
std::vector<std::string> CustomPreTest;
|
||||
std::vector<std::string> CustomPostTest;
|
||||
|
||||
@@ -208,7 +208,7 @@ endfunction()
|
||||
run_SkipRegexFoundTest()
|
||||
|
||||
|
||||
function(run_TestsFromFileTest arg)
|
||||
function(run_TestsFromFileTest case)
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestsFromFile)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
|
||||
@@ -219,10 +219,12 @@ add_test(Test1 \"${CMAKE_COMMAND}\" -E echo \"test1\")
|
||||
add_test(Test2 \"${CMAKE_COMMAND}\" -E echo \"test2\")
|
||||
add_test(Test11 \"${CMAKE_COMMAND}\" -E echo \"test11\")
|
||||
")
|
||||
run_cmake_command(TestsFromFile-${arg} ${CMAKE_CTEST_COMMAND} --${arg} ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt )
|
||||
run_cmake_command(TestsFromFile-${case} ${CMAKE_CTEST_COMMAND} ${ARGN})
|
||||
endfunction()
|
||||
run_TestsFromFileTest(tests-from-file)
|
||||
run_TestsFromFileTest(exclude-from-file)
|
||||
run_TestsFromFileTest(include --tests-from-file ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt)
|
||||
run_TestsFromFileTest(exclude --exclude-from-file ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt)
|
||||
run_TestsFromFileTest(include-missing --tests-from-file ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList-missing.txt)
|
||||
run_TestsFromFileTest(exclude-missing --exclude-from-file ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList-missing.txt)
|
||||
|
||||
|
||||
function(run_SerialFailed)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[^0]
|
||||
@@ -0,0 +1,2 @@
|
||||
Problem reading test list file: [^
|
||||
]*/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList-missing\.txt while generating list of tests to run\.
|
||||
@@ -0,0 +1,2 @@
|
||||
Test project [^
|
||||
]*/Tests/RunCMake/CTestCommandLine/TestsFromFile$
|
||||
@@ -0,0 +1 @@
|
||||
[^0]
|
||||
@@ -0,0 +1,2 @@
|
||||
Problem reading test list file: [^
|
||||
]*/Tests/RunCMake/CTestCommandLine/TestsFromFile-TestList-missing\.txt while generating list of tests to run\.
|
||||
@@ -0,0 +1,2 @@
|
||||
Test project [^
|
||||
]*/Tests/RunCMake/CTestCommandLine/TestsFromFile$
|
||||
@@ -165,18 +165,20 @@ run_stop_on_failure()
|
||||
|
||||
|
||||
# test include/exclude tests from file
|
||||
function(run_tests_from_file mode)
|
||||
set(CASE_CTEST_TEST_ARGS ${mode} ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt)
|
||||
function(run_tests_from_file case)
|
||||
set(CASE_CTEST_TEST_ARGS ${ARGN})
|
||||
set(CASE_CMAKELISTS_SUFFIX_CODE [[
|
||||
add_test(NAME Test1 COMMAND ${CMAKE_COMMAND} -E true)
|
||||
add_test(NAME Test2 COMMAND ${CMAKE_COMMAND} -E true)
|
||||
add_test(NAME Test11 COMMAND ${CMAKE_COMMAND} -E true)
|
||||
]])
|
||||
|
||||
run_ctest(TestsFromFile-${mode})
|
||||
run_ctest(TestsFromFile-${case})
|
||||
endfunction()
|
||||
run_tests_from_file(INCLUDE_FROM_FILE)
|
||||
run_tests_from_file(EXCLUDE_FROM_FILE)
|
||||
run_tests_from_file(include INCLUDE_FROM_FILE ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt)
|
||||
run_tests_from_file(exclude EXCLUDE_FROM_FILE ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList.txt)
|
||||
run_tests_from_file(include-missing INCLUDE_FROM_FILE ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList-missing.txt)
|
||||
run_tests_from_file(exclude-missing EXCLUDE_FROM_FILE ${RunCMake_SOURCE_DIR}/TestsFromFile-TestList-missing.txt)
|
||||
|
||||
|
||||
# Make sure environment gets logged
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
(-1|255)
|
||||
@@ -0,0 +1,2 @@
|
||||
Problem reading test list file: [^
|
||||
]*/Tests/RunCMake/ctest_test/TestsFromFile-TestList-missing\.txt while generating list of tests to run\.
|
||||
@@ -0,0 +1,2 @@
|
||||
Test project [^
|
||||
]*/Tests/RunCMake/ctest_test/TestsFromFile-exclude-missing-build$
|
||||
@@ -0,0 +1 @@
|
||||
(-1|255)
|
||||
@@ -0,0 +1,2 @@
|
||||
Problem reading test list file: [^
|
||||
]*/Tests/RunCMake/ctest_test/TestsFromFile-TestList-missing\.txt while generating list of tests to run\.
|
||||
@@ -0,0 +1,2 @@
|
||||
Test project [^
|
||||
]*/Tests/RunCMake/ctest_test/TestsFromFile-include-missing-build$
|
||||
Reference in New Issue
Block a user