update 114 for new getparents interface and xfs_io parent command.
[xfstests-dev.git] / 008
1 #! /bin/sh
2 # FS QA Test No. 008
3 #
4 # randholes test
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=dxm@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=0        # success is the default!
19 pgsize=`$here/src/feature -s`
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24     rm -f $tmp.*
25     rm -rf $testdir/randholes.$$.*
26     _cleanup_testdir
27 }
28
29 _filter()
30 {
31     sed -e "s/-b $pgsize/-b PGSIZE/g"
32 }
33
34 # get standard environment, filters and checks
35 . ./common.rc
36 . ./common.filter
37
38 _do_test()
39 {
40     _n="$1"
41     _holes="$2"
42     _param="$3"
43     
44     out=$testdir/randholes.$$.$_n
45     echo ""
46     echo "randholes.$_n : $_param" | _filter
47     echo "------------------------------------------"
48     if $here/src/randholes $_param $out >$tmp.out
49     then
50         # quick check - how many holes did we get?
51         count=`xfs_bmap $out | egrep -c ': hole'`
52         # blocks can end up adjacent, therefore number of holes varies
53         _within_tolerance "holes" $count $_holes 10% -v
54     else
55         echo "    randholes returned $? - see $seq.out.full"
56         echo "--------------------------------------"       >>$here/$seq.out.full
57         echo "$_n - output from randholes:"                 >>$here/$seq.out.full
58         echo "--------------------------------------"       >>$here/$seq.out.full
59         cat $tmp.out                                        >>$here/$seq.out.full
60         echo "--------------------------------------"       >>$here/$seq.out.full
61         echo "$_n - output from bmap:"                      >>$here/$seq.out.full
62         echo "--------------------------------------"       >>$here/$seq.out.full
63         xfs_bmap -vvv $out                                  >>$here/$seq.out.full
64         status=1
65     fi
66 }
67
68 # real QA test starts here
69 _supported_fs xfs
70 _supported_os IRIX Linux
71
72 _setup_testdir
73
74 rm -f $here/$seq.out.full
75
76 _do_test 1 50 "-l 5000000 -c 50 -b $pgsize"
77 _do_test 2 100 "-l 10000000 -c 100 -b $pgsize"
78 _do_test 3 100 "-l 10000000 -c 100 -b 512"   # test partial pages
79
80 # rinse, lather, repeat for direct IO
81 _do_test 4 50 "-d -l 5000000 -c 50 -b $pgsize"
82 _do_test 5 100 "-d -l 10000000 -c 100 -b $pgsize"
83 # note: direct IO requires page aligned IO
84
85 # todo: realtime.
86
87 # success, all done
88 exit