Skip to contentSkip to conversation

generic/673: Add test for seekdir

PATCH New Jan Kara 1 participant 1 message Feb 22, 2022

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 generic/673: Add test for seekdir

Add test checking functionality of seekdir. We check whether seekdir gets us back to the directory entry it should and also whether seeking to random positions does not crash the filesystem.

Unlike test generic/310 which also tests seeking, this test checks both glibc readdir() function as well as getdents64() syscall directly. This is because glibc readdir() implementation does a lot of caching and processing internally thus hiding kernel from some possible problems. Also test wider range of random offsets to have better chance of hitting out of bound accesses or other bugs.

---
 .gitignore            |   1 +
 src/Makefile          |   2 +-
 src/t_readdir_3.c     | 238 ++++++++++++++++++++++++++++++++++++++++++
 tests/generic/673     |  41 ++++++++
 tests/generic/673.out |   2 +
 5 files changed, 283 insertions(+), 1 deletion(-)
 create mode 100644 src/t_readdir_3.c
 create mode 100755 tests/generic/673
 create mode 100644 tests/generic/673.out
.gitignore +1 -0
index ba0c572b248f..ca6ba5c473fa 100644
@@ -158,6 +158,7 @@ tags
 /src/t_open_tmpfiles
 /src/t_readdir_1
 /src/t_readdir_2
+/src/t_readdir_3
 /src/t_rename_overwrite
 /src/t_stripealign
 /src/t_truncate_cmtime
src/Makefile +1 -1
index 111ce1d90fe6..4d9e02b74d13 100644
@@ -31,7 +31,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	dio-invalidate-cache stat_test t_encrypted_d_revalidate \
 	attr_replace_test swapon mkswap t_attr_corruption t_open_tmpfiles \
 	fscrypt-crypt-util bulkstat_null_ocount splice-test chprojid_fail \
-	detached_mounts_propagation ext4_resize
+	detached_mounts_propagation ext4_resize t_readdir_3
 
 EXTRA_EXECS = dmerror fill2attr fill2fs fill2fs_check scaleread.sh \
 	      btrfs_crc32c_forged_name.py
src/t_readdir_3.c new file +238 -0

238 lines not on this page · raw message

tests/generic/673 new file +41 -0

41 lines not on this page · raw message

tests/generic/673.out new file +2 -0
new file mode 100644
index 000000000000..e038de2ca346
@@ -0,0 +1,2 @@
+QA output created by 673
+All tests passed
Signature · 1 line
2.31.1