[Cmake-commits] CMake branch, next, updated. v3.2.3-1425-g9e7ae5f

Brad King brad.king at kitware.com
Wed Jun 3 08:54:06 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  9e7ae5f1be633f3241f635df0a9dcc3465c21348 (commit)
       via  721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84 (commit)
      from  a2556feeb11dc3b758898bdc8ccd44a063401f7d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e7ae5f1be633f3241f635df0a9dcc3465c21348
commit 9e7ae5f1be633f3241f635df0a9dcc3465c21348
Merge: a2556fe 721b7e3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 3 08:54:05 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jun 3 08:54:05 2015 -0400

    Merge topic 'ctest-merge-test-output' into next
    
    721b7e3e CTest: Capture test stdout/stderr through one pipe (#15600)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84
commit 721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 3 08:47:49 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 3 08:47:49 2015 -0400

    CTest: Capture test stdout/stderr through one pipe (#15600)
    
    Use the KWSys Process "MergeOutput" option to give each test child
    process the same pipe for both stdout and stderr.  This allows natural
    merging of stdout and stderr together instead of merging on arbitrary
    buffered read boundaries as before.

diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index d9e4bd4..d108592 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -57,8 +57,7 @@ bool cmCTestRunTest::CheckOutput()
       // Process has terminated and all output read.
       return false;
       }
-    else if(p == cmsysProcess_Pipe_STDOUT ||
-            p == cmsysProcess_Pipe_STDERR)
+    else if(p == cmsysProcess_Pipe_STDOUT)
       {
       // Store this line of output.
       cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index e1bd02b..0c25f40 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -62,6 +62,7 @@ bool cmProcess::StartProcess()
                                      this->WorkingDirectory.c_str());
     }
   cmsysProcess_SetTimeout(this->Process, this->Timeout);
+  cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1);
   cmsysProcess_Execute(this->Process);
   return (cmsysProcess_GetState(this->Process)
           == cmsysProcess_State_Executing);
@@ -124,14 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
   for(;;)
     {
     // Look for lines already buffered.
-    if(this->StdOut.GetLine(line))
+    if(this->Output.GetLine(line))
       {
       return cmsysProcess_Pipe_STDOUT;
       }
-    else if(this->StdErr.GetLine(line))
-      {
-      return cmsysProcess_Pipe_STDERR;
-      }
 
     // Check for more data from the process.
     char* data;
@@ -143,11 +140,7 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
       }
     else if(p == cmsysProcess_Pipe_STDOUT)
       {
-      this->StdOut.insert(this->StdOut.end(), data, data+length);
-      }
-    else if(p == cmsysProcess_Pipe_STDERR)
-      {
-      this->StdErr.insert(this->StdErr.end(), data, data+length);
+      this->Output.insert(this->Output.end(), data, data+length);
       }
     else // p == cmsysProcess_Pipe_None
       {
@@ -157,14 +150,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
     }
 
   // Look for partial last lines.
-  if(this->StdOut.GetLast(line))
+  if(this->Output.GetLast(line))
     {
     return cmsysProcess_Pipe_STDOUT;
     }
-  else if(this->StdErr.GetLast(line))
-    {
-    return cmsysProcess_Pipe_STDERR;
-    }
 
   // No more data.  Wait for process exit.
   if(!cmsysProcess_WaitForExit(this->Process, &timeout))
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index 1479df0..eddeeab 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -48,8 +48,7 @@ public:
    * Read one line of output but block for no more than timeout.
    * Returns:
    *   cmsysProcess_Pipe_None    = Process terminated and all output read
-   *   cmsysProcess_Pipe_STDOUT  = Line came from stdout
-   *   cmsysProcess_Pipe_STDOUT  = Line came from stderr
+   *   cmsysProcess_Pipe_STDOUT  = Line came from stdout or stderr
    *   cmsysProcess_Pipe_Timeout = Timeout expired while waiting
    */
   int GetNextOutputLine(std::string& line, double timeout);
@@ -68,13 +67,11 @@ private:
     bool GetLine(std::string& line);
     bool GetLast(std::string& line);
   };
-  Buffer StdErr;
-  Buffer StdOut;
+  Buffer Output;
   std::string Command;
   std::string WorkingDirectory;
   std::vector<std::string> Arguments;
   std::vector<const char*> ProcessArgs;
-  std::string Output;
   int Id;
   int ExitValue;
 };
diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt
new file mode 100644
index 0000000..af7cdc5
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt
@@ -0,0 +1,13 @@
+Test timeout computed to be: [^
+]+
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1/1 Test #1: MergeOutput
diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake
new file mode 100644
index 0000000..528ac90
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake
@@ -0,0 +1,4 @@
+foreach(i RANGE 1 5)
+  message(STATUS "Output on stdout")
+  message("Output on stderr")
+endforeach()
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 0cb11ac..a3ce139 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -39,3 +39,16 @@ subdirs()
   run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND})
 endfunction()
 run_BadCTestTestfile()
+
+function(run_MergeOutput)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+  file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutput.cmake\")
+")
+
+  run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V)
+endfunction()
+run_MergeOutput()

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestRunTest.cxx                     |    3 +--
 Source/CTest/cmProcess.cxx                          |   19 ++++---------------
 Source/CTest/cmProcess.h                            |    7 ++-----
 .../CTestCommandLine/MergeOutput-stdout.txt         |   13 +++++++++++++
 .../MergeOutput.cmake                               |    0
 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake  |   13 +++++++++++++
 6 files changed, 33 insertions(+), 22 deletions(-)
 create mode 100644 Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt
 copy Tests/RunCMake/{execute_process => CTestCommandLine}/MergeOutput.cmake (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list