Dont rebuild .pot file always, for fresh checkouts it will be readonly
[xfstests-dev.git] / 018
1 #! /bin/sh
2 # XFS QA Test No. 018
3 #
4 # xfs_logprint test
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
12
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like.  Any license provided herein, whether implied or
20 # otherwise, applies only to this software file.  Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
23
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
27
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA  94043, or:
30
31 # http://www.sgi.com 
32
33 # For further information regarding this notice, see: 
34
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
37 #
38 # creator
39 owner=dxm@sgi.com
40
41 seq=`basename $0`
42 echo "QA output created by $seq"
43
44 here=`pwd`
45 tmp=/tmp/$$
46 status=0        # success is the default!
47
48 # get standard environment, filters and checks
49 . ./common.rc
50 . ./common.filter
51
52 _cleanup()
53 {
54     rm -f $tmp.*
55     echo "*** unmount"
56     umount $SCRATCH_MNT 2>/dev/null
57 }
58 trap "_cleanup; exit \$status" 0 1 2 3 15
59
60 _full()
61 {
62     echo ""            >>$seq.full      
63     echo "*** $* ***"  >>$seq.full
64     echo ""            >>$seq.full
65 }
66
67 _filter_logprint()
68 {
69     sed '
70         s/data device: 0x[0-9a-f][0-9a-f]*/data device: <DEVICE>/;
71         s/log device: 0x[0-9a-f][0-9a-f]*/log device: <DEVICE>/;
72         s/log file: \".*\"/log device: <DEVICE>/;
73         s/daddr: [0-9][0-9]*/daddr: <DADDR>/;
74         s/length: [0-9][0-9]*/length: <LENGTH>/;
75         s/length: [0-9][0-9]*/length: <LENGTH>/;
76         s/^cycle num overwrites: .*$/cycle num overwrites: <TIDS>/;
77         s/tid: [0-9a-f][0-9a-f]*/tid: <TID>/;
78         s/tid:0x[0-9a-f][0-9a-f]*/tid:<TID>/;
79         s/q:0x[0-9a-f][0-9a-f]*/q:<Q>/;
80         s/a:0x[0-9a-f][0-9a-f]*/a:<A>/g;
81         s/blkno:0x[0-9a-f][0-9a-f]*/blkno:<BLKNO>/g;
82         s/blkno: [0-9][0-9]* (0x[0-9a-f]*)/blkno: <BLKNO> (<BLKNO>)/g;
83         s/blkno: [0-9][0-9]*/blkno: <BLKNO>/g;
84         s/boff: [0-9][0-9]*/boff: <BOFF>/g;
85         s/len: *[0-9][0-9]*/len:<LEN>/g;
86         s/skipped [0-9][0-9]* zeroed blocks/skipped <COUNT> zeroed blocks/;
87         s/atime:[0-9a-fx]*  *mtime:[0-9a-fx]*  *ctime:[0-9a-fx]*/atime:<TIME>  mtime:<TIME>  ctime:<TIME>/;
88         s/atime 0x[0-9a-f]* mtime 0x[0-9a-f]* ctime 0x[0-9a-f]*/atime <TIME>  mtime <TIME>  ctime <TIME>/;
89         s/block [0-9][0-9]*/block <BLOCK>/;
90         s/icount: *[0-9][0-9]*  *ifree: *[0-9][0-9]*  *fdblks: *[0-9][0-9]*  *frext: *[0-9][0-9]*/icount:<COUNT> ifree:<FREE> fdblks:<BLOCKS> frext:<COUNT>/;
91         s/sunit: *[0-9][0-9]*  *swidth: *[0-9][0-9]*/sunit:<SUNIT> swidth:<SWIDTH>/;
92         s/1st: *[0-9][0-9]*  *last: *[0-9][0-9]*  *cnt: *[0-9][0-9]*  *freeblks: *[0-9][0-9]*  *longest: *[0-9][0-9]*/1st:<NUM> last:<NUM> cnt:<COUNT> freeblks:<COUNT> longest:<NUM>/;
93         s/^uuid: *[0-9a-f-][0-9a-f-]* *format: *.*$/uuid: <UUID> format: <FORMAT>/;
94     '
95 }
96
97 _check_log()
98 {
99     _full "clean_log : xfs_logprint"
100     _scratch_xfs_logprint -t       | tee -a $seq.full \
101         | head | grep -q "<CLEAN>" || _fail "DIRTY LOG"
102     echo "### xfs_logprint output ###"
103     _scratch_xfs_logprint 2>&1 | _filter_logprint
104     echo "### xfs_logprint -t -i -s 0 output ###"
105     _scratch_xfs_logprint -t -i -s 0 2>&1 | _filter_logprint
106     echo "### xfs_logprint -t -b -s 0 output ###"
107     _scratch_xfs_logprint -t -b -s 0 2>&1 | _filter_logprint
108 }
109
110 # real QA test starts here
111
112 _require_scratch
113
114 echo "*** init FS"
115
116 touch $seq.out
117 umount $SCRATCH_DEV >/dev/null 2>&1
118
119 _full "mkfs"
120
121 _scratch_mkfs_xfs -lsize=2000b >$tmp.mkfs0 2>&1
122 [ $? -ne 0 ] && \
123     _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
124 _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs
125 source $tmp.mkfs
126 [ $dbsize -eq 4096 ] \
127     || _notrun "Logprint test, tailored to 4K blocks ($dbsize in use)"
128 [ $isize -eq 256 ] \
129     || _notrun "Logprint test, tailored to 256b inodes ($isize in use)"
130 [ $lversion -eq 1 ]  \
131     || _notrun "Logprint test, tailored to v1 log format (v$lversion in use)"
132
133 rm -f $seq.out $seq.full
134
135 _full " mount"
136 _scratch_mount >>$seq.full 2>&1 \
137     || _fail "mount failed"
138
139 _setup_seq_out
140
141 # generate some log traffic - but not too much - life gets a little
142 # more complicated if the log wraps around. This traffic is
143 # pretty much arbitary, but could probably be made better than this.
144
145 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
146     
147 _full "umount"
148 umount $SCRATCH_DEV >>$seq.full 2>&1 \
149     || _fail "umount failed"
150
151 _check_log
152
153 rm $seq.full
154 exit