2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
7 # Test filetype feature
9 # This test does NOT require that file system support the d_type feature.
10 # It verifies that file types are reported as either DT_UNKNOWN or as
11 # the actual file type. For example, special dir entries . and .. MAY be
12 # reported as DT_UNKNOWN IF filetype feature is disabled (ext4), but MAY
13 # also be reported as DT_DIR in this case (xfs).
15 # For fs for which we know how to test the filetype feature (xfs|ext*)
16 # verify getting DT_UNKNOWN IFF feature is disabled.
19 seqres=$RESULT_DIR/$seq
20 echo "QA output created by $seq"
23 status=1 # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15
32 # get standard environment, filters and checks
36 # real QA test starts here
42 _require_test_program "t_dir_type"
46 _scratch_mkfs >>$seqres.full 2>&1
50 # Create our test files.
51 testdir=$SCRATCH_MNT/find-by-type
55 ln -s $testdir/f $testdir/l
56 mknod $testdir/c c 1 1
57 mknod $testdir/b b 1 1
60 # Test d_type of test files - it must be the actual file type on fs
61 # with filetype support and it could be either the actual file type
62 # or DT_UNKNOWN on fs without filetype support
64 _supports_filetype $SCRATCH_MNT && ftype=1
65 $here/src/t_dir_type $testdir | \
66 while read name type; do
67 if [ "$ftype" != 1 -a "$type" = u ]; then
68 if [ "$name" = "." -o "$name" = ".." ]; then