|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64974 - sandbox/SOC/2010/process/libs/process/test
From: boris_at_[hidden]
Date: 2010-08-23 17:02:43
Author: bschaeling
Date: 2010-08-23 17:02:33 EDT (Mon, 23 Aug 2010)
New Revision: 64974
URL: http://svn.boost.org/trac/boost/changeset/64974
Log:
Added test case test_sync_io_with_named_pipe to check whether sync I/O works with behavior::named_pipe on Windows
Text files modified:
sandbox/SOC/2010/process/libs/process/test/child.cpp | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
Modified: sandbox/SOC/2010/process/libs/process/test/child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/test/child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/test/child.cpp 2010-08-23 17:02:33 EDT (Mon, 23 Aug 2010)
@@ -785,4 +785,38 @@
int s = c.wait();
BOOST_CHECK_EQUAL(s, EXIT_SUCCESS);
}
+
+BOOST_AUTO_TEST_CASE(test_sync_io_with_named_pipe)
+{
+ check_helpers();
+
+ std::vector<std::string> args;
+ args.push_back("stdin-to-stdout");
+
+ bp::context ctx;
+ ctx.stdin_behavior = bpb::named_pipe::create(
+ bpb::named_pipe::input_stream);
+ ctx.stdout_behavior = bpb::named_pipe::create(
+ bpb::named_pipe::output_stream);
+
+ bp::child c = bp::create_child(get_helpers_path(), args, ctx);
+
+ bp::postream &os = c.get_stdin();
+ bp::pistream &is = c.get_stdout();
+
+ os << "message-to-process" << std::endl;
+ os.close();
+
+ std::string word;
+ is >> word;
+ BOOST_CHECK_EQUAL(word, "message-to-process");
+
+ int s = c.wait();
+#if defined(BOOST_POSIX_API)
+ BOOST_REQUIRE(WIFEXITED(s));
+ BOOST_CHECK_EQUAL(WEXITSTATUS(s), EXIT_SUCCESS);
+#elif defined(BOOST_WINDOWS_API)
+ BOOST_CHECK_EQUAL(s, EXIT_SUCCESS);
+#endif
+}
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk