xfstests: Use installed libraries only
[xfstests-dev.git] / 229
1 #! /bin/bash
2 # FS QA Test No. 221
3 #
4 # Check for file corruption when using the extent size hint on
5 # the normal data subvolume.
6 #
7 # http://oss.sgi.com/bugzilla/show_bug.cgi?id=874
8 #
9 # Based on a bug report and testcase from Geoffrey Wehrman <gwehrman@sgi.com>.
10 #
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2010 Christoph Hellwig.  All Rights Reserved.
13 # Copyright (c) 2010 Silicon Graphics, Inc.  All Rights Reserved.
14 #
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
18 #
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
27 #
28 #-----------------------------------------------------------------------
29 #
30 # creator
31 owner=hch@lst.de
32
33 seq=`basename $0`
34 echo "QA output created by $seq"
35
36 here=`pwd`
37 tmp=/tmp/$$
38 status=1        # failure is the default!
39
40 _cleanup()
41 {
42     rm -rf ${TDIR}
43 }
44
45 trap "_cleanup ; exit \$status" 0 1 2 3 15
46
47 # get standard environment, filters and checks
48 . ./common.rc
49
50 # real QA test starts here
51 _supported_fs xfs
52 _supported_os Linux
53
54 TDIR="${TEST_DIR}/t_holes"
55 NFILES="10"
56 EXTSIZE="256k"
57
58 # Create the test directory
59 mkdir ${TDIR}
60
61 # Set the test directory extsize
62 xfs_io -c "extsize ${EXTSIZE}" ${TDIR}
63
64 # Create a set of holey files
65 echo "generating ${NFILES} files"
66
67 for i in $(seq 0 ${NFILES}); do
68   $here/src/t_holes ${TDIR}/${i}
69 done
70
71 # Compare the files
72 echo "comparing files"
73 errcnt=0
74 j=0
75 for i in $(seq 0 ${NFILES}); do
76     let j=$i+1
77     while [ ${j} -lt ${NFILES} ] ; do
78         if ! cmp ${TDIR}/${i} ${TDIR}/${j} ; then
79             let errcnt=$errcnt+1
80         fi
81         let j=$j+1
82     done
83 done
84
85 echo "got ${errcnt} errors"
86
87 status=$errcnt
88 exit $status