diff options
author | SÅ‚awek Rudnicki <slawek.rudnicki@editshare.com> | 2017-08-07 12:41:33 +0200 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2017-08-24 14:20:37 +0200 |
commit | 89f2bae00c1b87580f432f9a719ba8998493e6df (patch) | |
tree | 896d41f64caeef13a4c35f5a6333348067f5dfae /test | |
parent | 4eed36910fa73cfe3fe62530850d427e6841e14f (diff) |
Allow inode cache invalidation in high-level API
We re-introduce the functionality of invalidating the caches for an
inode specified by path by adding a new routine
fuse_invalidate_path. This is useful for network-based file systems
which use the high-level API, enabling them to notify the kernel about
external changes.
This is a revival of Miklos Szeredi's original code for the
fuse_invalidate routine.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_ctests.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/test/test_ctests.py b/test/test_ctests.py index 4ad03fb..2da55e5 100644 --- a/test/test_ctests.py +++ b/test/test_ctests.py @@ -13,6 +13,7 @@ from distutils.version import LooseVersion from util import (wait_for_mount, umount, cleanup, base_cmdline, safe_sleep, basename, fuse_test_marker) from os.path import join as pjoin +import os.path pytestmark = fuse_test_marker() @@ -34,7 +35,7 @@ def test_write_cache(tmpdir, writeback): subprocess.check_call(cmdline) -names = [ 'notify_inval_inode' ] +names = [ 'notify_inval_inode', 'notify_inval_inode_fh' ] if sys.platform == 'linux': names.append('notify_store_retrieve') @pytest.mark.parametrize("name", names) @@ -65,4 +66,27 @@ def test_notify1(tmpdir, name, notify): else: umount(mount_process, mnt_dir) - +@pytest.mark.parametrize("notify", (True, False)) +def test_notify_file_size(tmpdir, notify): + mnt_dir = str(tmpdir) + cmdline = base_cmdline + \ + [ pjoin(basename, 'example', 'notify_inval_inode_fh'), + '-f', '--update-interval=1', mnt_dir ] + if not notify: + cmdline.append('--no-notify') + mount_process = subprocess.Popen(cmdline) + try: + wait_for_mount(mount_process, mnt_dir) + filename = pjoin(mnt_dir, 'growing') + size = os.path.getsize(filename) + safe_sleep(2) + new_size = os.path.getsize(filename) + if notify: + assert new_size > size + else: + assert new_size == size + except: + cleanup(mnt_dir) + raise + else: + umount(mount_process, mnt_dir) |