generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 401
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
4 #
5 # FSQA Test No. 401
6 #
7 # Test filetype feature
8 #
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).
14 #
15 # For fs for which we know how to test the filetype feature (xfs|ext*)
16 # verify getting DT_UNKNOWN IFF feature is disabled.
17 #
18 . ./common/preamble
19 _begin_fstest auto quick
20
21 # Import common functions.
22 . ./common/filter
23
24 # real QA test starts here
25 _supported_fs generic
26 _require_scratch
27 _require_symlinks
28 _require_mknod
29 _require_test_program "t_dir_type"
30
31 _scratch_mkfs >>$seqres.full 2>&1
32
33 _scratch_mount
34
35 # Create our test files.
36 testdir=$SCRATCH_MNT/find-by-type
37 mkdir -p $testdir
38 mkdir $testdir/d
39 touch $testdir/f
40 ln -s $testdir/f $testdir/l
41 mknod $testdir/c c 1 1
42 mknod $testdir/b b 1 1
43 mknod $testdir/p p
44
45 # Test d_type of test files - it must be the actual file type on fs
46 # with filetype support and it could be either the actual file type
47 # or DT_UNKNOWN on fs without filetype support
48 ftype=
49 _supports_filetype $SCRATCH_MNT && ftype=1
50 $here/src/t_dir_type $testdir | \
51 while read name type; do
52         if [ "$ftype" != 1 -a "$type" = u ]; then
53                 if [ "$name" = "." -o "$name" = ".." ]; then
54                         type=d
55                 else
56                         type=$name
57                 fi
58         fi
59         echo $name $type
60 done | sort
61
62 status=0
63 exit