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>
This commit is contained in:
Zhu Jun 2023-11-21 00:08:02 -08:00 committed by Thomas Huth
parent 5533936127
commit 4d98618b8a
3 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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);
@ -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);

View File

@ -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");
}