diff mbox series

[v2,12/15] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES

Message ID 20220524154056.2896913-13-alex.bennee@linaro.org
State Superseded
Headers show
Series virtio-gpio and various virtio cleanups | expand

Commit Message

Alex Bennée May 24, 2022, 3:40 p.m. UTC
checkpatch.pl warns that non-plain asserts should be avoided so
convert the check to a plain g_assert.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/qtest/vhost-user-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Thomas Huth June 2, 2022, 4:26 p.m. UTC | #1
On 24/05/2022 17.40, Alex Bennée wrote:
> checkpatch.pl warns that non-plain asserts should be avoided so
> convert the check to a plain g_assert.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   tests/qtest/vhost-user-test.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
> index d0fa034601..db18e0b664 100644
> --- a/tests/qtest/vhost-user-test.c
> +++ b/tests/qtest/vhost-user-test.c
> @@ -980,8 +980,7 @@ static void test_multiqueue(void *obj, void *arg, QGuestAllocator *alloc)
>   static void vu_net_set_features(TestServer *s, CharBackend *chr,
>           VhostUserMsg *msg)
>   {
> -    g_assert_cmpint(msg->payload.u64 &
> -            (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=, 0ULL);
> +    g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
>       if (s->test_flags == TEST_FLAGS_DISCONNECT) {
>           qemu_chr_fe_disconnect(chr);
>           s->test_flags = TEST_FLAGS_BAD;

Why this? commit 6e9389563 says that this should not trigger for code in 
tests/ , so I wonder why you ran into this checkpatch warning?

  Thomas
diff mbox series

Patch

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index d0fa034601..db18e0b664 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -980,8 +980,7 @@  static void test_multiqueue(void *obj, void *arg, QGuestAllocator *alloc)
 static void vu_net_set_features(TestServer *s, CharBackend *chr,
         VhostUserMsg *msg)
 {
-    g_assert_cmpint(msg->payload.u64 &
-            (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=, 0ULL);
+    g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
     if (s->test_flags == TEST_FLAGS_DISCONNECT) {
         qemu_chr_fe_disconnect(chr);
         s->test_flags = TEST_FLAGS_BAD;