@samitouri / QOSamiQemu / commits / 7858dbb367

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 Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/E1wfg2F-001Sfn-Rr@kylie.crudebyte.com Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

Christian Schoenebeck committed Jul 3, 2026 at 17:38 UTC 7858dbb36710edbb9697286a925e170effd9e879
1 file changed +1 -1
tests/qtest/virtio-9p-test.c
+1 -1
@@ -402,7 +402,7 @@ static void do_local_xattr_limit(QVirtio9P *v9p, int max_xattr)
402 /*
403 * this file must be created for the test to work with the 'local' fs driver
404 */
405 - g_file_set_contents(test_file, "", 0, NULL);
405 + g_assert(g_file_set_contents(test_file, "", 0, NULL));
406
407 /* the actual test code shared with the 'synth' fs driver tests */
408 do_xattr_limit(v9p, max_xattr, false);