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.
| 7941 | // severity. On Windows, the message is read from a pipe handle. On other |
| 7942 | // platforms, it is read from a file descriptor. |
| 7943 | static void FailFromInternalError(int fd) { |
| 7944 | Message error; |
| 7945 | char buffer[256]; |
| 7946 | int num_read; |
| 7947 | |
| 7948 | do { |
| 7949 | while ((num_read = posix::Read(fd, buffer, 255)) > 0) { |
| 7950 | buffer[num_read] = '\0'; |
| 7951 | error << buffer; |
| 7952 | } |
| 7953 | } while (num_read == -1 && errno == EINTR); |
| 7954 | |
| 7955 | if (num_read == 0) { |
| 7956 | GTEST_LOG_(FATAL) << error.GetString(); |
| 7957 | } else { |
| 7958 | const int last_error = errno; |
| 7959 | GTEST_LOG_(FATAL) << "Error while reading death test internal: " |
| 7960 | << GetLastErrnoDescription() << " [" << last_error << "]"; |
| 7961 | } |
| 7962 | } |
| 7963 | |
| 7964 | // Death test constructor. Increments the running death test count |
| 7965 | // for the current test. |
no test coverage detected