1 // Copyright 2010 The Kyua Authors.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Google Inc. nor the names of its contributors
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /// \file engine/atf_result.hpp
30 /// Functions and types to process the results of ATF-based test cases.
32 #if !defined(ENGINE_ATF_RESULT_HPP)
33 #define ENGINE_ATF_RESULT_HPP
35 #include "engine/atf_result_fwd.hpp"
40 #include "model/test_result_fwd.hpp"
41 #include "utils/optional.hpp"
42 #include "utils/fs/path_fwd.hpp"
43 #include "utils/process/status_fwd.hpp"
48 /// Internal representation of the raw result files of ATF-based tests.
50 /// This class is used exclusively to represent the transient result files read
51 /// from test cases before generating the "public" version of the result. This
52 /// class should actually not be exposed in the header files, but it is for
53 /// testing purposes only.
56 /// List of possible types for the test case result.
70 /// The test case result.
73 /// The optional integral argument that may accompany the result.
75 /// Should only be present if the type is expected_exit or expected_signal.
76 utils::optional< int > _argument;
78 /// A description of the test case result.
80 /// Should always be present except for the passed type.
81 utils::optional< std::string > _reason;
84 atf_result(const types);
85 atf_result(const types, const std::string&);
86 atf_result(const types, const utils::optional< int >&, const std::string&);
88 static atf_result parse(std::istream&);
89 static atf_result load(const utils::fs::path&);
91 types type(void) const;
92 const utils::optional< int >& argument(void) const;
93 const utils::optional< std::string >& reason(void) const;
95 bool good(void) const;
96 atf_result apply(const utils::optional< utils::process::status >&) const;
97 model::test_result externalize(void) const;
99 bool operator==(const atf_result&) const;
100 bool operator!=(const atf_result&) const;
104 std::ostream& operator<<(std::ostream&, const atf_result&);
107 model::test_result calculate_atf_result(
108 const utils::optional< utils::process::status >&,
109 const utils::fs::path&);
112 } // namespace engine
114 #endif // !defined(ENGINE_ATF_IFACE_RESULTS_HPP)