MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / DeathTestAbort

Function DeathTestAbort

rtpose_wrapper/src/gtest/gtest-all.cpp:6409–6426  ·  view source on GitHub ↗

Routine for aborting the program which is safe to call from an exec-style death test child process, in which case the error message is propagated back to the parent process. Otherwise, the message is simply printed to stderr. In either case, the program then exits with status 1.

Source from the content-addressed store, hash-verified

6407// message is simply printed to stderr. In either case, the program
6408// then exits with status 1.
6409void DeathTestAbort(const String& message) {
6410 // On a POSIX system, this function may be called from a threadsafe-style
6411 // death test child process, which operates on a very small stack. Use
6412 // the heap for any additional non-minuscule memory requirements.
6413 const InternalRunDeathTestFlag* const flag =
6414 GetUnitTestImpl()->internal_run_death_test_flag();
6415 if (flag != NULL) {
6416 FILE* parent = posix::FDOpen(flag->write_fd(), "w");
6417 fputc(kDeathTestInternalError, parent);
6418 fprintf(parent, "%s", message.c_str());
6419 fflush(parent);
6420 _exit(1);
6421 } else {
6422 fprintf(stderr, "%s", message.c_str());
6423 fflush(stderr);
6424 posix::Abort();
6425 }
6426}
6427
6428// A replacement for CHECK that calls DeathTestAbort if the assertion
6429// fails.

Callers 4

DeathTestMethod · 0.85
ExecDeathTestChildMainFunction · 0.85
GetStatusFileDescriptorFunction · 0.85

Calls 4

GetUnitTestImplFunction · 0.85
FDOpenFunction · 0.85
AbortFunction · 0.70
write_fdMethod · 0.45

Tested by

no test coverage detected