More merge conflicts
[xfstests-dev.git] / 085
1 #! /bin/sh
2 # FS QA Test No. 085
3 #
4 # To test log replay by shutdown of file system
5 # This is the first simple initial test to ensure that
6 # the goingdown ioctl is working and recovery of
7 # create transactions is working.
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
11
12 # This program is free software; you can redistribute it and/or modify it
13 # under the terms of version 2 of the GNU General Public License as
14 # published by the Free Software Foundation.
15
16 # This program is distributed in the hope that it would be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20 # Further, this software is distributed without any warranty that it is
21 # free of the rightful claim of any third person regarding infringement
22 # or the like.  Any license provided herein, whether implied or
23 # otherwise, applies only to this software file.  Patent licenses, if
24 # any, provided herein do not apply to combinations of this program with
25 # other software, or any other product whatsoever.
26
27 # You should have received a copy of the GNU General Public License along
28 # with this program; if not, write the Free Software Foundation, Inc., 59
29 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
30
31 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
32 # Mountain View, CA  94043, or:
33
34 # http://www.sgi.com 
35
36 # For further information regarding this notice, see: 
37
38 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
39 #-----------------------------------------------------------------------
40 #
41 # creator
42 owner=tes@melbourne.sgi.com
43
44 seq=`basename $0`
45 echo "QA output created by $seq"
46
47 here=`pwd`
48 tmp=/tmp/$$
49 status=1        # failure is the default!
50 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
51
52 # get standard environment, filters and checks
53 . ./common.rc
54 . ./common.filter
55
56 # put operating system in $os
57 _get_os
58
59 # real QA test starts here
60 _supported_fs xfs
61 _supported_os IRIX Linux
62
63 _do_logprint()
64 {
65     xfs_logprint -t $SCRATCH_DEV | tee -a $seq.full >$tmp.logprint
66     if grep -q "<DIRTY>" $tmp.logprint; then
67         echo "dirty log"
68     fi
69     if grep -q "<CLEAN>" $tmp.logprint; then
70         echo "clean log"
71     fi
72 }
73
74 rm -f $seq.full
75 rm -f $tmp.log
76
77
78 if [ $os == 'irix' ]; then
79     tail -f /var/adm/SYSLOG >$tmp.log &
80 elif [ $os == 'linux' ]; then
81     tail -f /var/log/messages >$tmp.log &
82 else
83     echo Error test $seq does not run on the operating system: `uname`
84     exit
85 fi
86
87 pid=$!
88 cp $tmp.log $tmp.log.orig # note the original log
89
90 _require_scratch
91
92 echo "mkfs"
93 _scratch_mkfs_xfs >>$seq.full 2>&1 \
94     || _fail "mkfs scratch failed"
95
96 echo "mount"
97 _scratch_mount >>$seq.full 2>&1 \
98     || _fail "mount failed: $MOUNT_OPTIONS"
99
100 echo "touch files"
101 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
102
103 echo "godown"
104 src/godown -v -f $SCRATCH_MNT >> $seq.full
105
106 echo "unmount"
107 umount $SCRATCH_MNT
108
109 echo "logprint after going down..."
110 _do_logprint
111
112 # curious if FS consistent at start
113 if false; then
114     if /usr/sbin/xfs_check $SCRATCH_DEV; then
115        echo "*** checked ok ***"
116     fi
117 fi
118
119 echo "mount with replay"
120 _scratch_mount $mnt >>$seq.full 2>&1 \
121     || _fail "mount failed: $mnt $MOUNT_OPTIONS"
122
123 echo "ls SCRATCH_MNT"
124 ls $SCRATCH_MNT
125
126 echo "unmount"
127 umount $SCRATCH_MNT
128
129 echo "logprint after mount and replay..."
130 _do_logprint
131
132 if _check_scratch_fs; then
133     echo "filesystem is checked ok"
134 else
135     echo "filesystem is NOT ok"
136 fi
137
138 # success, all done
139 status=0
140 exit