From 89f2bae00c1b87580f432f9a719ba8998493e6df Mon Sep 17 00:00:00 2001 From: SÅ‚awek Rudnicki Date: Mon, 7 Aug 2017 12:41:33 +0200 Subject: 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. --- test/test_ctests.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'test') 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) -- cgit v1.2.3