]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/process/test/vfork.cpp
1 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
2 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3 // Copyright (c) 2009 Boris Schaeling
4 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 #define BOOST_TEST_MAIN
11 #define BOOST_TEST_IGNORE_SIGCHLD
12 #include <boost/test/included/unit_test.hpp>
14 #include <boost/process.hpp>
15 #include <boost/process/posix.hpp>
17 #include <system_error>
24 namespace bp
= boost::process
;
26 #if defined(BOOST_POSIX_HAS_VFORK)
28 BOOST_AUTO_TEST_CASE(bind_fd
, *boost::unit_test::timeout(2))
30 using boost::unit_test::framework::master_test_suite
;
36 master_test_suite().argv
[1],
37 "test", "--posix-echo-one", "3", "hello",
38 bp::posix::fd
.bind(3, p
.native_sink()),
45 bp::ipstream
is(std::move(p
));
49 BOOST_CHECK_EQUAL(s
, "hello");
52 BOOST_AUTO_TEST_CASE(execve_set_on_error
, *boost::unit_test::timeout(2))
61 BOOST_CHECK_EQUAL(ec
.value(), ENOENT
);
64 BOOST_AUTO_TEST_CASE(execve_throw_on_error
, *boost::unit_test::timeout(2))
68 bp::spawn("doesnt-exist", bp::posix::use_vfork
);
71 catch (std::system_error
&e
)
73 BOOST_CHECK(e
.code());
74 BOOST_CHECK_EQUAL(e
.code().value(), ENOENT
);
79 BOOST_AUTO_TEST_CASE(dummy
) {}