aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-15 16:09:16 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-15 16:49:23 -0700
commitd49f2e77b4741706ec125cc62ea913ed5d39bd39 (patch)
treeecdb3d8c7aad836d43844333b87139a105bf1171 /test
parent587df370419e641ed47489f08069ad5f4ca4fe5f (diff)
Unify handling of fuse_conn_info options
Instead of using command line options to modify struct fuse_conn_info before and after calling the init() handler, we now give the file system explicit control over this.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py15
-rw-r--r--test/test_write_cache.c12
2 files changed, 16 insertions, 11 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index a8064c3..8868a98 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -29,11 +29,8 @@ def name_generator(__ctr=[0]):
__ctr[0] += 1
return 'testfile_%d' % __ctr[0]
-LL_OPTIONS = [ ['-o', 'splice_move,splice_write,splice_read' ],
- ['-o', 'clone_fd,writeback_cache' ] ]
-
@pytest.mark.parametrize("name", ('hello', 'hello_ll'))
-@pytest.mark.parametrize("options", LL_OPTIONS)
+@pytest.mark.parametrize("options", ([], ['-o', 'clone_fd']))
def test_hello(tmpdir, name, options):
mnt_dir = str(tmpdir)
cmdline = base_cmdline + \
@@ -63,14 +60,13 @@ def test_hello(tmpdir, name, options):
@pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh',
'passthrough_ll'))
-@pytest.mark.parametrize("options", LL_OPTIONS)
-def test_passthrough(tmpdir, name, options):
+def test_passthrough(tmpdir, name):
mnt_dir = str(tmpdir.mkdir('mnt'))
src_dir = str(tmpdir.mkdir('src'))
cmdline = base_cmdline + \
[ pjoin(basename, 'example', name),
- '-f', mnt_dir ] + options
+ '-f', mnt_dir ]
if not name.endswith('_ll'):
cmdline += [ '-o', 'use_ino,readdir_ino,kernel_cache' ]
mount_process = subprocess.Popen(cmdline)
@@ -146,13 +142,12 @@ def test_poll(tmpdir):
@pytest.mark.parametrize("name",
('notify_inval_inode',
'notify_store_retrieve'))
-@pytest.mark.parametrize("options", LL_OPTIONS)
@pytest.mark.parametrize("notify", (True, False))
-def test_notify1(tmpdir, name, options, notify):
+def test_notify1(tmpdir, name, notify):
mnt_dir = str(tmpdir)
cmdline = base_cmdline + \
[ pjoin(basename, 'example', name),
- '-f', '--update-interval=1', mnt_dir ] + options
+ '-f', '--update-interval=1', mnt_dir ]
if not notify:
cmdline.append('--no-notify')
mount_process = subprocess.Popen(cmdline)
diff --git a/test/test_write_cache.c b/test/test_write_cache.c
index d2f7004..137cb8d 100644
--- a/test/test_write_cache.c
+++ b/test/test_write_cache.c
@@ -39,11 +39,20 @@ struct options {
static const struct fuse_opt option_spec[] = {
OPTION("writeback_cache", writeback),
OPTION("--data-size=%d", data_size),
- FUSE_OPT_KEY("writeback_cache", FUSE_OPT_KEY_KEEP),
FUSE_OPT_END
};
static int got_write;
+static void tfs_init (void *userdata, struct fuse_conn_info *conn)
+{
+ (void) userdata;
+
+ if(options.writeback) {
+ assert(conn->capable & FUSE_CAP_WRITEBACK_CACHE);
+ conn->want |= FUSE_CAP_WRITEBACK_CACHE;
+ }
+}
+
static int tfs_stat(fuse_ino_t ino, struct stat *stbuf) {
stbuf->st_ino = ino;
if (ino == FUSE_ROOT_ID) {
@@ -126,6 +135,7 @@ static void tfs_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
}
static struct fuse_lowlevel_ops tfs_oper = {
+ .init = tfs_init,
.lookup = tfs_lookup,
.getattr = tfs_getattr,
.open = tfs_open,