qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: zhujun2 <zhujun2@cmss.chinamobile.com>
Cc: lvivier@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] tests/qtest: remove unused variables
Date: Wed, 15 Nov 2023 09:08:36 +0100	[thread overview]
Message-ID: <c1b546d4-bcc6-4108-bcd9-432b1f6a737c@redhat.com> (raw)
In-Reply-To: <20231115080014.12273-1-zhujun2@cmss.chinamobile.com>

On 15/11/2023 09.00, zhujun2 wrote:
> These variables are never referenced in the code, just remove them
> 
> Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
> ---
>   tests/qtest/test-filter-mirror.c     | 2 +-
>   tests/qtest/test-filter-redirector.c | 4 ++--
>   tests/qtest/virtio-net-test.c        | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c
> index adeada3eb8..7aa81daa93 100644
> --- a/tests/qtest/test-filter-mirror.c
> +++ b/tests/qtest/test-filter-mirror.c
> @@ -60,7 +60,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);
> +    recv(recv_sock[0], recv_buf, len, 0);
>       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..e4dfeff2e0 100644
> --- a/tests/qtest/test-filter-redirector.c
> +++ b/tests/qtest/test-filter-redirector.c
> @@ -117,7 +117,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);
> +    recv(recv_sock, recv_buf, len, 0);
>       g_assert_cmpstr(recv_buf, ==, send_buf);
>   
>       g_free(recv_buf);
> @@ -184,7 +184,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);
> +    recv(backend_sock[0], recv_buf, len, 0);
>       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..26df5bbabe 100644
> --- a/tests/qtest/virtio-net-test.c
> +++ b/tests/qtest/virtio-net-test.c
> @@ -90,7 +90,7 @@ static void tx_test(QVirtioDevice *dev,
>       g_assert_cmpint(ret, ==, sizeof(len));
>       len = ntohl(len);
>   
> -    ret = recv(socket, buffer, len, 0);
> +    recv(socket, buffer, len, 0);
>       g_assert_cmpstr(buffer, ==, "TEST");
>   }

Wouldn't it be better to check the ret value for success?

  Thomas




  reply	other threads:[~2023-11-15  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  8:00 [PATCH] tests/qtest: remove unused variables zhujun2
2023-11-15  8:08 ` Thomas Huth [this message]
2023-11-16  2:14 ` Zhang, Chen
2023-11-21  6:16   ` [PATCH] tests/qtest: check the return value zhujun2
2023-11-21  6:41     ` Thomas Huth
2023-11-21  8:08       ` Zhu Jun
2023-11-21  8:19         ` Thomas Huth
2023-11-21  7:09     ` Zhang, Chen

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=c1b546d4-bcc6-4108-bcd9-432b1f6a737c@redhat.com \
    --to=thuth@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).