Keep userspace packaging in sync; update srcdiff to grok moved dmapi source.
[xfstests-dev.git] / 086
1 #! /bin/sh
2 # FS QA Test No. 086
3 #
4 # To test log replay with version 2 logs
5 # Initially keep this simple with just creates.
6 # In another qa test we can do more e.g. use fsstress.
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 modify it
12 # under the terms of version 2 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, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19 # Further, this software is distributed without any warranty that it is
20 # free of the rightful claim of any third person regarding infringement
21 # or the like.  Any license provided herein, whether implied or
22 # otherwise, applies only to this software file.  Patent licenses, if
23 # any, provided herein do not apply to combinations of this program with
24 # other software, or any other product whatsoever.
25
26 # You should have received a copy of the GNU General Public License along
27 # with this program; if not, write the Free Software Foundation, Inc., 59
28 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
29
30 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
31 # Mountain View, CA  94043, or:
32
33 # http://www.sgi.com 
34
35 # For further information regarding this notice, see: 
36
37 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
38 #-----------------------------------------------------------------------
39 #
40 # creator
41 owner=root@icy.melbourne.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 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
50
51 # get standard environment, filters and checks
52 . ./common.rc
53 . ./common.filter
54 . ./common.log
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
64 echo "*** init FS"
65 umount $SCRATCH_DEV >/dev/null 2>&1
66
67 cat >$tmp.seq.params <<EOF
68 # mkfs-opt             mount-opt
69 # ------------------------------
70   version=2            logbsize=32k
71   version=2,su=4096    logbsize=32k
72   version=2,su=32768   logbsize=32k
73   version=2,su=32768   logbsize=64k
74   version=2            logbsize=64k
75   version=2            logbsize=128k
76   version=2            logbsize=256k
77 EOF
78
79 # Do the work for various log params which
80 # should not effect the data content of the log
81 # Try with and without sync'ing - sync'ing will mean that
82 # the log will be written out unfilled and thus the log 
83 # stripe can have an effect.
84 #
85 for s in sync nosync ; do
86     cat $tmp.seq.params \
87     | while read mkfs mnt restofline
88     do
89         if [ "$mkfs" = "#" ]; then 
90             continue
91         fi
92
93         echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---"
94         export MKFS_OPTIONS="-l $mkfs"
95         export MOUNT_OPTIONS="-o $mnt"
96
97         # mkfs the FS
98         _echofull "mkfs"
99         if ! _mkfs_log; then
100             _echofull "mkfs failed: $MKFS_OPTIONS"
101             continue
102         fi
103
104         # mount the FS
105         _echofull "mount"
106         if ! _scratch_mount >>$seq.full 2>&1; then
107             _echofull "mount failed: $MOUNT_OPTIONS"
108             continue
109         fi
110
111         # create the metadata
112         if [ $s = "sync" ]; then
113             # generate some log traffic - but not too much
114             # add some syncs to get the log flushed to disk 
115             for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
116                 touch $file
117                 sync
118             done
119         else
120             # generate some log traffic - but not too much - life gets a little
121             # more complicated if the log wraps around. This traffic is
122             # pretty much arbitary, but could probably be made better than this.
123             touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
124         fi
125
126         # check before on what FS should look like
127         _echofull "ls SCRATCH_MNT"
128         ls $SCRATCH_MNT
129
130         _echofull "godown"
131         src/godown -v -f $SCRATCH_MNT >> $seq.full
132
133         _echofull "unmount"
134         umount $SCRATCH_DEV >>$seq.full 2>&1 \
135             || _fail "umount failed"
136
137         _echofull "logprint after going down..."
138         _print_logstate
139
140         _echofull "mount with replay"
141         _scratch_mount >>$seq.full 2>&1 \
142             || _fail "mount failed: $MOUNT_OPTIONS"
143
144         # check on what FS looks like after log recovery
145         _echofull "ls SCRATCH_MNT"
146         ls $SCRATCH_MNT
147
148         _echofull "unmount"
149         umount $SCRATCH_MNT
150
151         _echofull "logprint after mount and replay..."
152         _print_logstate
153
154         if _check_scratch_fs; then
155             _echofull "filesystem is checked ok"
156         else
157             _echofull "filesystem is NOT ok"
158         fi
159     done
160 done
161
162 status=0 
163 exit