common/log: add _get_log_configs for testing options
[xfstests-dev.git] / tests / xfs / 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
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common/rc
38 . ./common/filter
39 . ./common/log
40 . ./common/quota
41
42 _do_meta()
43 {
44     out=$SCRATCH_MNT/fsstress
45     count=10000
46     param="-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
47            -f rename=30 -f stat=30 -f unlink=30 -f truncate=20"
48     _echofull "calling fsstress $param -m8 -n $count"
49     FSSTRESS_ARGS=`_scale_fsstress_args $param $FSSTRESS_AVOID -m 8 -n $count -d $out`
50     if ! $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.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 $seqres.full $tmp.*
61 _require_scratch
62 _require_scratch_shutdown
63 _require_logstate
64 _require_v2log 
65 _require_xfs_quota
66
67 echo "*** init FS"
68 umount $SCRATCH_DEV >/dev/null 2>&1
69
70 _get_log_configs > $tmp.seq.params
71
72 cat $tmp.seq.params \
73 | while read mkfs mnt restofline
74 do
75     if [ "$mkfs" = "#" ]; then 
76         continue
77     fi
78
79     echo "--- mkfs=$mkfs, mnt=$mnt ---" >> $seqres.full
80     export MKFS_OPTIONS="-l $mkfs"
81     export MOUNT_OPTIONS="-o $mnt"
82
83     # mkfs the FS
84     _echofull "mkfs"
85     _scratch_mkfs_xfs >>$seqres.full 2>&1
86     if [ $? -ne 0 ] ; then 
87         _echofull "mkfs failed: $MKFS_OPTIONS"
88         continue
89     fi
90
91     # mount the FS
92     _echofull "mount"
93     if ! _scratch_mount -o uquota >>$seqres.full 2>&1; then
94         _echofull "mount failed: $MOUNT_OPTIONS"
95         continue
96     fi
97
98     # create the metadata
99     _do_meta
100
101     # check before on what FS should look like
102     _echofull "ls -RF SCRATCH_MNT"
103     ls -RF $SCRATCH_MNT >$tmp.ls1
104
105     _echofull "godown"
106     src/godown -v -f $SCRATCH_MNT >> $seqres.full
107
108     _echofull "unmount"
109     umount $SCRATCH_DEV >>$seqres.full 2>&1 \
110         || _fail "umount failed"
111
112     _echofull "logprint after going down..."
113     _print_logstate
114
115     _full "logprint headers"
116     _scratch_xfs_logprint -n >>$seqres.full 2>&1
117
118     _echofull "mount with replay"
119     _scratch_mount -o uquota >>$seqres.full 2>&1 \
120         || _fail "mount failed: $MOUNT_OPTIONS"
121
122     # check on what FS looks like after log recovery
123     _echofull "ls -RF SCRATCH_MNT"
124     ls -RF $SCRATCH_MNT >$tmp.ls2
125
126     _echofull "diff ls before and after"
127     diff -us $tmp.ls1 $tmp.ls2 | sed "s#$tmp#TMP#g"
128
129     _echofull "unmount"
130     umount $SCRATCH_MNT
131
132     _echofull "logprint after mount and replay..."
133     _print_logstate
134
135     if _check_scratch_fs; then
136         _echofull "filesystem is checked ok"
137     else
138         _echofull "filesystem is NOT ok"
139     fi
140 done
141
142 status=0 
143 exit