Test for NULL files problem.
[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 #
12 # creator
13 owner=root@icy.melbourne.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 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22
23 # get standard environment, filters and checks
24 . ./common.rc
25 . ./common.filter
26 . ./common.log
27
28 # real QA test starts here
29 _supported_fs xfs
30 _supported_os IRIX Linux
31
32 rm -f $seq.full $tmp.*
33 _require_scratch
34 _require_v2log
35
36 echo "*** init FS"
37 umount $SCRATCH_DEV >/dev/null 2>&1
38
39 cat >$tmp.seq.params <<EOF
40 # mkfs-opt             mount-opt
41 # ------------------------------
42   version=2            logbsize=32k
43   version=2,su=4096    logbsize=32k
44   version=2,su=32768   logbsize=32k
45   version=2,su=32768   logbsize=64k
46   version=2            logbsize=64k
47   version=2,su=64k     logbsize=64k
48   version=2            logbsize=128k
49   version=2,su=128k    logbsize=128k
50   version=2            logbsize=256k
51   version=2,su=256k    logbsize=256k
52 EOF
53
54 # Do the work for various log params which
55 # should not effect the data content of the log
56 # Try with and without sync'ing - sync'ing will mean that
57 # the log will be written out unfilled and thus the log 
58 # stripe can have an effect.
59 #
60 for s in sync nosync ; do
61     cat $tmp.seq.params \
62     | while read mkfs mnt restofline
63     do
64         if [ "$mkfs" = "#" ]; then 
65             continue
66         fi
67
68         echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---"
69         export MKFS_OPTIONS="-l $mkfs"
70         export MOUNT_OPTIONS="-o $mnt"
71
72         # mkfs the FS
73         _echofull "mkfs"
74         _scratch_mkfs_xfs >>$seq.full 2>&1
75         if [ $? -ne 0 ] ; then 
76             _echofull "mkfs failed: $MKFS_OPTIONS"
77             continue
78         fi
79
80         # mount the FS
81         _echofull "mount"
82         if ! _scratch_mount >>$seq.full 2>&1; then
83             _echofull "mount failed: $MOUNT_OPTIONS"
84             continue
85         fi
86
87         # create the metadata
88         if [ $s = "sync" ]; then
89             # generate some log traffic - but not too much
90             # add some syncs to get the log flushed to disk 
91             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
92                 touch $file
93                 sync
94             done
95         else
96             # generate some log traffic - but not too much - life gets a little
97             # more complicated if the log wraps around. This traffic is
98             # pretty much arbitary, but could probably be made better than this.
99             touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
100         fi
101
102         # check before on what FS should look like
103         _echofull "ls SCRATCH_MNT"
104         ls $SCRATCH_MNT
105
106         _echofull "godown"
107         src/godown -v -f $SCRATCH_MNT >> $seq.full
108
109         _echofull "unmount"
110         umount $SCRATCH_DEV >>$seq.full 2>&1 \
111             || _fail "umount failed"
112
113         _echofull "logprint after going down..."
114         _print_logstate
115
116         _echofull "mount with replay"
117         _scratch_mount >>$seq.full 2>&1 \
118             || _fail "mount failed: $MOUNT_OPTIONS"
119
120         # check on what FS looks like after log recovery
121         _echofull "ls SCRATCH_MNT"
122         ls $SCRATCH_MNT
123
124         _echofull "unmount"
125         umount $SCRATCH_MNT
126
127         _echofull "logprint after mount and replay..."
128         _print_logstate
129
130         if _check_scratch_fs; then
131             _echofull "filesystem is checked ok"
132         else
133             _echofull "filesystem is NOT ok"
134         fi
135     done
136 done
137
138 status=0 
139 exit