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.
| 6804 | // severity. On Windows, the message is read from a pipe handle. On other |
| 6805 | // platforms, it is read from a file descriptor. |
| 6806 | static void FailFromInternalError(int fd) { |
| 6807 | Message error; |
| 6808 | char buffer[256]; |
| 6809 | int num_read; |
| 6810 | |
| 6811 | do { |
| 6812 | while ((num_read = posix::Read(fd, buffer, 255)) > 0) { |
| 6813 | buffer[num_read] = '\0'; |
| 6814 | error << buffer; |
| 6815 | } |
| 6816 | } while (num_read == -1 && errno == EINTR); |
| 6817 | |
| 6818 | if (num_read == 0) { |
| 6819 | GTEST_LOG_(FATAL) << error.GetString(); |
| 6820 | } else { |
| 6821 | const int last_error = errno; |
| 6822 | GTEST_LOG_(FATAL) << "Error while reading death test internal: " |
| 6823 | << GetLastErrnoDescription() << " [" << last_error << "]"; |
| 6824 | } |
| 6825 | } |
| 6826 | |
| 6827 | // Death test constructor. Increments the running death test count |
| 6828 | // for the current test. |
no test coverage detected