Browse Source

test: check uv_ip4_addr return value

Fixes Coverity errors.

PR-URL: https://github.com/nodejs/node/pull/13878
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v6
Eugene Ostroukhov 8 years ago
parent
commit
5fbbd25dc4
  1. 2
      test/cctest/test_inspector_socket.cc
  2. 9
      test/cctest/test_inspector_socket_server.cc

2
test/cctest/test_inspector_socket.cc

@ -370,7 +370,7 @@ class InspectorSocketTest : public ::testing::Test {
sockaddr_in addr;
uv_tcp_init(&loop, &server);
uv_tcp_init(&loop, &client_socket);
uv_ip4_addr("127.0.0.1", PORT, &addr);
GTEST_ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", PORT, &addr));
uv_tcp_bind(&server, reinterpret_cast<const struct sockaddr*>(&addr), 0);
GTEST_ASSERT_EQ(0, uv_listen(reinterpret_cast<uv_stream_t*>(&server),
1, on_new_connection));

9
test/cctest/test_inspector_socket_server.cc

@ -194,10 +194,11 @@ class SocketWrapper {
contents_.clear();
uv_tcp_init(loop_, &socket_);
sockaddr_in addr;
uv_ip4_addr(host.c_str(), port, &addr);
int err = uv_tcp_connect(&connect_, &socket_,
reinterpret_cast<const sockaddr*>(&addr),
ConnectionMustFail_);
int err = uv_ip4_addr(host.c_str(), port, &addr);
ASSERT_EQ(0, err);
err = uv_tcp_connect(&connect_, &socket_,
reinterpret_cast<const sockaddr*>(&addr),
ConnectionMustFail_);
ASSERT_EQ(0, err);
SPIN_WHILE(!connection_failed_)
uv_read_start(reinterpret_cast<uv_stream_t*>(&socket_), AllocCallback,

Loading…
Cancel
Save