generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 012
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 012
6 #
7 # holes
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=0        # success is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -f $tmp.*
22     rm -rf $TEST_DIR/holes.$$.*
23 }
24
25 _filesize()
26 {
27     ls -l $1 | $AWK_PROG '{print "    filesize = " $5}'
28 }
29
30 # get standard environment, filters and checks
31 . ./common/rc
32 . ./common/filter
33
34 _do_test()
35 {
36     _n="$1"
37     _param="$2"
38     _count="$3"
39     
40     failed=0
41     
42     out=$TEST_DIR/holes.$$.$_n
43     echo ""
44     echo "holes.$_n : $_param"
45     echo "-----------------------------------------------"
46     if  ! $here/src/holes $_param $out >$tmp.out
47     then
48         echo "    holes returned $? - see $seqres.full"
49         failed=1
50         status=1
51     fi
52         
53
54     if [ $failed -eq 0 ]
55     then        
56         # quick check - how many holes did we get?
57         count=`xfs_bmap $out | egrep -c ': hole'`
58         echo "    $count hole(s) detected"
59         # and how big was the file?
60         _filesize $out
61         
62         if [ $count -ne $_count ]
63         then
64             echo "    unexpected number of holes - see $seqres.full"
65             status=1
66             failed=1
67         fi
68     fi
69         
70     if [ $failed -eq 1 ]
71     then
72         echo "--------------------------------------"       >>$seqres.full
73         echo "$_n - output from holes:"                     >>$seqres.full
74         echo "--------------------------------------"       >>$seqres.full
75         cat $tmp.out                                        >>$seqres.full
76         echo "--------------------------------------"       >>$seqres.full
77         echo "$_n - output from bmap:"                      >>$seqres.full
78         echo "--------------------------------------"       >>$seqres.full
79         xfs_bmap -vvv $out                                  >>$seqres.full
80         echo "--------------------------------------"       >>$seqres.full
81         echo "$_n - output from ls -li:"                    >>$seqres.full
82         echo "--------------------------------------"       >>$seqres.full
83         ls -li $out                                         >>$seqres.full
84         status=1
85     fi
86 }
87
88 # real QA test starts here
89 _supported_fs xfs
90 _require_test
91
92 rm -f $seqres.full
93
94 # small & fairly dense
95 _do_test 1 "-l 40960000 -b 40960 -i 10 -c 1" 100
96
97 # big & sparse
98 _do_test 2 "-l 409600000 -b 40960 -i 1000 -c 1" 10
99
100 # no holes, but a very nasty way to write a file (lots of extents)
101 _do_test 3 "-l 40960000 -b 40960 -i 10 -c 10" 0
102
103 exit