Crashpad
|
Manages an exec()
-based multiprocess test.
More...
#include "test/multiprocess_exec.h"
Public Member Functions | |
void | SetChildCommand (const std::string &command, const std::vector< std::string > *arguments) |
Sets the command to exec() in the child. More... | |
![]() | |
void | Run () |
Runs the test. More... | |
void | SetExpectedChildTermination (TerminationReason reason, int code) |
Sets the expected termination reason and code. More... | |
Protected Member Functions | |
void | PreFork () override |
Establishes the proper testing environment prior to forking. More... | |
![]() | |
pid_t | ChildPID () const |
Returns the child process’ process ID. More... | |
FileHandle | ReadPipeHandle () const |
Returns the read pipe’s file handle. More... | |
FileHandle | WritePipeHandle () const |
Returns the write pipe’s file handle. More... | |
void | CloseReadPipe () |
Closes the read pipe. More... | |
void | CloseWritePipe () |
Closes the write pipe. More... | |
void | set_info (internal::MultiprocessInfo *info) |
internal::MultiprocessInfo * | info () |
Additional Inherited Members | |
![]() | |
enum | TerminationReason : bool |
The termination type for a child process. More... | |
Manages an exec()
-based multiprocess test.
These tests are based on fork()
and exec()
. The parent process is able to communicate with the child in the same manner as a base-class Multiprocess parent. The read and write pipes appear in the child process on stdin and stdout, respectively.
Subclasses are expected to implement the parent in the same was as a base-class Multiprocess parent. The child must be implemented in an executable to be set by SetChildCommand().
|
overrideprotectedvirtual |
Establishes the proper testing environment prior to forking.
Subclasses that solely implement a test should not need to override this method. Subclasses that do not implement tests but instead implement additional testing features on top of this class may override this method provided that they call the superclass’ implementation first as follows:
Subclass implementations may signal failure by raising their own fatal gtest assertions.
Reimplemented from crashpad::test::Multiprocess.
void crashpad::test::MultiprocessExec::SetChildCommand | ( | const std::string & | command, |
const std::vector< std::string > * | arguments | ||
) |
Sets the command to exec()
in the child.
This method must be called before the test can be Run().
[in] | command | The executable’s pathname. |
[in] | arguments | The command-line arguments to pass to the child process in its argv[] vector. This vector must begin at argv[1] , as command is implicitly used as argv[0] . This argument may be nullptr if no command-line arguments are to be passed. |