From: Nikolaus Rath Date: Wed, 24 May 2017 23:20:04 +0000 (-0700) Subject: Added tst_open_read() X-Git-Tag: fuse-3.1.0~31 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cb6da126941fb329a4817f061d30fe21eb3fa7a8;p=qemu-gpiodev%2Flibfuse.git Added tst_open_read() Slightly increases coverage of examples/passthrough_ll.c (which supports open for reading, but not for writing). --- diff --git a/test/test_examples.py b/test/test_examples.py index d508d0f..9ba3ffe 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -86,6 +86,7 @@ def test_passthrough(tmpdir, name, debug, capfd): tst_statvfs(work_dir) tst_readdir(src_dir, work_dir) + tst_open_read(src_dir, work_dir) if not is_ll: tst_mkdir(work_dir) tst_rmdir(src_dir, work_dir) @@ -371,6 +372,14 @@ def tst_chown(mnt_dir): assert fstat.st_uid == uid_new assert fstat.st_gid == gid_new +def tst_open_read(src_dir, mnt_dir): + name = name_generator() + with open(pjoin(src_dir, name), 'wb') as fh_out, \ + open(TEST_FILE, 'rb') as fh_in: + shutil.copyfileobj(fh_in, fh_out) + + assert filecmp.cmp(pjoin(mnt_dir, name), TEST_FILE, False) + def tst_open_write(src_dir, mnt_dir): name = name_generator() fd = os.open(pjoin(src_dir, name),