make sure the test shows any garbage output.
[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 #
11 set +x
12 # creator
13 owner=ajag@sgi.com
14
15 seq=`basename $0`
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21
22 _cleanup()
23 {
24     cd /
25     umount $SCRATCH_MNT
26     rm -f $tmp.*
27 }
28 trap "_cleanup ; exit \$status" 0 1 2 3 15
29
30 # get standard environment, filters and checks
31 . ./common.rc
32 . ./common.filter
33
34 # real QA test starts here
35 _supported_fs xfs
36 _supported_os IRIX Linux
37
38 _require_scratch
39 _require_nobigloopfs
40 umount $SCRATCH_DEV 2>/dev/null
41
42 _fill()
43 {
44     if [ $# -ne 1 ]; then echo "Usage: _fill \"path\"" 1>&2 ; exit 1; fi
45     _do "Fill filesystem" \
46         "src/fill2fs --verbose --dir=$1 --seed=0 --filesize=65536 --stddev=32768 --list=- >>$tmp.manifest"
47 }
48
49 _do_die_on_error=message_only
50 rm -f $seq.full
51 agsize=32
52 echo -n "Make $agsize megabyte filesystem on SCRATCH_DEV and mount... "
53 _scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 2>&1 >/dev/null || _fail "mkfs failed"
54 bsize=`_scratch_mkfs_xfs -dsize=${agsize}m,agcount=1 2>&1 | _filter_mkfs 2>&1 \
55                 | perl -ne 'if (/dbsize=(\d+)/) {print $1;}'`
56 onemeginblocks=`expr 1048576 / $bsize`
57 _scratch_mount || _fail "mount failed"
58
59 echo "done"
60
61 # full allocation group -> partial; partial -> expand partial + new partial;
62 # partial -> expand partial; partial -> full
63 # cycle through 33m -> 67m -> 75m -> 96m
64 for size in 33 67 75 96
65 do
66     grow_size=`expr $size \* $onemeginblocks`
67     _fill $SCRATCH_MNT/fill_$size
68     _do "Grow filesystem to ${size}m" "xfs_growfs -D $grow_size $SCRATCH_MNT"
69     echo -n "Flush filesystem... "
70     _do "umount $SCRATCH_MNT"
71     _do "_scratch_mount"
72     echo "done"
73     echo -n "Check files... "
74     if ! _do "src/fill2fs_check $tmp.manifest"; then
75       echo "fail (see $seq.full)"
76       _do "cat $tmp.manifest"
77       _do "ls -altrR $SCRATCH_MNT"
78       _do "dd if=$SCRATCH_DEV bs=4096 count=$grow_size | gzip -9 > $seq.fsimage.gz"
79       status=1 ; exit
80     fi
81     echo "done"
82 done
83
84 # success, all done
85 echo "Growfs tests passed."
86 status=0 ; exit