2
* Copyright © 2012 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Thomas Guest <thomas.guest@canonical.com>
19
#ifndef MIR_TESTING_PROCESS_MANAGER
20
#define MIR_TESTING_PROCESS_MANAGER
22
#include "mir/server_configuration.h"
24
#include "mir_test_framework/process.h"
26
#include "mir_test_framework/testing_server_configuration.h"
27
#include "mir_test_framework/testing_client_configuration.h"
42
namespace mir_test_framework
47
class TestingProcessManager
50
TestingProcessManager();
51
~TestingProcessManager();
53
void launch_server_process(TestingServerConfiguration& config);
54
pid_t launch_client_process(TestingClientConfiguration& config,
55
mir::options::Option const& test_options);
57
void tear_down_clients();
58
void tear_down_server();
60
Result shutdown_server_process();
61
Result kill_server_process();
62
Result wait_for_shutdown_server_process();
63
std::vector<Result> wait_for_shutdown_client_processes();
64
void terminate_client_processes();
65
void run_in_test_process(std::function<void()> const& run_code);
68
std::shared_ptr<Process> server_process;
69
std::vector<std::shared_ptr<Process>> clients;
72
bool server_process_was_started;
75
std::string const& test_socket_file();
79
#endif // MIR_TESTING_PROCESS_MANAGER