From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Cc: Zhu Jun <zhujun2@cmss.chinamobile.com>
Subject: [PULL 3/3] tests/qtest: check the return value
Date: Mon, 4 Dec 2023 15:25:32 +0100 [thread overview]
Message-ID: <20231204142532.581730-4-thuth@redhat.com> (raw)
In-Reply-To: <20231204142532.581730-1-thuth@redhat.com>
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
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>
---
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 adeada3eb8..f3865f7519 100644
--- a/tests/qtest/test-filter-mirror.c
+++ b/tests/qtest/test-filter-mirror.c
@@ -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);
diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c
index e72e3b7873..a77d5fd8ec 100644
--- a/tests/qtest/test-filter-redirector.c
+++ b/tests/qtest/test-filter-redirector.c
@@ -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);
diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
index fab5dd8b05..2df75c9780 100644
--- a/tests/qtest/virtio-net-test.c
+++ b/tests/qtest/virtio-net-test.c
@@ -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");
}
--
2.42.0
next prev parent reply other threads:[~2023-12-04 14:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 14:25 [PULL 0/3] Misc patches for QEMU 8.2-rc3 Thomas Huth
2023-12-04 14:25 ` [PULL 1/3] tests/qemu-iotests/149: Use more inclusive language in this test Thomas Huth
2023-12-04 14:25 ` [PULL 2/3] sh4: Coding style: Remove tabs Thomas Huth
2023-12-04 14:25 ` Thomas Huth [this message]
2023-12-05 12:33 ` [PULL 0/3] Misc patches for QEMU 8.2-rc3 Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231204142532.581730-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=zhujun2@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.