summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorStefan Dinkelacker <s.dinkelacker@dkfz-heidelberg.de>2020-01-31 17:09:35 (GMT)
committerStefan Dinkelacker <s.dinkelacker@dkfz-heidelberg.de>2020-01-31 17:17:13 (GMT)
commita39d4139d07eee841016ddccde0e7c35d40c894c (patch)
tree16ecd9c12b45d49e37a04d1e215567ecdb5a01e8 /Source/CTest
parent08774385995777e2e2f9a72055e782b2b6d96cfa (diff)
downloadCMake-a39d4139d07eee841016ddccde0e7c35d40c894c.zip
CMake-a39d4139d07eee841016ddccde0e7c35d40c894c.tar.gz
CMake-a39d4139d07eee841016ddccde0e7c35d40c894c.tar.bz2
Add --no-tests=<[error|ignore]> option to CTest
If no tests were found, the default behavior of CTest is to always log an error message but to return an error code in script mode only. This option unifies the behavior of CTest by either returning an error code if no tests were found or by ignoring it. Signed-off-by: Stefan Dinkelacker <s.dinkelacker@dkfz-heidelberg.de>
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e70bc5a..78c68be 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -410,10 +410,15 @@ int cmCTestTestHandler::ProcessHandler()
auto clock_finish = std::chrono::steady_clock::now();
+ bool noTestsFoundError = false;
if (passed.size() + failed.size() == 0) {
- if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) {
+ if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() &&
+ this->CTest->GetNoTestsMode() != cmCTest::NoTests::Ignore) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"No tests were found!!!" << std::endl);
+ if (this->CTest->GetNoTestsMode() == cmCTest::NoTests::Error) {
+ noTestsFoundError = true;
+ }
}
} else {
if (this->HandlerVerbose && !passed.empty() &&
@@ -459,6 +464,12 @@ int cmCTestTestHandler::ProcessHandler()
this->LogFile = nullptr;
return -1;
}
+
+ if (noTestsFoundError) {
+ this->LogFile = nullptr;
+ return -1;
+ }
+
this->LogFile = nullptr;
return 0;
}