Skip to contentSkip to conversation

tests/9p: prevent potential error in do_local_xattr_limit()

PATCH In review Christian Schoenebeck 3 participants 5 messages Jul 3 – Jul 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/9p: prevent potential error in do_local_xattr_limit()

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

---
 tests/qtest/virtio-9p-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/virtio-9p-test.c +1 -1
index cfd3c02da4..692a0e8e3f 100644
@@ -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);
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Christian Schoenebeck

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.

Quoted 8 lines

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

---
  tests/qtest/virtio-9p-test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Christian Schoenebeck
Quoted 8 lines · Christian Schoenebeck

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.

Quoted 9 lines

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

---
 tests/qtest/virtio-9p-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Tested-by on v1 1/1
#3 lore raw
In reply to Christian Schoenebeck
Quoted 8 lines · Christian Schoenebeck

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.

Quoted 8 lines

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

---
  tests/qtest/virtio-9p-test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
#4 lore raw
In reply to Christian Schoenebeck
Quoted 8 lines · On Friday, 3 July 2026 17:38:10 CEST Christian Schoenebeck wrote:

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.

Quoted 8 lines

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

---
 tests/qtest/virtio-9p-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Queued on 9p.next:
https://github.com/cschoenebeck/qemu/commits/9p.next

Thanks!

/Christian