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
40 _require_test_program "t_dir_type"
44 _scratch_mkfs >>$seqres.full 2>&1
48 # Create our test files.
49 testdir=$SCRATCH_MNT/find-by-type
53 ln -s $testdir/f $testdir/l
54 mknod $testdir/c c 1 1
55 mknod $testdir/b b 1 1
58 # Test d_type of test files - it must be the actual file type on fs
59 # with filetype support and it could be either the actual file type
60 # or DT_UNKNOWN on fs without filetype support
62 _supports_filetype $SCRATCH_MNT && ftype=1
63 src/t_dir_type $testdir | \
64 while read name type; do
65 if [ "$ftype" != 1 -a "$type" = u ]; then
66 if [ "$name" = "." -o "$name" = ".." ]; then