[cmake-developers] [RFC] ctest: do not output "failed" when no tests failed

Steve Dougherty sdougherty at barracuda.com
Fri Jun 20 13:01:30 EDT 2014


When I glance at ctest output, even if all tests passed, my eye catches
"failed" before noticing the other things, which gives me a start.

I'm not sure if this is an appropriate change in the face of existing
codebases which might have dependencies on the current message consistency.
Would this be appropriate as an option, or if the log output is a TTY?
---
 Source/CTest/cmCTestTestHandler.cxx    | 16 ++++++++++++----
 Tests/CTestTestMemcheck/CMakeLists.txt |  4 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index f21d166..1f7acc2 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -583,10 +583,18 @@ int cmCTestTestHandler::ProcessHandler()
       percent = 99;
       }
 
-    cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
-               << static_cast<int>(percent + .5) << "% tests passed, "
-               << failed.size() << " tests failed out of "
-               << total << std::endl);
+    if ( failed.size() )
+      {
+      cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
+                 << static_cast<int>(percent + .5) << "% tests passed, "
+                 << failed.size() << " tests failed out of "
+                 << total << std::endl);
+      }
+    else
+      {
+      cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
+                 << "All " << total << " tests passed" << std::endl);
+      }
     if(this->CTest->GetLabelSummary())
       {
       this->PrintLabelSummary();
diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt
index 8984463..8456135 100644
--- a/Tests/CTestTestMemcheck/CMakeLists.txt
+++ b/Tests/CTestTestMemcheck/CMakeLists.txt
@@ -55,7 +55,7 @@ set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*")
 string(REPLACE "\r\n" "\n" ctest_and_tool_outputs "
 1/1 MemCheck #1: RunCMake \\.+   Passed +[0-9]+\\.[0-9]+ sec
 ${guard_malloc_lines}
-100% tests passed, 0 tests failed out of 1
+All 1 tests passed
 .*
 -- Processing memory checking output:( )
 ${guard_malloc_lines}Memory checking results:
@@ -177,7 +177,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck
     PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$")
 
 set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES
-    PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+   Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n")
+    PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+   Passed +[0-9]+.[0-9]+ sec\n\nAll 1 tests passed\n(.*\n)?Error parsing XML in stream at line 1: no element found\n")
 
 set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES
     PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n")
-- 
2.0.0



More information about the cmake-developers mailing list