Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / process / test / run_exe_path.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 <system_error>
15 #include <boost/filesystem.hpp>
16
17 #include <boost/process/cmd.hpp>
18 #include <boost/process/error.hpp>
19 #include <boost/process/child.hpp>
20
21 namespace bp = boost::process;
22
23
24 BOOST_AUTO_TEST_CASE(run_exe_success)
25 {
26     using boost::unit_test::framework::master_test_suite;
27
28     boost::filesystem::path exe = master_test_suite().argv[1];
29
30     std::error_code ec;
31     bp::child c(
32         exe,
33         ec
34     );
35     BOOST_CHECK(!ec);
36 }
37
38 #if defined(BOOST_WINDOWS_API)
39 BOOST_AUTO_TEST_CASE(run_exe_error)
40 {
41     boost::filesystem::path exe = "doesnt-exist";
42
43     std::error_code ec;
44     bp::child c(
45         exe,
46         ec
47     );
48     BOOST_CHECK(ec);
49 }
50 #endif