xref: /src/contrib/kyua/engine/execenv/execenv_host.hpp (revision 257e70f1d5ee61037c8c59b116538d3b6b1427a2)
1257e70f1SIgor Ostapenko // Copyright 2024 The Kyua Authors.
2257e70f1SIgor Ostapenko // All rights reserved.
3257e70f1SIgor Ostapenko //
4257e70f1SIgor Ostapenko // Redistribution and use in source and binary forms, with or without
5257e70f1SIgor Ostapenko // modification, are permitted provided that the following conditions are
6257e70f1SIgor Ostapenko // met:
7257e70f1SIgor Ostapenko //
8257e70f1SIgor Ostapenko // * Redistributions of source code must retain the above copyright
9257e70f1SIgor Ostapenko //   notice, this list of conditions and the following disclaimer.
10257e70f1SIgor Ostapenko // * Redistributions in binary form must reproduce the above copyright
11257e70f1SIgor Ostapenko //   notice, this list of conditions and the following disclaimer in the
12257e70f1SIgor Ostapenko //   documentation and/or other materials provided with the distribution.
13257e70f1SIgor Ostapenko // * Neither the name of Google Inc. nor the names of its contributors
14257e70f1SIgor Ostapenko //   may be used to endorse or promote products derived from this software
15257e70f1SIgor Ostapenko //   without specific prior written permission.
16257e70f1SIgor Ostapenko //
17257e70f1SIgor Ostapenko // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18257e70f1SIgor Ostapenko // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19257e70f1SIgor Ostapenko // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20257e70f1SIgor Ostapenko // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21257e70f1SIgor Ostapenko // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22257e70f1SIgor Ostapenko // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23257e70f1SIgor Ostapenko // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24257e70f1SIgor Ostapenko // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25257e70f1SIgor Ostapenko // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26257e70f1SIgor Ostapenko // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27257e70f1SIgor Ostapenko // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28257e70f1SIgor Ostapenko 
29257e70f1SIgor Ostapenko /// \file engine/execenv/execenv_host.hpp
30257e70f1SIgor Ostapenko /// Default execution environment.
31257e70f1SIgor Ostapenko 
32257e70f1SIgor Ostapenko #if !defined(ENGINE_EXECENV_EXECENV_HOST_HPP)
33257e70f1SIgor Ostapenko #define ENGINE_EXECENV_EXECENV_HOST_HPP
34257e70f1SIgor Ostapenko 
35257e70f1SIgor Ostapenko #include "engine/execenv/execenv.hpp"
36257e70f1SIgor Ostapenko 
37257e70f1SIgor Ostapenko #include "utils/process/operations_fwd.hpp"
38257e70f1SIgor Ostapenko 
39257e70f1SIgor Ostapenko namespace execenv = engine::execenv;
40257e70f1SIgor Ostapenko 
41257e70f1SIgor Ostapenko using utils::process::args_vector;
42257e70f1SIgor Ostapenko 
43257e70f1SIgor Ostapenko namespace engine {
44257e70f1SIgor Ostapenko namespace execenv {
45257e70f1SIgor Ostapenko 
46257e70f1SIgor Ostapenko 
47257e70f1SIgor Ostapenko class execenv_host : public execenv::interface {
48257e70f1SIgor Ostapenko public:
execenv_host(const model::test_program & test_program,const std::string & test_case_name)49257e70f1SIgor Ostapenko     execenv_host(const model::test_program& test_program,
50257e70f1SIgor Ostapenko                  const std::string& test_case_name) :
51257e70f1SIgor Ostapenko         execenv::interface(test_program, test_case_name)
52257e70f1SIgor Ostapenko     {}
53257e70f1SIgor Ostapenko 
54257e70f1SIgor Ostapenko     void init() const;
55257e70f1SIgor Ostapenko     void cleanup() const;
56257e70f1SIgor Ostapenko     void exec(const args_vector& args) const UTILS_NORETURN;
57257e70f1SIgor Ostapenko };
58257e70f1SIgor Ostapenko 
59257e70f1SIgor Ostapenko 
60257e70f1SIgor Ostapenko }  // namespace execenv
61257e70f1SIgor Ostapenko }  // namespace engine
62257e70f1SIgor Ostapenko 
63257e70f1SIgor Ostapenko #endif  // !defined(ENGINE_EXECENV_EXECENV_HOST_HPP)
64