diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-08 21:24:13 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-08 21:27:06 -0700 |
commit | 9f19d71a766af5881cf763e6ce8d6c1bafe8ada5 (patch) | |
tree | e405152df3e8a12056f344fa1926ce50f6e65d53 /test | |
parent | 56690972af25a1fbc60c18c58f757636c0ef0312 (diff) |
Added timefs3 to test notify_inval_entry.
Fixes #32.
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_examples.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/test_examples.py b/test/test_examples.py index a3c234f..ef4932c 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -172,7 +172,7 @@ def test_fsel(tmpdir): @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): +def test_timefs12(tmpdir, name, options, notify): mnt_dir = str(tmpdir) cmdline = base_cmdline + \ [ pjoin(basename, 'example', name), @@ -198,6 +198,38 @@ def test_timefs(tmpdir, name, options, notify): else: umount(mount_process, mnt_dir) +@pytest.mark.parametrize("notify", (True, False)) +def test_timefs3(tmpdir, notify): + mnt_dir = str(tmpdir) + cmdline = base_cmdline + \ + [ pjoin(basename, 'example', 'timefs3'), + '-f', '--update-interval=2', + '--timeout=4', mnt_dir ] + if not notify: + cmdline.append('--no-notify') + mount_process = subprocess.Popen(cmdline) + try: + wait_for_mount(mount_process, mnt_dir) + fname = pjoin(mnt_dir, os.listdir(mnt_dir)[0]) + try: + os.stat(fname) + except FileNotFoundError: + # We may have hit a race condition + fname = pjoin(mnt_dir, os.listdir(mnt_dir)[0]) + os.stat(fname) + + safe_sleep(2) + if not notify: + os.stat(fname) + safe_sleep(4) + with pytest.raises(FileNotFoundError): + os.stat(fname) + except: + cleanup(mnt_dir) + raise + else: + umount(mount_process, mnt_dir) + def checked_unlink(filename, path, isdir=False): fullname = pjoin(path, filename) if isdir: |