diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-12-23 18:31:45 -0800 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-12-23 18:31:45 -0800 |
commit | 8e69b19cdc7ca7218f468e7ebd10ac7a4b46c56a (patch) | |
tree | fa16100002de23470f99d7fe2f10cc5878743047 /test | |
parent | d6e86a7c40ab715aeaf331c6d43749694763b924 (diff) |
Added documentation and test case for null example
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_examples.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_examples.py b/test/test_examples.py index 457c2a0..95eeb9a 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -140,6 +140,28 @@ def test_poll(tmpdir): else: umount(mount_process, mnt_dir) +def test_null(tmpdir): + mnt_file = str(tmpdir) + '/file' + with open(mnt_file, 'w') as fh: + fh.write('dummy') + cmdline = base_cmdline + [pjoin(basename, 'example', 'null'), + '-f', mnt_file ] + mount_process = subprocess.Popen(cmdline) + def test_fn(name): + return os.stat(name).st_size > 4000 + try: + wait_for_mount(mount_process, mnt_file, test_fn) + with open(mnt_file, 'rb') as fh: + assert fh.read(382) == b'\0' * 382 + with open(mnt_file, 'wb') as fh: + fh.write(b'whatever') + except: + cleanup(mnt_file) + raise + else: + umount(mount_process, mnt_file) + + @pytest.mark.parametrize("name", ('notify_inval_inode', 'notify_store_retrieve')) |