This is called from a death test parent process to read a failure message from the death test child process and log it with the FATAL severity. On Windows, the message is read from a pipe handle. On other platforms, it is read from a file descriptor.
| 6466 | // severity. On Windows, the message is read from a pipe handle. On other |
| 6467 | // platforms, it is read from a file descriptor. |
| 6468 | static void FailFromInternalError(int fd) { |
| 6469 | Message error; |
| 6470 | char buffer[256]; |
| 6471 | int num_read; |
| 6472 | |
| 6473 | do { |
| 6474 | while ((num_read = posix::Read(fd, buffer, 255)) > 0) { |
| 6475 | buffer[num_read] = '\0'; |
| 6476 | error << buffer; |
| 6477 | } |
| 6478 | } while (num_read == -1 && errno == EINTR); |
| 6479 | |
| 6480 | if (num_read == 0) { |
| 6481 | GTEST_LOG_(FATAL) << error.GetString(); |
| 6482 | } else { |
| 6483 | const int last_error = errno; |
| 6484 | GTEST_LOG_(FATAL) << "Error while reading death test internal: " |
| 6485 | << GetLastErrnoDescription() << " [" << last_error << "]"; |
| 6486 | } |
| 6487 | } |
| 6488 | |
| 6489 | // Death test constructor. Increments the running death test count |
| 6490 | // for the current test. |
no test coverage detected