]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/process/test/close_stderr.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / process / test / close_stderr.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
6 //
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)
9
10 #define BOOST_TEST_MAIN
11 #define BOOST_TEST_IGNORE_SIGCHLD
12 #include <boost/test/included/unit_test.hpp>
13
14 #include <boost/process/error.hpp>
15 #include <boost/process/io.hpp>
16 #include <boost/process/child.hpp>
17 #include <system_error>
18
19 #include <boost/system/error_code.hpp>
20 #include <cstdlib>
21 #if defined(BOOST_POSIX_API)
22 # include <sys/wait.h>
23 #endif
24
25 namespace bp = boost::process;
26
27
28 BOOST_AUTO_TEST_CASE(closed)
29 {
30 using boost::unit_test::framework::master_test_suite;
31
32 std::error_code ec;
33 bp::child c(
34 master_test_suite().argv[1],
35 "test", "--is-closed-stderr",
36 bp::std_err > bp::close,
37 ec
38 );
39 BOOST_REQUIRE(!ec);
40
41 c.wait();
42 int exit_code = c.exit_code();
43 #if defined(BOOST_WINDOWS_API)
44 BOOST_CHECK_EQUAL(EXIT_SUCCESS, exit_code);
45 #elif defined(BOOST_POSIX_API)
46 BOOST_CHECK_EQUAL(EXIT_SUCCESS, WEXITSTATUS(exit_code));
47 #endif
48 }