79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
From 53e0242318e838013504688307af44e80ab36c70 Mon Sep 17 00:00:00 2001
|
|
From: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
|
Date: Tue, 21 Nov 2023 18:03:25 -0800
|
|
Subject: [PATCH] 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: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
|
---
|
|
tests/qtest/test-filter-mirror.c | 1 +
|
|
tests/qtest/test-filter-redirector.c | 2 ++
|
|
tests/qtest/virtio-net-test.c | 1 +
|
|
3 files changed, 4 insertions(+)
|
|
|
|
diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c
|
|
index bc0dee64dd..40f736734a 100644
|
|
--- a/tests/qtest/test-filter-mirror.c
|
|
+++ b/tests/qtest/test-filter-mirror.c
|
|
@@ -71,6 +71,7 @@ static void test_mirror(void)
|
|
g_assert_cmpint(len, ==, sizeof(send_buf));
|
|
recv_buf = g_malloc(len);
|
|
ret = qemu_recv(recv_sock[0], recv_buf, len, 0);
|
|
+ g_assert_cmpint(ret, ==, len);
|
|
g_assert_cmpstr(recv_buf, ==, send_buf);
|
|
|
|
g_free(recv_buf);
|
|
diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c
|
|
index 4269b2cdd9..f802c94f54 100644
|
|
--- a/tests/qtest/test-filter-redirector.c
|
|
+++ b/tests/qtest/test-filter-redirector.c
|
|
@@ -133,6 +133,7 @@ static void test_redirector_tx(void)
|
|
g_assert_cmpint(len, ==, sizeof(send_buf));
|
|
recv_buf = g_malloc(len);
|
|
ret = qemu_recv(recv_sock, recv_buf, len, 0);
|
|
+ g_assert_cmpint(ret, ==, len);
|
|
g_assert_cmpstr(recv_buf, ==, send_buf);
|
|
|
|
g_free(recv_buf);
|
|
@@ -201,6 +202,7 @@ static void test_redirector_rx(void)
|
|
g_assert_cmpint(len, ==, sizeof(send_buf));
|
|
recv_buf = g_malloc(len);
|
|
ret = qemu_recv(backend_sock[0], recv_buf, len, 0);
|
|
+ g_assert_cmpint(ret, ==, len);
|
|
g_assert_cmpstr(recv_buf, ==, send_buf);
|
|
|
|
close(send_sock);
|
|
diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
|
|
index 8bf74e516c..aab4480fb0 100644
|
|
--- a/tests/qtest/virtio-net-test.c
|
|
+++ b/tests/qtest/virtio-net-test.c
|
|
@@ -92,6 +92,7 @@ static void tx_test(QVirtioDevice *dev,
|
|
len = ntohl(len);
|
|
|
|
ret = qemu_recv(socket, buffer, len, 0);
|
|
+ g_assert_cmpint(ret, ==, len);
|
|
g_assert_cmpstr(buffer, ==, "TEST");
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|