2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
10 _begin_fstest rw auto quick
12 status=0 # success is the default!
14 # Override the default cleanup function.
19 rm -rf $TEST_DIR/holes.$$.*
24 ls -l $1 | $AWK_PROG '{print " filesize = " $5}'
27 # Import common functions.
38 out=$TEST_DIR/holes.$$.$_n
40 echo "holes.$_n : $_param"
41 echo "-----------------------------------------------"
42 if ! $here/src/holes $_param $out >$tmp.out
44 echo " holes returned $? - see $seqres.full"
52 # quick check - how many holes did we get?
53 count=`xfs_bmap $out | egrep -c ': hole'`
54 echo " $count hole(s) detected"
55 # and how big was the file?
58 if [ $count -ne $_count ]
60 echo " unexpected number of holes - see $seqres.full"
68 echo "--------------------------------------" >>$seqres.full
69 echo "$_n - output from holes:" >>$seqres.full
70 echo "--------------------------------------" >>$seqres.full
71 cat $tmp.out >>$seqres.full
72 echo "--------------------------------------" >>$seqres.full
73 echo "$_n - output from bmap:" >>$seqres.full
74 echo "--------------------------------------" >>$seqres.full
75 xfs_bmap -vvv $out >>$seqres.full
76 echo "--------------------------------------" >>$seqres.full
77 echo "$_n - output from ls -li:" >>$seqres.full
78 echo "--------------------------------------" >>$seqres.full
79 ls -li $out >>$seqres.full
84 # real QA test starts here
88 # small & fairly dense
89 _do_test 1 "-l 40960000 -b 40960 -i 10 -c 1" 100
92 _do_test 2 "-l 409600000 -b 40960 -i 1000 -c 1" 10
94 # no holes, but a very nasty way to write a file (lots of extents)
95 _do_test 3 "-l 40960000 -b 40960 -i 10 -c 10" 0