Fix shell stuff up in setup script.
[xfstests-dev.git] / 041
1 #! /bin/sh
2 # FS QA Test No. 041
3 #
4 # growfs QA tests - repeatedly fill/grow the filesystem
5 # check the filesystem contents after each operation
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
9
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
13
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like.  Any license provided herein, whether implied or
21 # otherwise, applies only to this software file.  Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
24
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA  94043, or:
31
32 # http://www.sgi.com 
33
34 # For further information regarding this notice, see: 
35
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
38 #
39 set +x
40 # creator
41 owner=ajag@sgi.com
42
43 seq=`basename $0`
44 echo "QA output created by $seq"
45
46 here=`pwd`
47 tmp=/tmp/$$
48 status=1        # failure is the default!
49
50 _cleanup()
51 {
52     cd /
53     umount $SCRATCH_MNT
54     rm -f $tmp.*
55 }
56 trap "_cleanup ; exit \$status" 0 1 2 3 15
57
58 # get standard environment, filters and checks
59 . ./common.rc
60 . ./common.filter
61
62 # real QA test starts here
63 _supported_fs xfs
64 _supported_os IRIX Linux
65
66 _require_scratch
67 _require_nobigloopfs
68
69
70 _fill()
71 {
72     if [ $# -ne 1 ]; then echo "Usage: _fill \"path\"" 1>&2 ; exit 1; fi
73     _do "Fill filesystem" \
74         "src/fill2fs --verbose --dir=$1 --seed=0 --filesize=65536 --stddev=32768 --list=- >>$tmp.manifest"
75 }
76
77 _do_die_on_error=message_only
78 rm -f $seq.full
79 #agsize=16
80 agsize=32
81 echo -n "Make $agsize megabyte filesystem on SCRATCH_DEV and mount... "
82 _do "_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1"
83 _do "_scratch_mount"
84 echo "done"
85
86 # full allocation group -> partial; partial -> expand partial + new partial;
87 # partial -> expand partial; partial -> full
88 # 17 -> 33 -> 35 -> 48 megabytes, converted to fs blocks below
89 # for size in 4352 8448 8960 12288
90 # 33 -> 67 -> 75 -> 96 converted to fs blocks:
91 for size in 8448 17512 19200 24576
92 do
93     _fill $SCRATCH_MNT/fill_$size
94     _do "Grow filesystem to $size blocks" "xfs_growfs -D ${size} $SCRATCH_MNT"
95     echo -n "Flush filesystem... "
96     _do "umount $SCRATCH_MNT"
97     _do "_scratch_mount"
98     echo "done"
99     echo -n "Check files... "
100     if ! _do "src/fill2fs_check $tmp.manifest"; then
101       echo "fail (see $seq.full)"
102       _do "cat $tmp.manifest"
103       _do "ls -altrR $SCRATCH_MNT"
104       _do "dd if=$SCRATCH_DEV bs=4096 count=$size | gzip -9 > $seq.fsimage.gz"
105       status=1 ; exit
106     fi
107     echo "done"
108 done
109
110 # success, all done
111 echo "Growfs tests passed."
112 status=0 ; exit