From 8e69b19cdc7ca7218f468e7ebd10ac7a4b46c56a Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Fri, 23 Dec 2016 18:31:45 -0800 Subject: Added documentation and test case for null example --- test/test_examples.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') 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')) -- cgit v1.2.3