[Cmake-commits] CMake branch, master, updated. v3.13.0-rc3-476-g95a7351

Kitware Robot kwrobot at kitware.com
Mon Nov 19 09:53:05 EST 2018


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, master has been updated
       via  95a735116f51285f78acb04d1bdc7863122fd94a (commit)
       via  86e8315482fd8f0bba85af6f4f8363ead6a0818d (commit)
       via  bdec3bd896b6faabab1c7cae79d8e75e8d0f0e41 (commit)
      from  61e3ceda21800949f1a4411f27efefcda789bd4d (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95a735116f51285f78acb04d1bdc7863122fd94a
commit 95a735116f51285f78acb04d1bdc7863122fd94a
Merge: 61e3ced 86e8315
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 19 14:51:57 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Nov 19 09:52:07 2018 -0500

    Merge topic 'ctest-stdin'
    
    86e8315482 CTest: Restore inheritance of stdin by test processes
    bdec3bd896 Tests: Teach RunCMake infrastructure to optionally provide stdin
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2618


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86e8315482fd8f0bba85af6f4f8363ead6a0818d
commit 86e8315482fd8f0bba85af6f4f8363ead6a0818d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 15 08:03:57 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 15 08:08:56 2018 -0500

    CTest: Restore inheritance of stdin by test processes
    
    Since commit v3.11.0-rc1~117^2 (CTest: Re-implement test process
    handling using libuv, 2017-12-10) we do not give the child test
    processes any stdin.  Prior to that change we let the child test
    processes inherit stdin from ctest itself.  Tests that run serially
    might be able to use the real stdin meaningfully, so restore that
    behavior and add a test case.
    
    Fixes: #18591

diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 39cea87..c4cf046 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -127,7 +127,8 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
   uv_pipe_open(pipe_writer, fds[1]);
 
   uv_stdio_container_t stdio[3];
-  stdio[0].flags = UV_IGNORE;
+  stdio[0].flags = UV_INHERIT_FD;
+  stdio[0].data.fd = 0;
   stdio[1].flags = UV_INHERIT_STREAM;
   stdio[1].data.stream = pipe_writer;
   stdio[2] = stdio[1];
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index ecd4441..99f4ae7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -368,7 +368,8 @@ add_RunCMake_test(FetchContent)
 if(NOT CMake_TEST_EXTERNAL_CMAKE)
   set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>)
 endif()
-add_RunCMake_test(CTestCommandLine)
+add_executable(print_stdin print_stdin.c)
+add_RunCMake_test(CTestCommandLine -DTEST_PRINT_STDIN=$<TARGET_FILE:print_stdin>)
 add_RunCMake_test(CacheNewline)
 # Only run this test on unix platforms that support
 # symbolic links
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 9e8d050..750ae50 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -161,3 +161,15 @@ endfunction()
 if(TEST_AFFINITY)
   run_TestAffinity()
 endif()
+
+function(run_TestStdin)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestStdin)
+  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(TestStdin \"${TEST_PRINT_STDIN}\")
+  ")
+  run_cmake_command(TestStdin ${CMAKE_CTEST_COMMAND} -V)
+endfunction()
+run_TestStdin()
diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt
new file mode 100644
index 0000000..d83b50a
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt
@@ -0,0 +1 @@
+Content for TestStdin
diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt
new file mode 100644
index 0000000..d83b50a
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt
@@ -0,0 +1 @@
+Content for TestStdin
diff --git a/Tests/RunCMake/print_stdin.c b/Tests/RunCMake/print_stdin.c
new file mode 100644
index 0000000..e083e62
--- /dev/null
+++ b/Tests/RunCMake/print_stdin.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+  char buf[1024];
+  size_t nIn = sizeof(buf);
+  while (nIn == sizeof(buf)) {
+    nIn = fread(buf, 1, sizeof(buf), stdin);
+    if (nIn > 0) {
+      size_t nOut;
+      nOut = fwrite(buf, 1, nIn, stdout);
+      if (nOut != nIn) {
+        return 1;
+      }
+    }
+  }
+  return 0;
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdec3bd896b6faabab1c7cae79d8e75e8d0f0e41
commit bdec3bd896b6faabab1c7cae79d8e75e8d0f0e41
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 15 08:03:12 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 15 08:08:56 2018 -0500

    Tests: Teach RunCMake infrastructure to optionally provide stdin

diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 69c96cc..c076ad9 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -65,6 +65,13 @@ function(run_cmake test)
   else()
     set(maybe_timeout "")
   endif()
+  if(RunCMake-stdin-file AND EXISTS ${top_src}/${RunCMake-stdin-file})
+    set(maybe_input_file INPUT_FILE ${top_src}/${RunCMake-stdin-file})
+  elseif(EXISTS ${top_src}/${test}-stdin.txt)
+    set(maybe_input_file INPUT_FILE ${top_src}/${test}-stdin.txt)
+  else()
+    set(maybe_input_file "")
+  endif()
   if(RunCMake_TEST_COMMAND)
     execute_process(
       COMMAND ${RunCMake_TEST_COMMAND}
@@ -74,6 +81,7 @@ function(run_cmake test)
       RESULT_VARIABLE actual_result
       ENCODING UTF8
       ${maybe_timeout}
+      ${maybe_input_file}
       )
   else()
     if(RunCMake_GENERATOR_INSTANCE)
@@ -96,6 +104,7 @@ function(run_cmake test)
       RESULT_VARIABLE actual_result
       ENCODING UTF8
       ${maybe_timeout}
+      ${maybe_input_file}
       )
   endif()
   set(msg "")

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

Summary of changes:
 Source/CTest/cmProcess.cxx                           |  3 ++-
 Tests/RunCMake/CMakeLists.txt                        |  3 ++-
 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake   | 12 ++++++++++++
 Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt  |  1 +
 Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt |  1 +
 Tests/RunCMake/RunCMake.cmake                        |  9 +++++++++
 Tests/RunCMake/print_stdin.c                         | 18 ++++++++++++++++++
 7 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt
 create mode 100644 Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt
 create mode 100644 Tests/RunCMake/print_stdin.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list