Added tst_open_read()
authorNikolaus Rath <Nikolaus@rath.org>
Wed, 24 May 2017 23:20:04 +0000 (16:20 -0700)
committerNikolaus Rath <Nikolaus@rath.org>
Wed, 24 May 2017 23:20:04 +0000 (16:20 -0700)
Slightly increases coverage of examples/passthrough_ll.c (which
supports open for reading, but not for writing).

test/test_examples.py

index d508d0f13ff8e8cce75a15d8ad0def4b0779c891..9ba3ffe93ae5e8e0240345a8e5ab92abfeb5ca90 100755 (executable)
@@ -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),