xfstests: kill useless test owner fields
[xfstests-dev.git] / 078
1 #! /bin/bash
2 # FS QA Test No. 078
3 #
4 # Check several growfs corner cases
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 echo "QA output created by $seq"
27
28 here=`pwd`
29 tmp=/tmp/$$
30 status=1
31
32 trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
33
34 _cleanup()
35 {
36     cd /
37     rm -f $tmp.*
38     umount -d $LOOP_MNT 2>/dev/null
39     rmdir $LOOP_MNT
40     _cleanup_testdir
41 }
42
43 # get standard environment, filters and checks
44 . ./common.rc
45 . ./common.filter
46
47 # loop devices are available in Linux only
48 _supported_fs xfs
49 _supported_os Linux
50
51 # Must have loop device
52 _require_loop
53
54 LOOP_IMG=$TEST_DIR/$seq.fs
55 LOOP_MNT=$TEST_DIR/$seq.mnt
56
57 _filter_io()
58 {
59         sed -e '/.* ops; /d'
60 }
61
62 # real QA test starts here
63
64 echo "*** create loop mount point"
65 rmdir $LOOP_MNT 2>/dev/null
66 mkdir -p $LOOP_MNT || _fail "cannot create loopback mount point"
67
68 _grow_loop()
69 {
70         original=$1
71         new_size=$2
72         bsize=$3
73         check=$4
74         agsize=$5
75
76         dparam="file,name=$LOOP_IMG,size=$original"
77         if [ -n "$agsize" ]; then
78                 dparam="$dparam,agsize=$agsize"
79         fi
80
81         echo
82         echo "=== GROWFS (from $original to $new_size, $bsize blocksize)"
83         echo
84
85         echo "*** mkfs loop file (size=$original)"
86         $MKFS_XFS_PROG -b size=$bsize -d $dparam \
87                 | _filter_mkfs 2>/dev/null
88
89         echo "*** extend loop file"
90         $XFS_IO_PROG -c "pwrite $new_size $bsize" $LOOP_IMG | _filter_io
91         echo "*** mount loop filesystem"
92         mount -t xfs -o loop $LOOP_IMG $LOOP_MNT
93
94         echo "*** grow loop filesystem"
95         #xfs_growfs $LOOP_MNT 2>&1 | grep -e "^data" #| _filter_growfs 2>/dev/null
96         $XFS_GROWFS_PROG $LOOP_MNT 2>&1 |  _filter_growfs 2>&1
97
98         echo "*** unmount"
99         umount -d $LOOP_MNT > /dev/null 2>&1
100
101         # Large grows takes forever to check..
102         if [ "$check" -gt "0" ]
103         then
104                 echo "*** check"
105                 LOOP_DEV=`losetup -f`
106                 losetup $LOOP_DEV $LOOP_IMG
107                  _check_xfs_filesystem $LOOP_DEV none none
108                 losetup -d $LOOP_DEV
109         fi
110
111         rm -f $LOOP_IMG
112 }
113
114 # Wes' problem sizes...
115 _grow_loop 168024b 1376452608 4096 1
116
117 # Some other blocksize cases...
118 _grow_loop 168024b 1376452608 2048 1
119 _grow_loop 168024b 1376452608 512 1 16m
120 _grow_loop 168024b 688230400 1024 1
121
122
123 # Other corner cases suggested by dgc
124 # also the following doesn't check if the filesystem is consistent.
125 #  - grow 1TB by 1.5TB (control)
126 _grow_loop 1t 2500g 4096 0
127
128 #  - grow 1TB by 2.5TB (grow by > 2TB)
129 _grow_loop 1t 3500g 4096 0
130
131 #  - grow 1TB by 3.5TB (grow past 4TB)
132 _grow_loop 1t 4500g 4096 0
133
134 #  - grow 1TB by 4.5TB (grow by > 4TB)
135 _grow_loop 1t 5500g 4096 0
136
137 #  - grow 1TB by 7.5TB (grow past 8TB)
138 _grow_loop 1t 8500g 4096 0
139
140 #  - grow 1TB by 8.5TB (grow by > 8TB)
141 _grow_loop 1t 9500g 4096 0
142
143 #  - grow 1TB by 14.5TB (grow by > 8TB)
144 _grow_loop 1t 15500g 4096 0
145
146 #  - grow 1TB by 15TB (grow to 16TB)
147 _grow_loop 1t 16000g 4096 0
148
149 # It would be nice to go on, but this would require a totally new test in order
150 # to take care of 64-bit machines.
151
152 echo "*** all done"
153 status=0
154 exit