Previous: process child only, Up: process [Contents][Index]
The following API allows us to run a test function in a child process and a test function in the parent process. Example:
static cctests_parent_process_function_t parent_function; static cctests_child_process_function_t child_function; void test_1_1 (cce_destination_t upper_L) { cctests_with_parent_and_child_process(upper_L, parent_function, child_function); } static void parent_function (cce_destination_t L, int64_t child_pid) /* This runs in the parent. */ { cctests_assert(L, true); } static void child_function (cce_destination_t L) /* This runs in the child. */ { cctests_assert(L, true); }
This API is especially useful when we want two processes to exchange messages through pipes or sockets, or to send interprocess signals to each other.
Type of function to call in a parent process.
Type of function to call in a subprocess.
Fork a process:
_exit()
. The child function might terminate the subprocess by itself.
Previous: process child only, Up: process [Contents][Index]
This document describes version 0.4.1-devel.1 of CCTests.