XFSQA: add per host config files.
[xfstests-dev.git] / 165
1 #! /bin/sh
2 # FS QA Test No. 165
3 #
4 # Test out prealloc, direct writes and buffered read
5 # Some experimentation when looking at 
6 #   pv#962014 - DMF 3.7 reading incorrect data 
7 # Doesn't actually reproduce the problem but it tried to :-)
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
11 #-----------------------------------------------------------------------
12 #
13 # creator
14 owner=tes@puffy.melbourne.sgi.com
15
16 seq=`basename $0`
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26     cd /
27     rm -f $tmp.*
28 }
29
30 #
31 # Filter out these lines partially
32 # From:
33 #   40 KiB, 10 ops; 0.0000 sec (4.070 MiB/sec and 1041.9923 ops/sec)
34 # To:
35 #   40 KiB, 10 ops
36 #
37 _filter_io()
38 {
39     tee -a $seq.full | sed 's/ops;.*/ops/'
40 }
41
42 #
43 # <    1: [8..79]:         6552..6623        0 (6552..6623)        72
44 # >    1: [8..79]:         202544..202615    0 (202544..202615)    72
45 #
46 #
47 _filter_bmap()
48 {
49     awk '$3 ~ /hole/ { print $1, $2, $3; next }
50          {print $1, $2}' >> $seq.full
51 }
52
53 # get standard environment, filters and checks
54 . ./common.rc
55 . ./common.filter
56
57 # real QA test starts here
58
59 # Modify as appropriate.
60 _supported_fs xfs
61 _supported_os IRIX Linux
62
63 # io tests 
64 testfile=$TEST_DIR/file.$seq
65 rm -f $testfile
66 rm -f $seq.full
67 len=4
68 end=`expr 10 \* $len`
69
70 # Other test...
71 #xfs_io -f -c "resvsp ${off}k ${end}k" $testfile
72
73 # write the initial file
74 xfs_io -f -c "pwrite 0  ${end}k" $testfile | _filter_io
75
76
77 off=0
78 while [ $off -le $end ]
79 do
80         offset=${off}k
81         length=${len}k
82
83         xfs_io -c "unresvsp $offset $length" -c "bmap -vp" $testfile | _filter_bmap
84
85         off=`expr $off + $len` # skip over 1
86         off=`expr $off + $len`
87 done
88
89 off=0
90 while [ $off -le $end ]
91 do
92         offset=${off}k
93         length=${len}k
94         bufsize=${len}k
95         echo ""
96         echo "*** offset = $offset ***"
97         echo ""
98
99         # prealloc and write
100         xfs_io -d -c "resvsp $offset $length" -c "pwrite -b $bufsize $offset $length" $testfile | _filter_io
101
102         # Other tests...
103         #xfs_io -c "resvsp $offset $length" $testfile
104         #xfs_bmap -v -p $testfile
105         #xfs_io -d -c "pwrite -b $bufsize $offset $length" $testfile
106         #xfs_bmap -v -p $testfile
107
108         xfs_io -r -c "pread -v -b $bufsize $offset $length" $testfile >$tmp.$off &
109
110         # Other tests...
111         #xfs_io -r -c "pread -v -b $bufsize $offset $length" $testfile
112         #sleep 5
113
114         off=`expr $off + $len` # skip over 1
115         off=`expr $off + $len`
116 done
117
118 wait
119 cat $tmp.* | _filter_io
120
121 # success, all done
122 status=0
123 exit