diff options
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) |