xfstests: randholes: document options a bit more
[xfstests-dev.git] / 087
1 #! /bin/bash
2 # FS QA Test No. 087
3 #
4 # * like 086 but want to create more/different kinds of metadata
5 #   and so will use fsstress
6 # * also can interrupt metadata with godown
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #
24 #-----------------------------------------------------------------------
25 #
26 # creator
27 owner=tes@melbourne.sgi.com
28
29 seq=`basename $0`
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
40 . ./common.log
41 . ./common.quota
42
43 _do_meta()
44 {
45     out=$SCRATCH_MNT/fsstress
46     count=10000
47     param="-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
48            -f rename=30 -f stat=30 -f unlink=30 -f truncate=20"
49     _echofull "calling fsstress $param -m8 -n $count"
50     if ! $FSSTRESS_PROG $param $FSSTRESS_AVOID -m 8 -n $count -d $out >>$seq.full 2>&1
51     then
52         _echofull "fsstress failed"
53     fi
54 }
55
56 # real QA test starts here
57 _supported_fs xfs
58 _supported_os IRIX Linux
59
60 rm -f $seq.full $tmp.*
61 _require_scratch
62 _require_v2log 
63 _require_xfs_quota
64
65 echo "*** init FS"
66 umount $SCRATCH_DEV >/dev/null 2>&1
67
68 cat >$tmp.seq.params <<EOF
69 # mkfs-opt             mount-opt
70 # ------------------------------
71   version=2            logbsize=32k
72   version=2,su=4096    logbsize=32k
73   version=2,su=32768   logbsize=32k
74   version=2            logbsize=64k
75   version=2,su=64k     logbsize=64k
76   version=2            logbsize=128k
77   version=2,su=128k    logbsize=128k
78   version=2            logbsize=256k
79   version=2,su=256k    logbsize=256k
80 EOF
81
82 cat $tmp.seq.params \
83 | while read mkfs mnt restofline
84 do
85     if [ "$mkfs" = "#" ]; then 
86         continue
87     fi
88
89     echo "--- mkfs=$mkfs, mnt=$mnt ---"
90     export MKFS_OPTIONS="-l $mkfs"
91     export MOUNT_OPTIONS="-o $mnt"
92
93     # mkfs the FS
94     _echofull "mkfs"
95     _scratch_mkfs_xfs >>$seq.full 2>&1
96     if [ $? -ne 0 ] ; then 
97         _echofull "mkfs failed: $MKFS_OPTIONS"
98         continue
99     fi
100
101     # mount the FS
102     _echofull "mount"
103     if ! _scratch_mount -o uquota >>$seq.full 2>&1; then
104         _echofull "mount failed: $MOUNT_OPTIONS"
105         continue
106     fi
107
108     # create the metadata
109     _do_meta
110
111     # check before on what FS should look like
112     _echofull "ls -RF SCRATCH_MNT"
113     ls -RF $SCRATCH_MNT >$tmp.ls1
114
115     _echofull "godown"
116     src/godown -v -f $SCRATCH_MNT >> $seq.full
117
118     _echofull "unmount"
119     umount $SCRATCH_DEV >>$seq.full 2>&1 \
120         || _fail "umount failed"
121
122     _echofull "logprint after going down..."
123     _print_logstate
124
125     _full "logprint headers"
126     _scratch_xfs_logprint -n >>$seq.full 2>&1
127
128     _echofull "mount with replay"
129     _scratch_mount -o uquota >>$seq.full 2>&1 \
130         || _fail "mount failed: $MOUNT_OPTIONS"
131
132     # check on what FS looks like after log recovery
133     _echofull "ls -RF SCRATCH_MNT"
134     ls -RF $SCRATCH_MNT >$tmp.ls2
135
136     _echofull "diff ls before and after"
137     diff -us $tmp.ls1 $tmp.ls2 | sed "s#$tmp#TMP#g"
138
139     _echofull "unmount"
140     umount $SCRATCH_MNT
141
142     _echofull "logprint after mount and replay..."
143     _print_logstate
144
145     if _check_scratch_fs; then
146         _echofull "filesystem is checked ok"
147     else
148         _echofull "filesystem is NOT ok"
149     fi
150 done
151
152 status=0 
153 exit