summaryrefslogtreecommitdiffhomepage
path: root/test/util/logging.cc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-01-28 18:22:54 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-28 18:24:58 -0800
commit9cc2570ea74c678238ed82d044cfecbfe62c5981 (patch)
tree86219712921af2a160b93167ad0908b721990553 /test/util/logging.cc
parent8d1afb4185789cce7a90e7dc365e4a7afda9a8fc (diff)
Change EXPECT/ASSERT to TEST_CHECK inside InForkedProcess
PiperOrigin-RevId: 354441239
Diffstat (limited to 'test/util/logging.cc')
-rw-r--r--test/util/logging.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/util/logging.cc b/test/util/logging.cc
index 5d5e76c46..5fadb076b 100644
--- a/test/util/logging.cc
+++ b/test/util/logging.cc
@@ -69,9 +69,7 @@ int WriteNumber(int fd, uint32_t val) {
} // namespace
void CheckFailure(const char* cond, size_t cond_size, const char* msg,
- size_t msg_size, bool include_errno) {
- int saved_errno = errno;
-
+ size_t msg_size, int errno_value) {
constexpr char kCheckFailure[] = "Check failed: ";
Write(2, kCheckFailure, sizeof(kCheckFailure) - 1);
Write(2, cond, cond_size);
@@ -81,10 +79,10 @@ void CheckFailure(const char* cond, size_t cond_size, const char* msg,
Write(2, msg, msg_size);
}
- if (include_errno) {
+ if (errno_value != 0) {
constexpr char kErrnoMessage[] = " (errno ";
Write(2, kErrnoMessage, sizeof(kErrnoMessage) - 1);
- WriteNumber(2, saved_errno);
+ WriteNumber(2, errno_value);
Write(2, ")", 1);
}