generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 150
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 150
6 #
7 # Make sure the xfs_db path command works the way the author thinks it does.
8 # This means that it can navigate to random inodes, fails on paths that don't
9 # resolve.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1    # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs xfs
32 _require_xfs_db_command "path"
33 _require_scratch
34
35 echo "Format filesystem and populate"
36 _scratch_mkfs > $seqres.full
37 _scratch_mount >> $seqres.full
38
39 mkdir $SCRATCH_MNT/a
40 mkdir $SCRATCH_MNT/a/b
41 $XFS_IO_PROG -f -c 'pwrite 0 61' $SCRATCH_MNT/a/c >> $seqres.full
42 ln -s -f c $SCRATCH_MNT/a/d
43 mknod $SCRATCH_MNT/a/e b 8 0
44 ln -s -f b $SCRATCH_MNT/a/f
45
46 _scratch_unmount
47
48 echo "Check xfs_db path on directories"
49 _scratch_xfs_db -c 'path /a' -c print | grep -q 'sfdir.*count.* 5$' || \
50         echo "Did not find directory /a"
51
52 _scratch_xfs_db -c 'path /a/b' -c print | grep -q sfdir || \
53         echo "Did not find empty sf directory /a/b"
54
55 echo "Check xfs_db path on files"
56 _scratch_xfs_db -c 'path /a/c' -c print | grep -q 'core.size.*61' || \
57         echo "Did not find 61-byte file /a/c"
58
59 echo "Check xfs_db path on file symlinks"
60 _scratch_xfs_db -c 'path /a/d' -c print | grep -q symlink || \
61         echo "Did not find symlink /a/d"
62
63 echo "Check xfs_db path on bdevs"
64 _scratch_xfs_db -c 'path /a/e' -c print | grep -q 'format.*dev' || \
65         echo "Did not find bdev /a/e"
66
67 echo "Check xfs_db path on dir symlinks"
68 _scratch_xfs_db -c 'path /a/f' -c print | grep -q symlink || \
69         echo "Did not find symlink /a/f"
70
71 echo "Check nonexistent path"
72 _scratch_xfs_db -c 'path /does/not/exist'
73
74 echo "Check xfs_db path on file path with multiple slashes"
75 _scratch_xfs_db -c 'path /a////////c' -c print | grep -q 'core.size.*61' || \
76         echo "Did not find 61-byte file /a////////c"
77
78 echo "Check xfs_db path on file path going in and out of /a to get to /a/c"
79 _scratch_xfs_db -c 'path /a/.././a/.././a/c' -c print | grep -q 'core.size.*61' || \
80         echo "Did not find 61-byte file /a/.././a/.././a/c"
81
82 echo "Check xfs_db path on file path going above the root to get to /a/c"
83 _scratch_xfs_db -c 'path /../../../a/c' -c print | grep -q 'core.size.*61' || \
84         echo "Did not find 61-byte file  /../../../a/c"
85
86 echo "Check xfs_db path on file path going to then above the root to get to /a/c"
87 _scratch_xfs_db -c 'path /a/../../../a/c' -c print | grep -q 'core.size.*61' || \
88         echo "Did not find 61-byte file  /a/../../../a/c"
89
90 echo "Check xfs_db path component that isn't a directory"
91 _scratch_xfs_db -c 'path /a/c/b' -c print
92
93 echo "Check xfs_db path on a dot-dot applied to a non-directory"
94 _scratch_xfs_db -c 'path /a/c/../b' -c print
95
96 # success, all done
97 status=0
98 exit