MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / DeathTestAbort

Function DeathTestAbort

tests/gtest/gtest-all.cc:7882–7899  ·  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

7880// message is simply printed to stderr. In either case, the program
7881// then exits with status 1.
7882static void DeathTestAbort(const std::string& message) {
7883 // On a POSIX system, this function may be called from a threadsafe-style
7884 // death test child process, which operates on a very small stack. Use
7885 // the heap for any additional non-minuscule memory requirements.
7886 const InternalRunDeathTestFlag* const flag =
7887 GetUnitTestImpl()->internal_run_death_test_flag();
7888 if (flag != nullptr) {
7889 FILE* parent = posix::FDOpen(flag->write_fd(), "w");
7890 fputc(kDeathTestInternalError, parent);
7891 fprintf(parent, "%s", message.c_str());
7892 fflush(parent);
7893 _exit(1);
7894 } else {
7895 fprintf(stderr, "%s", message.c_str());
7896 fflush(stderr);
7897 posix::Abort();
7898 }
7899}
7900
7901// A replacement for CHECK that calls DeathTestAbort if the assertion
7902// fails.

Callers 5

DeathTestMethod · 0.85
ExecDeathTestChildMainFunction · 0.85
ExecDeathTestSpawnChildFunction · 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