examples/usrsocktest: correct the check region of remote address

let us skip the sin_zero

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-08-31 22:51:02 +08:00 committed by Xiang Xiao
parent a8d2924c55
commit 5b47bc24ae
2 changed files with 7 additions and 4 deletions

View File

@ -248,7 +248,8 @@ static void no_block_connect(FAR struct usrsocktest_daemon_conf_s *dconf)
TEST_ASSERT_EQUAL(1, ret);
TEST_ASSERT_EQUAL_UINT8_ARRAY("a", data, 1);
TEST_ASSERT_EQUAL(sizeof(remoteaddr), addrlen);
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr, addrlen);
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr,
addrlen - sizeof(addr.sin_zero));
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
TEST_ASSERT_EQUAL(6, usrsocktest_daemon_get_recv_bytes());
@ -265,7 +266,8 @@ static void no_block_connect(FAR struct usrsocktest_daemon_conf_s *dconf)
TEST_ASSERT_EQUAL(5, ret);
TEST_ASSERT_EQUAL_UINT8_ARRAY("abcde", data, 5);
TEST_ASSERT_EQUAL(sizeof(remoteaddr), addrlen);
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr, addrlen);
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr,
addrlen - sizeof(addr.sin_zero));
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
TEST_ASSERT_EQUAL(11, usrsocktest_daemon_get_recv_bytes());

View File

@ -180,7 +180,8 @@ static void receive(struct usrsocktest_daemon_conf_s *dconf)
TEST_ASSERT_EQUAL(3, ret);
TEST_ASSERT_EQUAL_UINT8_ARRAY("abc", data, 3);
TEST_ASSERT_EQUAL(addrlen, sizeof(remoteaddr));
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr, addrlen);
TEST_ASSERT_EQUAL_UINT8_ARRAY(&remoteaddr, &addr,
addrlen - sizeof(addr.sin_zero));
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
TEST_ASSERT_EQUAL(datalen + ret, usrsocktest_daemon_get_recv_bytes());
@ -365,7 +366,7 @@ static void delayed_connect(struct usrsocktest_daemon_conf_s *dconf)
&addrlen);
TEST_ASSERT_EQUAL(-1, ret);
TEST_ASSERT_EQUAL(EAGAIN, errno);
TEST_ASSERT_EQUAL(0, addrlen);
TEST_ASSERT_EQUAL(sizeof(remoteaddr), addrlen);
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());