aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-24 16:20:04 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-24 16:20:04 -0700
commitcb6da126941fb329a4817f061d30fe21eb3fa7a8 (patch)
tree6d44b0d7595cd78f7b47d3d88d357d12a025a723 /test
parent2bc480a37a3be2a7ace105741ccf34bceb29332a (diff)
Added tst_open_read()
Slightly increases coverage of examples/passthrough_ll.c (which supports open for reading, but not for writing).
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py9
1 files changed, 9 insertions, 0 deletions
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),