2 // Automated Testing Framework (atf)
4 // Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
5 // All rights reserved.
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
10 // 1. Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
16 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #if !defined(_ATF_CXX_CHECK_HPP_)
31 #define _ATF_CXX_CHECK_HPP_
34 #include "atf-c/check.h"
42 #include "atf-c++/fs.hpp"
43 #include "atf-c++/text.hpp"
44 #include "atf-c++/utils.hpp"
50 } // namespace process
54 // ------------------------------------------------------------------------
55 // The "check_result" class.
56 // ------------------------------------------------------------------------
59 //! \brief A class that contains results of executed command.
61 //! The check_result class holds information about results
62 //! of executing arbitrary command and manages files containing
67 //! \brief Internal representation of a result.
69 atf_check_result_t m_result
;
72 //! \brief Copy of m_result.m_argv but in a C++ collection.
74 std::vector
< std::string
> m_argv
;
77 //! \brief Constructs a results object and grabs ownership of the
78 //! parameter passed in.
80 check_result(const atf_check_result_t
* result
);
82 friend check_result
test_constructor(const char* const*);
83 friend check_result
exec(const atf::process::argv_array
&);
87 //! \brief Destroys object and removes all managed files.
92 //! \brief Returns the argument list used by the command that caused
95 const std::vector
< std::string
>& argv(void) const;
98 //! \brief Returns whether the command exited correctly or not.
100 bool exited(void) const;
103 //! \brief Returns command's exit status.
105 int exitcode(void) const;
108 //! \brief Returns the path to file contaning command's stdout.
110 const atf::fs::path
stdout_path(void) const;
113 //! \brief Returns the path to file contaning command's stderr.
115 const atf::fs::path
stderr_path(void) const;
118 // ------------------------------------------------------------------------
120 // ------------------------------------------------------------------------
122 bool build_c_o(const atf::fs::path
&, const atf::fs::path
&,
123 const atf::process::argv_array
&);
124 bool build_cpp(const atf::fs::path
&, const atf::fs::path
&,
125 const atf::process::argv_array
&);
126 bool build_cxx_o(const atf::fs::path
&, const atf::fs::path
&,
127 const atf::process::argv_array
&);
128 check_result
exec(const atf::process::argv_array
&);
130 // Useful for testing only.
131 check_result
test_constructor(void);
136 #endif // !defined(_ATF_CXX_CHECK_HPP_)