summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-03 12:47:49 (GMT)
committerBrad King <brad.king@kitware.com>2015-06-03 12:47:49 (GMT)
commit721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84 (patch)
tree7fd3da24e72f4951b586e6515e9ae0e92155a9ca /Tests
parentd3bb5da9294ddbfcc5fddf7ba3dafd2c3e0b32b2 (diff)
downloadCMake-721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84.zip
CMake-721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84.tar.gz
CMake-721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84.tar.bz2
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.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt13
-rw-r--r--Tests/RunCMake/CTestCommandLine/MergeOutput.cmake4
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake13
3 files changed, 30 insertions, 0 deletions
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()