Commit 778e7b5a authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[master] Provide more info on failure

parent bef9fc00
...@@ -57,7 +57,7 @@ namespace { ...@@ -57,7 +57,7 @@ namespace {
/* Provide even nice error message. */ \ /* Provide even nice error message. */ \
ASSERT_GE(socket, 0) << "Couldn't create a socket of type " \ ASSERT_GE(socket, 0) << "Couldn't create a socket of type " \
#SOCK_TYPE " and family " #ADDR_FAMILY ", failed with " \ #SOCK_TYPE " and family " #ADDR_FAMILY ", failed with " \
<< socket << " and errno " << errno; \ << socket << " and error " << strerror(errno); \
CHECK_SOCK(ADDR_TYPE, socket); \ CHECK_SOCK(ADDR_TYPE, socket); \
EXPECT_EQ(0, close(socket)); \ EXPECT_EQ(0, close(socket)); \
} while (0) } while (0)
...@@ -79,9 +79,13 @@ namespace { ...@@ -79,9 +79,13 @@ namespace {
\ \
socklen_t len = sizeof addr; \ socklen_t len = sizeof addr; \
ASSERT_EQ(0, getsockname(SOCKET, addr_ptr, &len)); \ ASSERT_EQ(0, getsockname(SOCKET, addr_ptr, &len)); \
ASSERT_EQ(5, sendto(SOCKET, "test", 5, 0, addr_ptr, sizeof addr)); \ ASSERT_EQ(5, sendto(SOCKET, "test", 5, 0, addr_ptr, sizeof addr)) << \
"Send failed with error " << strerror(errno) << " on socket " << \
SOCKET; \
char buffer[5]; \ char buffer[5]; \
ASSERT_EQ(5, recv(SOCKET, buffer, 5, 0)); \ ASSERT_EQ(5, recv(SOCKET, buffer, 5, 0)) << \
"Recv failed with error " << strerror(errno) << " on socket " << \
SOCKET; \
EXPECT_STREQ("test", buffer); \ EXPECT_STREQ("test", buffer); \
} while (0) } while (0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment