common.config minor changes
[xfstests-dev.git] / 044
1 #! /bin/sh
2 # FS QA Test No. 044
3 #
4 # external log uuid/format tests (TODO - version 2 log format)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=dxm@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20
21 # get standard environment, filters and checks
22 . ./common.rc
23 . ./common.filter
24
25 # real QA test starts here
26 _supported_fs xfs
27 _supported_os Linux
28
29 _require_logdev
30
31 _filter_logprint()
32 {
33         perl -ne '
34             s/data device: ([\w|\/.-]+)/data device: DDEV/;
35             s/log device: ([\w|\/.-]+) daddr: (\d+) length: (\d+)/log device: LDEV daddr: XXX length: XXX/;
36             s/log file: "([\w|\/.-]+)" daddr: (\d+) length: (\d+)/log device: LDEV daddr: XXX length: XXX/;
37             s/uuid: ([abcdef\d-]+)\s+format: (.+)/uuid: UUID format: FORMAT/;
38             s/skipped (\w+) zeroed blocks/skipped XXX zeroed blocks/;
39             print;
40         '
41 }
42
43 _check_mount()
44 {
45     echo "    *** mount (expect success)"
46     if ! _scratch_mount
47     then
48         echo "        !!! mount failed (expecting success)"
49         status=1
50         exit
51     fi
52
53     echo "    *** umount"
54     if ! umount $SCRATCH_DEV
55     then
56         echo "        !!! umount failed (expecting success)"
57         status=1
58         exit
59     fi
60 }
61
62 _check_no_mount()
63 {
64     echo "    *** mount (expect failure)"
65     if _scratch_mount >$tmp.err 2>&1
66     then
67         cat $tmp.err
68         echo "        !!! mount succeeded (expecting failure)"
69         status=1
70         exit
71     fi
72 }
73
74 _check_require_logdev()
75 {
76     echo "    *** mount without logdev (expect failure)"
77     if mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >$tmp.err 2>&1
78     then
79         cat $tmp.err
80         echo "        !!! mount succeeded (expecting failure)"
81         status=1
82         exit
83     fi
84 }
85
86 _unexpected()
87 {
88     echo "        !!! unexpected XFS command failure"
89     status=1
90     exit
91 }
92
93
94 # real QA test starts here
95
96 _require_scratch
97
98 echo "*** mkfs"
99
100 # this test only works for version 1 logs currently
101 lversion=1
102 lsize=16777216
103 _scratch_mkfs_xfs -lsize=$lsize,version=$lversion >$tmp.mkfs0 2>&1
104 [ $? -ne 0 ] && \
105     _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
106 _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
107 . $tmp.mkfs1
108 [ $lversion -ne 1 ] && \
109     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
110
111 _check_mount
112 _check_require_logdev
113
114 echo "*** set uuid"
115 xfs_db -x $SCRATCH_DEV -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
116 [ $? -ne 0 ] && _unexpected
117 _check_mount
118
119 echo "*** zero log"
120 $here/src/loggen -z 100 >$SCRATCH_LOGDEV
121 _check_mount
122
123 echo "*** write clean log"
124 $here/src/loggen -u 2 -f 1 -m 1 -z 100 >$SCRATCH_LOGDEV
125 _check_mount
126
127 echo "*** write clean log (different format)"
128 $here/src/loggen -u 2 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
129 _check_mount
130
131 echo "*** write clean log (different uuid)"
132 $here/src/loggen -u 7 -m 1 -z 100 >$SCRATCH_LOGDEV
133 _check_no_mount
134
135 echo "*** write clean log (different uuid & format)"
136 $here/src/loggen -u 7 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
137 _check_no_mount
138
139 echo "*** write dirty log"
140 $here/src/loggen -u 2 -e 1 -z 100 >$SCRATCH_LOGDEV
141 _check_mount
142
143 echo "*** write dirty log (different format)"
144 $here/src/loggen -u 2 -f 99 -e 1 -z 100 >$SCRATCH_LOGDEV
145 _check_no_mount
146
147 echo "*** write dirty log (irix style)"
148 $here/src/loggen -u 0 -f 0 -e 1 -z 100 >$SCRATCH_LOGDEV
149 _check_no_mount
150
151 echo "*** write large dirty log"
152 $here/src/loggen -u 2 -e 16000 -z 100 >$SCRATCH_LOGDEV
153 _check_mount
154
155 echo -e -n "\n\r*** XFS QA 044 - done\n\r\n\r" >/dev/console
156
157 status=0
158 # if error
159 exit