Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests/qtest: check the return value
These variables "ret" are never referenced in the code, thus
add check logic for the "ret"

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20231121080802.4500-1-zhujun2@cmss.chinamobile.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
Zhu Jun authored and huth committed Dec 4, 2023
1 parent 5533936 commit 4d98618
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/qtest/test-filter-mirror.c
Expand Up @@ -61,6 +61,7 @@ static void test_mirror(void)
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
ret = recv(recv_sock[0], recv_buf, len, 0);
g_assert_cmpint(ret, ==, len);
g_assert_cmpstr(recv_buf, ==, send_buf);

g_free(recv_buf);
Expand Down
2 changes: 2 additions & 0 deletions tests/qtest/test-filter-redirector.c
Expand Up @@ -118,6 +118,7 @@ static void test_redirector_tx(void)
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
ret = recv(recv_sock, recv_buf, len, 0);
g_assert_cmpint(ret, ==, len);
g_assert_cmpstr(recv_buf, ==, send_buf);

g_free(recv_buf);
Expand Down Expand Up @@ -185,6 +186,7 @@ static void test_redirector_rx(void)
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
ret = recv(backend_sock[0], recv_buf, len, 0);
g_assert_cmpint(ret, ==, len);
g_assert_cmpstr(recv_buf, ==, send_buf);

close(send_sock);
Expand Down
1 change: 1 addition & 0 deletions tests/qtest/virtio-net-test.c
Expand Up @@ -91,6 +91,7 @@ static void tx_test(QVirtioDevice *dev,
len = ntohl(len);

ret = recv(socket, buffer, len, 0);
g_assert_cmpint(ret, ==, len);
g_assert_cmpstr(buffer, ==, "TEST");
}

Expand Down

0 comments on commit 4d98618

Please sign in to comment.