aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2018-11-24 20:24:45 +0000
committerNikolaus Rath <Nikolaus@rath.org>2018-11-24 20:51:47 +0000
commitb35afb000a08dd899556592e6f1dff3c5ea61d71 (patch)
tree4450e088c199393cae25565fadeae13a33598f68 /test
parent59dc22b12f323aee41315ff82f358482f78bfd5f (diff)
downloadlibfuse-b35afb000a08dd899556592e6f1dff3c5ea61d71.tar.gz
Added testcase for "big" readdir.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index de5a118..1b98a7c 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -117,6 +117,7 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback):
tst_statvfs(work_dir)
tst_readdir(src_dir, work_dir)
+ tst_readdir_big(src_dir, work_dir)
tst_open_read(src_dir, work_dir)
tst_open_write(src_dir, work_dir)
tst_create(work_dir)
@@ -515,6 +516,31 @@ def tst_readdir(src_dir, mnt_dir):
os.rmdir(subdir)
os.rmdir(src_newdir)
+def tst_readdir_big(src_dir, mnt_dir):
+
+ # Add enough entries so that readdir needs to be called
+ # multiple times.
+ fnames = []
+ for i in range(500):
+ fname = ('A rather long filename to make sure that we '
+ 'fill up the buffer - ' * 3) + str(i)
+ with open(pjoin(src_dir, fname), 'w') as fh:
+ fh.write('File %d' % i)
+ fnames.append(fname)
+
+ listdir_is = sorted(os.listdir(mnt_dir))
+ listdir_should = sorted(os.listdir(src_dir))
+ assert listdir_is == listdir_should
+
+ for fname in fnames:
+ stat_src = os.stat(pjoin(src_dir, fname))
+ stat_mnt = os.stat(pjoin(mnt_dir, fname))
+ assert stat_src.st_ino == stat_mnt.st_ino
+ assert stat_src.st_mtime == stat_mnt.st_mtime
+ assert stat_src.st_ctime == stat_mnt.st_ctime
+ assert stat_src.st_size == stat_mnt.st_size
+ os.unlink(pjoin(src_dir, fname))
+
def tst_truncate_path(mnt_dir):
assert len(TEST_DATA) > 1024