aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-04 22:38:03 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-06 10:13:43 +0200
commitb3109e71faf2713402f70d226617352815f6c72e (patch)
tree46d878cf848256eb420ccf66af20fa9faa269e2b /test
parent53c07425fa378eedb9b38c05025da5832d7a3a2e (diff)
Added writeback cache to passthrough_ll
This fixes issue #191 (where the test was done by simply adding FUSE_CAP_WRITEBACK_CACHE without adjusting the flags in the open() call). Fixes: #191.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py80
1 files changed, 59 insertions, 21 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index 61ebffd..f9badad 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -60,8 +60,48 @@ def test_hello(tmpdir, name, options):
else:
umount(mount_process, mnt_dir)
-@pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh',
- 'passthrough_ll'))
+@pytest.mark.parametrize("writeback", (False, True))
+@pytest.mark.parametrize("debug", (False, True))
+def test_passthrough_ll(tmpdir, writeback, debug, capfd):
+
+ # Avoid false positives from libfuse debug messages
+ if debug:
+ capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$',
+ count=0)
+
+ mnt_dir = str(tmpdir.mkdir('mnt'))
+ src_dir = str(tmpdir.mkdir('src'))
+
+ cmdline = base_cmdline + \
+ [ pjoin(basename, 'example', 'passthrough_ll'),
+ '-f', mnt_dir ]
+ if debug:
+ cmdline.append('-d')
+
+ if writeback:
+ cmdline.append('-o')
+ cmdline.append('writeback')
+
+ mount_process = subprocess.Popen(cmdline)
+ try:
+ wait_for_mount(mount_process, mnt_dir)
+ work_dir = mnt_dir + src_dir
+
+ tst_statvfs(work_dir)
+ tst_readdir(src_dir, work_dir)
+ tst_open_read(src_dir, work_dir)
+ tst_open_write(src_dir, work_dir)
+ tst_create(work_dir)
+ tst_passthrough(src_dir, work_dir)
+ tst_append(src_dir, work_dir)
+ tst_seek(src_dir, work_dir)
+ except:
+ cleanup(mnt_dir)
+ raise
+ else:
+ umount(mount_process, mnt_dir)
+
+@pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh'))
@pytest.mark.parametrize("debug", (False, True))
def test_passthrough(tmpdir, name, debug, capfd):
@@ -70,7 +110,6 @@ def test_passthrough(tmpdir, name, debug, capfd):
capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$',
count=0)
- is_ll = (name == 'passthrough_ll')
mnt_dir = str(tmpdir.mkdir('mnt'))
src_dir = str(tmpdir.mkdir('src'))
@@ -92,24 +131,23 @@ def test_passthrough(tmpdir, name, debug, capfd):
tst_passthrough(src_dir, work_dir)
tst_append(src_dir, work_dir)
tst_seek(src_dir, work_dir)
- if not is_ll:
- tst_mkdir(work_dir)
- tst_rmdir(src_dir, work_dir)
- tst_unlink(src_dir, work_dir)
- tst_symlink(work_dir)
- if os.getuid() == 0:
- tst_chown(work_dir)
-
- # Underlying fs may not have full nanosecond resolution
- tst_utimens(work_dir, ns_tol=1000)
-
- tst_link(work_dir)
- tst_truncate_path(work_dir)
- tst_truncate_fd(work_dir)
- tst_open_unlink(work_dir)
-
- subprocess.check_call([ os.path.join(basename, 'test', 'test_syscalls'),
- work_dir, ':' + src_dir ])
+ tst_mkdir(work_dir)
+ tst_rmdir(src_dir, work_dir)
+ tst_unlink(src_dir, work_dir)
+ tst_symlink(work_dir)
+ if os.getuid() == 0:
+ tst_chown(work_dir)
+
+ # Underlying fs may not have full nanosecond resolution
+ tst_utimens(work_dir, ns_tol=1000)
+
+ tst_link(work_dir)
+ tst_truncate_path(work_dir)
+ tst_truncate_fd(work_dir)
+ tst_open_unlink(work_dir)
+
+ subprocess.check_call([ os.path.join(basename, 'test', 'test_syscalls'),
+ work_dir, ':' + src_dir ])
except:
cleanup(mnt_dir)
raise