[Cmake-commits] [cmake-commits] hoffman committed cmCTest.h 1.110 1.111 cmCTest.cxx 1.350 1.351 ctest.cxx 1.103 1.104

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Jan 18 13:03:35 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv4441/Source

Modified Files:
	cmCTest.h cmCTest.cxx ctest.cxx 
Log Message:
BUG: add output on failure to ctest #8255


Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -C 2 -d -r1.110 -r1.111
*** cmCTest.h	12 Jan 2009 15:37:55 -0000	1.110
--- cmCTest.h	18 Jan 2009 18:03:31 -0000	1.111
***************
*** 468,471 ****
--- 468,474 ----
      const char* varg2 = 0);
  
+   //! Output errors from a test
+   void OutputTestErrors(std::vector<char> const &process_output);
+ 
    bool                      SuppressUpdatingCTestConfiguration;
  
***************
*** 483,486 ****
--- 486,491 ----
    cmGeneratedFileStream* OutputLogFile;
    int OutputLogFileLastTag;
+ 
+   bool OutputTestOutputOnTestFailure;
  };
  

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.350
retrieving revision 1.351
diff -C 2 -d -r1.350 -r1.351
*** cmCTest.cxx	12 Jan 2009 16:10:04 -0000	1.350
--- cmCTest.cxx	18 Jan 2009 18:03:32 -0000	1.351
***************
*** 259,262 ****
--- 259,267 ----
    this->SuppressUpdatingCTestConfiguration = false;
    this->DartVersion            = 1;
+   this->OutputTestOutputOnTestFailure = false;
+   if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE"))
+     {
+     this->OutputTestOutputOnTestFailure = true;
+     }
    this->InitStreams();
  
***************
*** 1234,1240 ****
--- 1239,1253 ----
      {
      *retVal = cmsysProcess_GetExitValue(cp);
+     if(*retVal != 0 && this->OutputTestOutputOnTestFailure)
+       {
+         OutputTestErrors(tempOutput);
+       }
      }
    else if(result == cmsysProcess_State_Exception)
      {
+     if(this->OutputTestOutputOnTestFailure)
+       {
+         OutputTestErrors(tempOutput);
+       }
      *retVal = cmsysProcess_GetExitException(cp);
      std::string outerr = "\n*** Exception executing: ";
***************
*** 1768,1771 ****
--- 1781,1788 ----
      this->Verbose = true;
      }
+   if(this->CheckArgument(arg, "--output-on-failure"))
+     {
+     this->OutputTestOutputOnTestFailure = true;
+     }
    
    if(this->CheckArgument(arg, "-N", "--show-only"))
***************
*** 2747,2748 ****
--- 2764,2774 ----
    return ch->GetRemainingTimeAllowed();
  }
+ 
+ //----------------------------------------------------------------------
+ void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
+ {
+   std::string test_outputs("\n*** Test Failed:\n");
+   test_outputs.append(&*process_output.begin(), process_output.size());
+   cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
+ }
+ 

Index: ctest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/ctest.cxx,v
retrieving revision 1.103
retrieving revision 1.104
diff -C 2 -d -r1.103 -r1.104
*** ctest.cxx	22 Sep 2008 18:04:12 -0000	1.103
--- ctest.cxx	18 Jan 2009 18:03:32 -0000	1.104
***************
*** 66,69 ****
--- 66,72 ----
      "This feature will result in large number of output that is mostly "
      "useful for debugging dashboard problems."},
+   {"--output-on-failure", "Output anything outputted by the test program "
+    "if the test should fail.  This option can also be enabled by setting "
+    "the environment variable CTEST_OUTPUT_ON_FAILURE"},
    {"-Q,--quiet", "Make ctest quiet.",
      "This option will suppress all the output. The output log file will "



More information about the Cmake-commits mailing list