}
}
+static void do_local_xattr_limit(QVirtio9P *v9p, int max_xattr)
+{
+ g_autofree char *test_file = virtio_9p_test_path("WRITE");
+
+ /*
+ * this file must be created for the test to work with the 'local' fs driver
+ */
+ 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);
+}
+
static void fs_walk_no_slash(void *obj, void *data, QGuestAllocator *t_alloc)
{
QVirtio9P *v9p = obj;
g_string_free(path, TRUE);
}
+static void fs_local_xattr_limit_default(void *obj, void *data,
+ QGuestAllocator *t_alloc)
+{
+ v9fs_set_allocator(t_alloc);
+ do_local_xattr_limit(obj, V9FS_MAX_XATTR_DEFAULT);
+}
+
+static void fs_local_xattr_limit_custom(void *obj, void *data,
+ QGuestAllocator *t_alloc)
+{
+ v9fs_set_allocator(t_alloc);
+ do_local_xattr_limit(obj, 100);
+}
+
+static void fs_local_xattr_limit_unlimited(void *obj, void *data,
+ QGuestAllocator *t_alloc)
+{
+ v9fs_set_allocator(t_alloc);
+ do_local_xattr_limit(obj, -1);
+}
+
static void *synth_max_xattr_custom_opt(GString *cmd_line, void *arg)
{
virtio_9p_add_synth_driver_args(cmd_line, "max_xattr=100");
virtio_9p_remove_local_test_dir();
}
-static void *assign_9p_local_driver(GString *cmd_line, void *arg)
+static void assign_9p_local_driver_with_args(GString *cmd_line,
+ const char *extra_opts)
{
/* make sure test dir for the 'local' tests exists */
virtio_9p_create_local_test_dir();
- virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr");
+ g_autofree char *opts =
+ (extra_opts) ?
+ g_strdup_printf("security_model=mapped-xattr,%s", extra_opts) :
+ g_strdup("security_model=mapped-xattr");
+
+ virtio_9p_assign_local_driver(cmd_line, opts);
g_test_queue_destroy(cleanup_9p_local_driver, NULL);
+}
+
+static void *assign_9p_local_driver(GString *cmd_line, void *arg)
+{
+ assign_9p_local_driver_with_args(cmd_line, NULL);
return arg;
}
-static void register_virtio_9p_test(void)
+static void *local_max_xattr_custom_opt(GString *cmd_line, void *arg)
{
+ assign_9p_local_driver_with_args(cmd_line, "max_xattr=100");
+ return arg;
+}
+static void *local_max_xattr_unlimited_opt(GString *cmd_line, void *arg)
+{
+ assign_9p_local_driver_with_args(cmd_line, "max_xattr=0");
+ return arg;
+}
+
+static void register_virtio_9p_test(void)
+{
QOSGraphTestOptions opts = {
};
&opts);
qos_add_test("local/deep_absolute_path", "virtio-9p",
fs_deep_absolute_path, &opts);
+ qos_add_test("local/xattr_limit/default", "virtio-9p",
+ fs_local_xattr_limit_default, &opts);
+ opts.before = local_max_xattr_custom_opt;
+ qos_add_test("local/xattr_limit/custom", "virtio-9p",
+ fs_local_xattr_limit_custom, &opts);
+ opts.before = local_max_xattr_unlimited_opt;
+ qos_add_test("local/xattr_limit/unlimited", "virtio-9p",
+ fs_local_xattr_limit_unlimited, &opts);
}
libqos_init(register_virtio_9p_test);