xref: /freebsd/contrib/kyua/drivers/debug_test.hpp (revision 6b8222793fbb4c0e162232716bc454dad31b709f)
1b0d29bc4SBrooks Davis // Copyright 2011 The Kyua Authors.
2b0d29bc4SBrooks Davis // All rights reserved.
3b0d29bc4SBrooks Davis //
4b0d29bc4SBrooks Davis // Redistribution and use in source and binary forms, with or without
5b0d29bc4SBrooks Davis // modification, are permitted provided that the following conditions are
6b0d29bc4SBrooks Davis // met:
7b0d29bc4SBrooks Davis //
8b0d29bc4SBrooks Davis // * Redistributions of source code must retain the above copyright
9b0d29bc4SBrooks Davis //   notice, this list of conditions and the following disclaimer.
10b0d29bc4SBrooks Davis // * Redistributions in binary form must reproduce the above copyright
11b0d29bc4SBrooks Davis //   notice, this list of conditions and the following disclaimer in the
12b0d29bc4SBrooks Davis //   documentation and/or other materials provided with the distribution.
13b0d29bc4SBrooks Davis // * Neither the name of Google Inc. nor the names of its contributors
14b0d29bc4SBrooks Davis //   may be used to endorse or promote products derived from this software
15b0d29bc4SBrooks Davis //   without specific prior written permission.
16b0d29bc4SBrooks Davis //
17b0d29bc4SBrooks Davis // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18b0d29bc4SBrooks Davis // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19b0d29bc4SBrooks Davis // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20b0d29bc4SBrooks Davis // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21b0d29bc4SBrooks Davis // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22b0d29bc4SBrooks Davis // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23b0d29bc4SBrooks Davis // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24b0d29bc4SBrooks Davis // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25b0d29bc4SBrooks Davis // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26b0d29bc4SBrooks Davis // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27b0d29bc4SBrooks Davis // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28b0d29bc4SBrooks Davis 
29b0d29bc4SBrooks Davis /// \file drivers/debug_test.hpp
30b0d29bc4SBrooks Davis /// Driver to run a single test in a controlled manner.
31b0d29bc4SBrooks Davis ///
32b0d29bc4SBrooks Davis /// This driver module implements the logic to execute a particular test
33b0d29bc4SBrooks Davis /// with hooks into the runtime procedure.  This is to permit debugging the
34b0d29bc4SBrooks Davis /// behavior of the test.
35b0d29bc4SBrooks Davis 
36b0d29bc4SBrooks Davis #if !defined(DRIVERS_DEBUG_TEST_HPP)
37b0d29bc4SBrooks Davis #define DRIVERS_DEBUG_TEST_HPP
38b0d29bc4SBrooks Davis 
39*6b822279SIgor Ostapenko #include "engine/debugger.hpp"
40b0d29bc4SBrooks Davis #include "engine/filters.hpp"
41b0d29bc4SBrooks Davis #include "model/test_result.hpp"
42b0d29bc4SBrooks Davis #include "utils/config/tree_fwd.hpp"
43b0d29bc4SBrooks Davis #include "utils/fs/path_fwd.hpp"
44b0d29bc4SBrooks Davis #include "utils/optional_fwd.hpp"
45b0d29bc4SBrooks Davis 
46*6b822279SIgor Ostapenko using engine::debugger;
47*6b822279SIgor Ostapenko 
48b0d29bc4SBrooks Davis namespace drivers {
49b0d29bc4SBrooks Davis namespace debug_test {
50b0d29bc4SBrooks Davis 
51b0d29bc4SBrooks Davis 
52b0d29bc4SBrooks Davis /// Tuple containing the results of this driver.
53b0d29bc4SBrooks Davis class result {
54b0d29bc4SBrooks Davis public:
55b0d29bc4SBrooks Davis     /// A filter matching the executed test case only.
56b0d29bc4SBrooks Davis     engine::test_filter test_case;
57b0d29bc4SBrooks Davis 
58b0d29bc4SBrooks Davis     /// The result of the test case.
59b0d29bc4SBrooks Davis     model::test_result test_result;
60b0d29bc4SBrooks Davis 
61b0d29bc4SBrooks Davis     /// Initializer for the tuple's fields.
62b0d29bc4SBrooks Davis     ///
63b0d29bc4SBrooks Davis     /// \param test_case_ The matched test case.
64b0d29bc4SBrooks Davis     /// \param test_result_ The result of the test case.
result(const engine::test_filter & test_case_,const model::test_result & test_result_)65b0d29bc4SBrooks Davis     result(const engine::test_filter& test_case_,
66b0d29bc4SBrooks Davis            const model::test_result& test_result_) :
67b0d29bc4SBrooks Davis         test_case(test_case_),
68b0d29bc4SBrooks Davis         test_result(test_result_)
69b0d29bc4SBrooks Davis     {
70b0d29bc4SBrooks Davis     }
71b0d29bc4SBrooks Davis };
72b0d29bc4SBrooks Davis 
73b0d29bc4SBrooks Davis 
74*6b822279SIgor Ostapenko result drive(std::shared_ptr< debugger >,
75*6b822279SIgor Ostapenko              const utils::fs::path&, const utils::optional< utils::fs::path >,
76b0d29bc4SBrooks Davis              const engine::test_filter&, const utils::config::tree&,
77b0d29bc4SBrooks Davis              const utils::fs::path&, const utils::fs::path&);
78b0d29bc4SBrooks Davis 
79b0d29bc4SBrooks Davis 
80b0d29bc4SBrooks Davis }  // namespace debug_test
81b0d29bc4SBrooks Davis }  // namespace drivers
82b0d29bc4SBrooks Davis 
83b0d29bc4SBrooks Davis #endif  // !defined(DRIVERS_DEBUG_TEST_HPP)
84