Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 317 lines (275 sloc) 6.919 kb
771e69de » dchinner
2010-01-20 xfstests: Convert all tests to use /bin/bash
1 #!/bin/bash
045da692 » fsgqa
2002-05-07 get some default MKFS_OPTIONS and MOUNT_OPTIONS happening so its more
2 #
3 # Control script for QA
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
4 #
4800bae8 » Andrew Jones
2006-07-07 The test device is now used as a nfs filesystem.
5 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc. All Rights Reserved.
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
6 #
491d467f » Felix Blyakher
2009-06-05 Add GPL license plate to SGI's files.
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation.
10 #
11 # This program is distributed in the hope that it would be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write the Free Software Foundation,
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #
20 #
045da692 » fsgqa
2002-05-07 get some default MKFS_OPTIONS and MOUNT_OPTIONS happening so its more
21
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
22 tmp=/tmp/$$
23 status=0
24 needwrap=true
2014d88a » sandeen
2009-05-28 Report which tests did get run
25 n_try=0
26 try=""
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
27 n_bad=0
28 bad=""
29 notrun=""
30 interrupt=true
31
048a7a8a » ptools
2004-06-15 More merge conflicts
32 export QA_CHECK_FS=${QA_CHECK_FS:=true}
33
4800bae8 » Andrew Jones
2006-07-07 The test device is now used as a nfs filesystem.
34 # by default don't output timestamps
35 timestamp=${TIMESTAMP:=false}
36
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
37 # generic initialization
38 iam=check
4800bae8 » Andrew Jones
2006-07-07 The test device is now used as a nfs filesystem.
39
40 # we need common.config
41 if ! . ./common.config
42 then
43 echo "$iam: failed to source common.config"
44 exit 1
45 fi
46
47 # we need common
48 . ./common
49
50
51 # we need common.rc
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
52 if ! . ./common.rc
53 then
54 echo "check: failed to source common.rc"
55 exit 1
56 fi
57
048a7a8a » ptools
2004-06-15 More merge conflicts
58 if [ `id -u` -ne 0 ]
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
59 then
60 echo "check: QA must be run as root"
61 exit 1
62 fi
63
64 _wallclock()
65 {
66 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
67 }
68
048a7a8a » ptools
2004-06-15 More merge conflicts
69 _timestamp()
70 {
81f3c307 » ptools
2004-06-18 Fix issue with TIMESTAMP and added asg qa machines to common.config
71 now=`date "+%T"`
048a7a8a » ptools
2004-06-15 More merge conflicts
72 echo -n " [$now]"
73 }
74
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
75 _wrapup()
76 {
77 # for hangcheck ...
78 # remove files that were used by hangcheck
79 #
80 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
81 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
82
83 if $showme
84 then
85 :
86 elif $needwrap
87 then
88 if [ -f check.time -a -f $tmp.time ]
89 then
90 cat check.time $tmp.time \
91 | $AWK_PROG '
92 { t[$1] = $2 }
93 END { if (NR > 0) {
94 for (i in t) print i " " t[i]
95 }
96 }' \
97 | sort -n >$tmp.out
98 mv $tmp.out check.time
99 fi
100
101 if [ -f $tmp.expunged ]
102 then
103 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
2014d88a » sandeen
2009-05-28 Report which tests did get run
104 n_try=`expr $n_try - $notrun`
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
105 list=`echo "$list" | sed -f $tmp.expunged`
106 fi
107
108 echo "" >>check.log
109 date >>check.log
110 echo $list | fmt | sed -e 's/^/ /' >>check.log
111 $interrupt && echo "Interrupted!" >>check.log
112
2014d88a » sandeen
2009-05-28 Report which tests did get run
113 if [ ! -z "$n_try" -a $n_try != 0 ]
114 then
115 echo "Ran:$try"
116 fi
117
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
118 if [ ! -z "$notrun" ]
119 then
120 echo "Not run:$notrun"
121 echo "Not run:$notrun" >>check.log
122 fi
2014d88a » sandeen
2009-05-28 Report which tests did get run
123
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
124 if [ ! -z "$n_bad" -a $n_bad != 0 ]
125 then
126 echo "Failures:$bad"
2014d88a » sandeen
2009-05-28 Report which tests did get run
127 echo "Failed $n_bad of $n_try tests"
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
128 echo "Failures:$bad" | fmt >>check.log
2014d88a » sandeen
2009-05-28 Report which tests did get run
129 echo "Failed $n_bad of $n_try tests" >>check.log
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
130 else
2014d88a » sandeen
2009-05-28 Report which tests did get run
131 echo "Passed all $n_try tests"
132 echo "Passed all $n_try tests" >>check.log
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
133 fi
134 needwrap=false
135 fi
136
592df97d » fsgqa
2003-08-15 Add a new growfs test 078, and do a better job of cleaning tmp files …
137 rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
138 rm -f /tmp/check.pid /tmp/check.sts
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
139 rm -f $tmp.*
140 }
141
142 trap "_wrapup; exit \$status" 0 1 2 3 15
143
144 # for hangcheck ...
145 # Save pid of check in a well known place, so that hangcheck can be sure it
146 # has the right pid (getting the pid from ps output is not reliable enough).
147 #
148 rm -rf /tmp/check.pid
149 echo $$ >/tmp/check.pid
150
151 # for hangcheck ...
152 # Save the status of check in a well known place, so that hangcheck can be
153 # sure to know where check is up to (getting test number from ps output is
154 # not reliable enough since the trace stuff has been introduced).
155 #
156 rm -rf /tmp/check.sts
157 echo "preamble" >/tmp/check.sts
158
159 # don't leave old full output behind on a clean run
160 rm -f check.full
161
162 [ -f check.time ] || touch check.time
163
40690b12 » Christoph Hellwig
2009-07-07 don't print scratch mkfs and mount options without scratch device
164 # print out our test configuration
165 echo "FSTYP -- `_full_fstyp_details`"
166 echo "PLATFORM -- `_full_platform_details`"
167 if [ ! -z "$SCRATCH_DEV" ]; then
168 echo "MKFS_OPTIONS -- `_scratch_mkfs_options`"
169 echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
170 fi
171 echo
172
048a7a8a » ptools
2004-06-15 More merge conflicts
173
74cff057 » Christoph Hellwig
2009-06-04 xfstests: fix syntax error in check
174 if [ ! -z "$SCRATCH_DEV" ]; then
3ae9f2f8 » sandeen
2009-06-03 Make the SCRATCH_DEV optional
175 umount $SCRATCH_DEV 2>/dev/null
176 # call the overridden mkfs - make sure the FS is built
177 # the same as we'll create it later.
178
179 if ! _scratch_mkfs $flag >$tmp.err 2>&1
180 then
181 echo "our local _scratch_mkfs routine ..."
182 cat $tmp.err
183 echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
184 exit 1
185 fi
186
187 # call the overridden mount - make sure the FS mounts with
188 # the same options that we'll mount with later.
189 if ! _scratch_mount >$tmp.err 2>&1
190 then
191 echo "our local mount routine ..."
192 cat $tmp.err
193 echo "check: failed to mount \$SCRATCH_DEV using specified options"
194 exit 1
195 fi
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
196 fi
197
198 seq="check"
8050efd4 » fsgqa
2003-05-22 Numerous changes to QA scripts allowing tests to run with external lo…
199 _check_test_fs
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
200
b698d3d5 » Allan Randall
2006-06-15 Added feature to allow remaining tests to be written to file
201 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG
202
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
203 for seq in $list
204 do
205 err=false
206 echo -n "$seq"
b698d3d5 » Allan Randall
2006-06-15 Added feature to allow remaining tests to be written to file
207 if [ -n "$TESTS_REMAINING_LOG" ] ; then
208 sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp
209 mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG
210 sync
211 fi
212
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
213 if $showme
214 then
215 echo
216 continue
217 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
218 then
219 echo " - expunged"
220 rm -f $seq.out.bad
221 echo "/^$seq\$/d" >>$tmp.expunged
222 elif [ ! -f $seq ]
223 then
224 echo " - no such test?"
225 echo "/^$seq\$/d" >>$tmp.expunged
226 else
227 # really going to try and run this one
228 #
229 rm -f $seq.out.bad
230 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
71e65996 » Nathan Scott
2002-11-22 Another pretty-print output change for QA "check" script.
231 if [ "X$lasttime" != X ]; then
232 echo -n " ${lasttime}s ..."
233 else
234 echo -n " " # prettier output with timestamps.
235 fi
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
236 rm -f core $seq.notrun
237
238 # for hangcheck ...
239 echo "$seq" >/tmp/check.sts
240
241 start=`_wallclock`
b9bc9eee » Nathan Scott
2002-11-21 simplify the check script timestamping, it was too verbose to be useful.
242 $timestamp && echo -n " ["`date "+%T"`"]"
e23849bf » fsgqa
2004-04-23 cleanup some qa stuff
243 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
244 ./$seq >$tmp.rawout 2>&1
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
245 sts=$?
048a7a8a » ptools
2004-06-15 More merge conflicts
246 $timestamp && _timestamp
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
247 stop=`_wallclock`
248
249 _fix_malloc <$tmp.rawout >$tmp.out
250 rm -f $tmp.rawout
251
252 if [ -f core ]
253 then
254 echo -n " [dumped core]"
255 mv core $seq.core
256 err=true
257 fi
258
259 if [ -f $seq.notrun ]
260 then
b53d1fb4 » Nathan Scott
2002-11-22 Yet another pretty print change to "check" script with timestamps ena…
261 $timestamp || echo -n " [not run] "
27d11d52 » Nathan Scott
2002-11-25 Make quota a suggested package at someones request (john@yahoo?) and fix
262 $timestamp && echo " [not run]" && echo -n " $seq -- "
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
263 cat $seq.notrun
264 notrun="$notrun $seq"
265 else
266 if [ $sts -ne 0 ]
267 then
268 echo -n " [failed, exit status $sts]"
269 err=true
270 fi
271 if [ ! -f $seq.out ]
272 then
273 echo " - no qualified output"
274 err=true
275 else
276 if diff $seq.out $tmp.out >/dev/null 2>&1
277 then
278 if $err
279 then
280 :
281 else
282 echo "$seq `expr $stop - $start`" >>$tmp.time
a323184c » Lukas Czerner
2010-07-08 xfstests: Show duration of current test
283 echo -n " `expr $stop - $start`s"
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
284 fi
a323184c » Lukas Czerner
2010-07-08 xfstests: Show duration of current test
285 echo ""
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
286 else
287 echo " - output mismatch (see $seq.out.bad)"
288 mv $tmp.out $seq.out.bad
289 $diff $seq.out $seq.out.bad
290 err=true
291 fi
292 fi
293 fi
294
295 fi
296
297 # come here for each test, except when $showme is true
298 #
299 if $err
300 then
301 bad="$bad $seq"
302 n_bad=`expr $n_bad + 1`
303 quick=false
304 fi
2014d88a » sandeen
2009-05-28 Report which tests did get run
305 if [ ! -f $seq.notrun ]
306 then
307 try="$try $seq"
308 n_try=`expr $n_try + 1`
41c40276 » tytso
2009-06-20 skip _check_test_fs unless a test is actually run
309 _check_test_fs
2014d88a » sandeen
2009-05-28 Report which tests did get run
310 fi
27fba05e » Nathan Scott
2001-01-15 cmd/xfs/stress/001 1.6 Renamed to cmd/xfstests/001
311
312 seq="after_$seq"
313 done
314
315 interrupt=false
316 status=`expr $n_bad`
317 exit
Something went wrong with that request. Please try again.