diff options
author | Brad King <brad.king@kitware.com> | 2018-11-15 13:03:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-11-15 13:08:56 (GMT) |
commit | 86e8315482fd8f0bba85af6f4f8363ead6a0818d (patch) | |
tree | bfe834ba2f4f8a613e757c1e775777430063b085 /Tests/RunCMake/print_stdin.c | |
parent | bdec3bd896b6faabab1c7cae79d8e75e8d0f0e41 (diff) | |
download | CMake-86e8315482fd8f0bba85af6f4f8363ead6a0818d.zip CMake-86e8315482fd8f0bba85af6f4f8363ead6a0818d.tar.gz CMake-86e8315482fd8f0bba85af6f4f8363ead6a0818d.tar.bz2 |
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
Diffstat (limited to 'Tests/RunCMake/print_stdin.c')
-rw-r--r-- | Tests/RunCMake/print_stdin.c | 18 |
1 files changed, 18 insertions, 0 deletions
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; +} |