18 #ifndef CORE_TESTING_FORK_AND_RUN_H_ 19 #define CORE_TESTING_FORK_AND_RUN_H_ 75 #define TESTP(test_suite, test_name, CODE) \ 76 TEST(test_suite, test_name) { \ 79 return HasFailure() ? core::posix::exit::Status::failure \ 80 : core::posix::exit::Status::success; \ 82 auto child = core::posix::fork( \ 84 core::posix::StandardStream::empty); \ 85 auto result = child.wait_for(core::posix::wait::Flags::untraced); \ 86 EXPECT_EQ(core::posix::wait::Result::Status::exited, result.status); \ 87 EXPECT_EQ(core::posix::exit::Status::success, result.detail.if_exited.status); \ 100 #define TESTP_F(test_fixture, test_name, CODE) \ 101 TEST_F(test_fixture, test_name) { \ 102 auto test = [&]() { \ 104 return HasFailure() ? core::posix::exit::Status::failure \ 105 : core::posix::exit::Status::success; \ 107 auto child = core::posix::fork( \ 109 core::posix::StandardStream::empty); \ 110 auto result = child.wait_for(core::posix::wait::Flags::untraced); \ 111 EXPECT_EQ(core::posix::wait::Result::Status::exited, result.status); \ 112 EXPECT_EQ(core::posix::exit::Status::success, result.detail.if_exited.status); \ 115 #endif // CORE_TESTING_FORK_AND_RUN_H_ ForkAndRunResult
The ForkAndRunResult enum models the different failure modes of fork_and_run.
#define CORE_POSIX_DLL_PUBLIC
Status
The Status enum wrap's the posix exit status.
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.
Special value indicating no bit being set.
CORE_POSIX_DLL_PUBLIC ForkAndRunResult operator&(ForkAndRunResult lhs, ForkAndRunResult rhs)
CORE_POSIX_DLL_PUBLIC ForkAndRunResult operator|(ForkAndRunResult lhs, ForkAndRunResult rhs)