Skip to contentSkip to conversation

generic/396: test correct d_type value

PATCH Superseded Amir Goldstein 2 participants 3 messages Dec 19, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/396: test correct d_type value

Verify correct d_type values of dir enrties.

This test would fail for file systems with no d_type support, but I have no idea how to test d_type support in a generic way, without confusing a bug of d_type = DT_UNKNOWN with no support.

I wonder if anybody is interested in testing a file system with no d_type support.

---
 .gitignore            |   1 +
 src/Makefile          |   2 +-
 src/t_dir_type.c      | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/396     |  72 ++++++++++++++++++++++++++++++++++
 tests/generic/396.out |   7 ++++
 tests/generic/group   |   1 +
 6 files changed, 188 insertions(+), 1 deletion(-)
 create mode 100644 src/t_dir_type.c
 create mode 100755 tests/generic/396
 create mode 100644 tests/generic/396.out
.gitignore +1 -0
index b8d13a0..7dcea14 100644
@@ -94,6 +94,7 @@
 /src/t_access_root
 /src/t_dir_offset
 /src/t_dir_offset2
+/src/t_dir_type
 /src/t_futimens
 /src/t_getcwd
 /src/t_holes
src/Makefile +1 -1
index 4056496..94d74aa 100644
@@ -21,7 +21,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
 	renameat2 t_getcwd e4compact test-nextquota punch-alternating \
-	attr-list-by-handle-cursor-test listxattr dio-interleaved
+	attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type
 
 SUBDIRS =
 
src/t_dir_type.c new file +106 -0

106 lines not on this page · raw message

tests/generic/396 new file +72 -0

72 lines not on this page · raw message

tests/generic/396.out new file +7 -0
new file mode 100644
index 0000000..77592ce
@@ -0,0 +1,7 @@
+QA output created by 396
+d_name = d, d_type = d
+d_name = f, d_type = f
+d_name = l, d_type = l
+d_name = c, d_type = c
+d_name = b, d_type = b
+d_name = p, d_type = p
tests/generic/group +1 -0
index 20b31ef..24c242f 100644
@@ -397,3 +397,4 @@
 392 auto quick metadata
 393 auto quick rw
 394 auto quick
+396 auto quick
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Amir Goldstein

Verify correct d_type values of dir enrties.

This test would fail for file systems with no d_type support, but I have no idea how to test d_type support in a generic way, without confusing a bug of d_type = DT_UNKNOWN with no support.

XFS v4 without the rare ftype feature is such a file system.

We'll need to detect it, and I think a large enough directory where all entries but . and .. are DT_UNKNOWN should be a clear indicator.

If that's a bug it's clearly not distinguishable from a non-buggy fs :)

#2 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Amir Goldstein

Verify correct d_type values of dir enrties.

This test would fail for file systems with no d_type support, but I have no idea how to test d_type support in a generic way, without confusing a bug of d_type = DT_UNKNOWN with no support.

Quoted 6 lines

XFS v4 without the rare ftype feature is such a file system.

We'll need to detect it, and I think a large enough directory where all entries but . and .. are DT_UNKNOWN should be a clear indicator.

If that's a bug it's clearly not distinguishable from a non-buggy fs :)

For xfs and ext* I know how to test if the feature is enabled and I probably should do that. The question is what to do with the rest of the fs. I can do the heuristic test you suggested...