All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, Greg Kurz <groug@kaod.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH] tests/9p: prevent potential error in do_local_xattr_limit()
Date: Fri, 3 Jul 2026 17:38:10 +0200	[thread overview]
Message-ID: <E1wfg2F-001Sfn-Rr@kylie.crudebyte.com> (raw)

The local fs backend driver tests require that a dummy file is
created on the host side before running the xattr limit tests,
otherwise the test will fail because the file is expected to exist.

The original call of g_file_set_contents() didn't check its
return value, which might cause subsequent test checks to fail,
making it harder to identify the root cause.

Fix this by simply wrapping the call into a g_assert().

Fixes: 04a62cdfe873 ("tests/9p: add 3 xattr FID limit test cases (local fs driver)")
CID: 1660926
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
 tests/qtest/virtio-9p-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
index cfd3c02da4..692a0e8e3f 100644
--- a/tests/qtest/virtio-9p-test.c
+++ b/tests/qtest/virtio-9p-test.c
@@ -402,7 +402,7 @@ static void do_local_xattr_limit(QVirtio9P *v9p, int max_xattr)
     /*
      * this file must be created for the test to work with the 'local' fs driver
      */
-    g_file_set_contents(test_file, "", 0, NULL);
+    g_assert(g_file_set_contents(test_file, "", 0, NULL));
 
     /* the actual test code shared with the 'synth' fs driver tests */
     do_xattr_limit(v9p, max_xattr, false);
-- 
2.47.3



             reply	other threads:[~2026-07-03 15:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 15:38 Christian Schoenebeck [this message]
2026-07-06  6:57 ` [PATCH] tests/9p: prevent potential error in do_local_xattr_limit() Philippe Mathieu-Daudé
2026-07-06 21:10 ` Pierrick Bouvier
2026-07-06 21:14 ` Philippe Mathieu-Daudé
2026-07-07 17:17 ` Christian Schoenebeck

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=E1wfg2F-001Sfn-Rr@kylie.crudebyte.com \
    --to=qemu_oss@crudebyte.com \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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.