core::testing Namespace Reference

## Classes

class | CrossProcessSync
| A cross-process synchronization primitive that supports simple wait-condition-like scenarios. More...

## Enumerations

enum class | ForkAndRunResult { empty = 0 , client_failed = 1 << 0 , service_failed = 1 << 1 }
| The ForkAndRunResult enum models the different failure modes of fork_and_run. More...

## Functions

CORE_POSIX_DLL_PUBLIC ForkAndRunResult | operator| (ForkAndRunResult lhs, ForkAndRunResult rhs)
CORE_POSIX_DLL_PUBLIC ForkAndRunResult | operator& (ForkAndRunResult lhs, ForkAndRunResult rhs)
CORE_POSIX_DLL_PUBLIC ForkAndRunResult | fork_and_run (const std::function< core::posix::exit::Status()> &service, const std::function< core::posix::exit::Status()> &client)
| Forks two processes for both the service and the client.

## Enumeration Type Documentation

## ForkAndRunResult

enum class core::testing::ForkAndRunResult

strong

The ForkAndRunResult enum models the different failure modes of fork_and_run.

Enumerator
empty | Special value indicating no bit being set.
client_failed | The client failed.
service_failed | The service failed.

Definition at line 34 of file fork_and_run.h.

## Function Documentation

## fork_and_run()

core::testing::ForkAndRunResult core::testing::fork_and_run | ( | const std::function< core::posix::exit::Status()> & | service,
|  | const std::function< core::posix::exit::Status()> & | client
| ) |  |

Forks two processes for both the service and the client.

The function does the following:

- Forks a process for the service and runs the respective closure.
- Forks a process for the client and runs the respective closure.
- After the client has finished, the service is signalled with sigterm.

Exceptions

  std::system_error | if an error occurred during process interaction.
  std::runtime_error | for signalling all other error conditions.

Parameters

  [in] | service | The service to be executed in a child process.
  [in] | client | The client to be executed in a child process.

Returns
  ForkAndRunResult indicating if either of service or client failed.

Definition at line 41 of file fork_and_run.cpp.

References client_failed, core::posix::empty, empty, core::posix::wait::Result::exited, core::posix::exit::failure, core::posix::fork(), service_failed, core::posix::sig_term, and core::posix::wait::untraced.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

Here is the call graph for this function:

## operator&()

core::testing::ForkAndRunResult core::testing::operator& | ( | ForkAndRunResult | lhs,
|  | ForkAndRunResult | rhs
| ) |  |

Definition at line 33 of file fork_and_run.cpp.

## operator|()

core::testing::ForkAndRunResult core::testing::operator| | ( | ForkAndRunResult | lhs,
|  | ForkAndRunResult | rhs
| ) |  |

Definition at line 25 of file fork_and_run.cpp.