From 3114ff2b9b72640bdbbaacd97f1a712915d82209 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Sat, 8 Oct 2016 19:29:39 -0700 Subject: Added timefs[12] examples. These examplesdemonstrate the use of the `fuse_lowlevel_notify_store` and `fuse_lowlevel_notify_inval_inode` functions. --- test/test_examples.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'test') 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: -- cgit v1.2.3