fsx: Replace use of bcmp() with memcmp()
[xfstests-dev.git] / 203
1 #! /bin/sh
2 # FS QA Test No. 203
3 #
4 # Test out reallocation of the extent array in xfs_io.
5 # Based on a testcase from Tomasz Majkowski <moosh009@gmail.com>.
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2009 Christoph Hellwig.
9 #-----------------------------------------------------------------------
10 #
11 # creator
12 owner=hch@lst.de
13
14 seq=`basename $0`
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20
21 _write_holes()
22 {
23         file=$1
24         holes=$2
25         let writes=$holes+1
26
27         offset=0
28         for i in `seq 0 $writes`; do
29                 xfs_io -f $file -c "pwrite -q $offset 1"
30                 let offset=$offset+0x100000
31         done
32 }
33
34 #       0: [0..7]: 104..111
35 #       1: [8..2047]: hole
36 _filter_bmap()
37 {
38         awk '$3 ~ /hole/ { print $1, $2, $3; next }
39              {print $1, $2; next}'
40 }
41
42 _cleanup()
43 {
44         rm -f $TEST_DIR/hole_file*
45         rm -f $TEST_DIR/r??
46 }
47 trap "_cleanup; exit \$status" 0 1 2 3 15
48
49 # get standard environment, filters and checks
50 . ./common.rc
51 . ./common.filter
52
53 # real QA test starts here
54 _supported_fs xfs
55 _supported_os Linux
56
57
58 for i in 10 14 15 16 17 28 29 30 31; do
59         rm -f $TEST_DIR/hole_file
60         _write_holes $TEST_DIR/hole_file${i} ${i}
61 done
62
63 for i in 10 14 15 16 17 28 29 30 31; do
64         xfs_bmap $TEST_DIR/hole_file${i} | _filter_bmap
65         echo
66 done
67
68 # success, all done
69 echo "*** done"
70 rm -f $seq.full
71 status=0