|
process-cpp
3.0.0
A simple convenience library for handling processes in C++11.
|
#include <core/posix/exec.h>#include <core/posix/fork.h>#include <core/posix/process.h>#include <core/posix/signal.h>#include <gmock/gmock.h>#include <gtest/gtest.h>#include <chrono>#include <map>#include <thread>
Include dependency graph for posix_process_test.cpp:Go to the source code of this file.
Functions | |
| TEST (PosixProcess, ctor_throws_for_invalid_pid) | |
| TEST (PosixProcess, this_process_instance_reports_correct_pid) | |
| TEST (PosixProcess, this_process_instance_reports_correct_parent) | |
| TEST (PosixProcess, throwing_access_to_process_group_id_of_this_process_works) | |
| TEST (PosixProcess, non_throwing_access_to_process_group_id_of_this_process_works) | |
| TEST (PosixProcess, trying_to_access_process_group_of_invalid_process_throws) | |
| TEST (PosixProcess, trying_to_access_process_group_of_invalid_process_reports_error) | |
| TEST_F (ForkedSpinningProcess, throwing_access_to_process_group_id_of_a_forked_process_works) | |
| TEST_F (ForkedSpinningProcess, non_throwing_access_to_process_group_id_of_a_forked_process_works) | |
| TEST (PosixProcess, accessing_streams_of_this_process_works) | |
| TEST (Self, non_mutable_access_to_the_environment_returns_correct_results) | |
| TEST (Self, mutable_access_to_the_environment_alters_the_environment) | |
| TEST (Self, getting_env_var_for_empty_key_does_not_throw) | |
| TEST (Self, setting_env_var_for_empty_key_throws) | |
| TEST (ChildProcess, fork_returns_process_object_with_valid_pid_and_wait_for_returns_correct_result) | |
| TEST_F (ForkedSpinningProcess, signalling_a_forked_child_makes_wait_for_return_correct_result) | |
| TEST (ChildProcess, stopping_a_forked_child_makes_wait_for_return_correct_result) | |
| TEST (ChildProcess, exec_returns_process_object_with_valid_pid_and_wait_for_returns_correct_result) | |
| TEST (ChildProcess, exec_child_setup) | |
| TEST (ChildProcess, signalling_an_execd_child_makes_wait_for_return_correct_result) | |
| TEST (ChildProcess, stopping_an_execd_child_makes_wait_for_return_correct_result) | |
| TEST_F (ForkedSpinningProcess, observing_child_processes_for_death_works_if_child_is_signalled_with_sigkill) | |
| TEST_F (ForkedSpinningProcess, observing_child_processes_for_death_works_if_child_is_signalled_with_sigterm) | |
| TEST (ChildProcess, ensure_that_forked_children_are_cleaned_up) | |
| TEST (StreamRedirect, redirecting_stdin_stdout_stderr_works) | |
| TEST (Environment, iterating_the_environment_does_not_throw) | |
| TEST (Environment, specifying_default_value_for_get_returns_correct_result) | |
| TEST (Environment, for_each_returns_correct_results) | |
| TEST | ( | ChildProcess | , |
| ensure_that_forked_children_are_cleaned_up | |||
| ) |
Definition at line 452 of file posix_process_test.cpp.
References core::posix::fork(), core::posix::stdin, and core::posix::stdout.
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| exec_child_setup | |||
| ) |
Definition at line 293 of file posix_process_test.cpp.
References core::posix::ChildProcess::cout(), core::posix::this_process::cout(), core::posix::exec(), core::posix::Process::pid(), and core::posix::stdout.
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| exec_returns_process_object_with_valid_pid_and_wait_for_returns_correct_result | |||
| ) |
Definition at line 270 of file posix_process_test.cpp.
References core::posix::exec(), core::posix::this_process::env::for_each(), core::posix::wait::Result::signaled, core::posix::stdin, and core::posix::stdout.
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| fork_returns_process_object_with_valid_pid_and_wait_for_returns_correct_result | |||
| ) |
Definition at line 186 of file posix_process_test.cpp.
References core::posix::this_process::cout(), core::posix::wait::Result::exited, core::posix::fork(), core::posix::Process::pid(), core::posix::stdin, core::posix::stdout, core::posix::exit::success, and core::posix::ChildProcess::wait_for().
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| signalling_an_execd_child_makes_wait_for_return_correct_result | |||
| ) |
Definition at line 314 of file posix_process_test.cpp.
References core::posix::exec(), core::posix::this_process::env::for_each(), core::posix::wait::Result::signaled, core::posix::stdin, and core::posix::stdout.
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| stopping_a_forked_child_makes_wait_for_return_correct_result | |||
| ) |
Definition at line 233 of file posix_process_test.cpp.
References core::posix::ChildProcess::cin(), core::posix::this_process::cin(), core::posix::ChildProcess::cout(), core::posix::this_process::cout(), core::posix::fork(), core::posix::Process::pid(), core::posix::Signalable::send_signal_or_throw(), core::posix::wait::Result::signaled, core::posix::stdin, core::posix::stdout, core::posix::wait::Result::stopped, core::posix::exit::success, and core::posix::ChildProcess::wait_for().
Here is the call graph for this function:| TEST | ( | ChildProcess | , |
| stopping_an_execd_child_makes_wait_for_return_correct_result | |||
| ) |
Definition at line 353 of file posix_process_test.cpp.
References core::posix::exec(), core::posix::this_process::env::for_each(), core::posix::wait::Result::signaled, core::posix::stdin, core::posix::stdout, and core::posix::wait::Result::stopped.
Here is the call graph for this function:| TEST | ( | Environment | , |
| for_each_returns_correct_results | |||
| ) |
Definition at line 534 of file posix_process_test.cpp.
References core::posix::this_process::env::for_each().
Here is the call graph for this function:| TEST | ( | Environment | , |
| iterating_the_environment_does_not_throw | |||
| ) |
Definition at line 518 of file posix_process_test.cpp.
References core::posix::this_process::cout(), and core::posix::this_process::env::for_each().
Here is the call graph for this function:| TEST | ( | Environment | , |
| specifying_default_value_for_get_returns_correct_result | |||
| ) |
Definition at line 527 of file posix_process_test.cpp.
References core::posix::this_process::env::get().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| accessing_streams_of_this_process_works | |||
| ) |
Definition at line 128 of file posix_process_test.cpp.
References core::posix::this_process::cerr(), and core::posix::this_process::cout().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| ctor_throws_for_invalid_pid | |||
| ) |
Definition at line 72 of file posix_process_test.cpp.
References EXPECT_ANY_THROW().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| non_throwing_access_to_process_group_id_of_this_process_works | |||
| ) |
Definition at line 93 of file posix_process_test.cpp.
References core::posix::this_process::instance(), and core::posix::Process::process_group().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| this_process_instance_reports_correct_parent | |||
| ) |
Definition at line 83 of file posix_process_test.cpp.
References core::posix::this_process::parent().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| this_process_instance_reports_correct_pid | |||
| ) |
Definition at line 78 of file posix_process_test.cpp.
References core::posix::this_process::instance().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| throwing_access_to_process_group_id_of_this_process_works | |||
| ) |
Definition at line 88 of file posix_process_test.cpp.
References core::posix::this_process::instance().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| trying_to_access_process_group_of_invalid_process_reports_error | |||
| ) |
Definition at line 106 of file posix_process_test.cpp.
References core::posix::Process::invalid(), and core::posix::Process::process_group().
Here is the call graph for this function:| TEST | ( | PosixProcess | , |
| trying_to_access_process_group_of_invalid_process_throws | |||
| ) |
Definition at line 101 of file posix_process_test.cpp.
References EXPECT_ANY_THROW(), and core::posix::Process::invalid().
Here is the call graph for this function:| TEST | ( | Self | , |
| getting_env_var_for_empty_key_does_not_throw | |||
| ) |
Definition at line 174 of file posix_process_test.cpp.
References core::posix::this_process::env::get().
Here is the call graph for this function:| TEST | ( | Self | , |
| mutable_access_to_the_environment_alters_the_environment | |||
| ) |
Definition at line 155 of file posix_process_test.cpp.
References core::posix::this_process::env::get(), core::posix::this_process::env::set_or_throw(), and core::posix::this_process::env::unset_or_throw().
Here is the call graph for this function:| TEST | ( | Self | , |
| non_mutable_access_to_the_environment_returns_correct_results | |||
| ) |
Definition at line 147 of file posix_process_test.cpp.
References core::posix::this_process::env::get().
Here is the call graph for this function:| TEST | ( | Self | , |
| setting_env_var_for_empty_key_throws | |||
| ) |
Definition at line 179 of file posix_process_test.cpp.
References EXPECT_ANY_THROW(), and core::posix::this_process::env::set_or_throw().
Here is the call graph for this function:| TEST | ( | StreamRedirect | , |
| redirecting_stdin_stdout_stderr_works | |||
| ) |
Definition at line 489 of file posix_process_test.cpp.
References core::posix::ChildProcess::cerr(), core::posix::this_process::cerr(), core::posix::ChildProcess::cin(), core::posix::this_process::cin(), core::posix::ChildProcess::cout(), core::posix::this_process::cout(), core::posix::fork(), core::posix::Process::pid(), core::posix::Signalable::send_signal_or_throw(), core::posix::stderr, core::posix::stdin, core::posix::stdout, core::posix::exit::success, and core::posix::ChildProcess::wait_for().
Here is the call graph for this function:| TEST_F | ( | ForkedSpinningProcess | , |
| non_throwing_access_to_process_group_id_of_a_forked_process_works | |||
| ) |
Definition at line 119 of file posix_process_test.cpp.
| TEST_F | ( | ForkedSpinningProcess | , |
| observing_child_processes_for_death_works_if_child_is_signalled_with_sigkill | |||
| ) |
Definition at line 391 of file posix_process_test.cpp.
References core::posix::SignalTrap::stop().
Here is the call graph for this function:| TEST_F | ( | ForkedSpinningProcess | , |
| observing_child_processes_for_death_works_if_child_is_signalled_with_sigterm | |||
| ) |
Definition at line 421 of file posix_process_test.cpp.
References core::posix::SignalTrap::stop().
Here is the call graph for this function:| TEST_F | ( | ForkedSpinningProcess | , |
| signalling_a_forked_child_makes_wait_for_return_correct_result | |||
| ) |
Definition at line 211 of file posix_process_test.cpp.
References core::posix::this_process::cout(), core::posix::fork(), core::posix::wait::Result::signaled, core::posix::stdin, core::posix::stdout, and core::posix::exit::success.
Here is the call graph for this function:| TEST_F | ( | ForkedSpinningProcess | , |
| throwing_access_to_process_group_id_of_a_forked_process_works | |||
| ) |
Definition at line 113 of file posix_process_test.cpp.