aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-08 19:29:39 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-08 21:27:04 -0700
commit3114ff2b9b72640bdbbaacd97f1a712915d82209 (patch)
treeaf18d4b4dfa7f2409ae5b992815867a9f162d4b1 /test
parentba0462e4012205d639dfdc9e13fb66c2afef6f3b (diff)
Added timefs[12] examples.
These examplesdemonstrate the use of the `fuse_lowlevel_notify_store` and `fuse_lowlevel_notify_inval_inode` functions.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index 226835f..a3c234f 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -14,7 +14,8 @@ import shutil
import filecmp
import errno
from tempfile import NamedTemporaryFile
-from util import wait_for_mount, umount, cleanup, base_cmdline
+from util import (wait_for_mount, umount, cleanup, base_cmdline,
+ safe_sleep)
from os.path import join as pjoin
basename = pjoin(os.path.dirname(__file__), '..')
@@ -168,6 +169,35 @@ def test_fsel(tmpdir):
else:
umount(mount_process, mnt_dir)
+@pytest.mark.parametrize("name", ('timefs1', 'timefs2'))
+@pytest.mark.parametrize("options", LL_OPTIONS)
+@pytest.mark.parametrize("notify", (True, False))
+def test_timefs(tmpdir, name, options, notify):
+ mnt_dir = str(tmpdir)
+ cmdline = base_cmdline + \
+ [ pjoin(basename, 'example', name),
+ '-f', '--update-interval=1', mnt_dir ] + options
+ if not notify:
+ cmdline.append('--no-notify')
+ mount_process = subprocess.Popen(cmdline)
+ try:
+ wait_for_mount(mount_process, mnt_dir)
+ filename = pjoin(mnt_dir, 'current_time')
+ with open(filename, 'r') as fh:
+ read1 = fh.read()
+ safe_sleep(2)
+ with open(filename, 'r') as fh:
+ read2 = fh.read()
+ if notify:
+ assert read1 != read2
+ else:
+ assert read1 == read2
+ except:
+ cleanup(mnt_dir)
+ raise
+ else:
+ umount(mount_process, mnt_dir)
+
def checked_unlink(filename, path, isdir=False):
fullname = pjoin(path, filename)
if isdir: