3 # Control script for QA
5 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of version 2 of the GNU General Public License as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it would be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # Further, this software is distributed without any warranty that it is
16 # free of the rightful claim of any third person regarding infringement
17 # or the like. Any license provided herein, whether implied or
18 # otherwise, applies only to this software file. Patent licenses, if
19 # any, provided herein do not apply to combinations of this program with
20 # other software, or any other product whatsoever.
22 # You should have received a copy of the GNU General Public License along
23 # with this program; if not, write the Free Software Foundation, Inc., 59
24 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
26 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 # Mountain View, CA 94043, or:
31 # For further information regarding this notice, see:
33 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 export MKFS_OPTIONS=${MKFS_OPTIONS:=-bsize=4096}
37 export MOUNT_OPTIONS=${MOUNT_OPTIONS:=-ologbufs=2}
48 # generic initialization
52 echo "check: failed to source common.rc"
58 echo "check: QA must be run as root"
64 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
76 # remove files that were used by hangcheck
78 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
79 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
86 if [ -f check.time -a -f $tmp.time ]
88 cat check.time $tmp.time \
92 for (i in t) print i " " t[i]
96 mv $tmp.out check.time
99 if [ -f $tmp.expunged ]
101 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
102 try=`expr $try - $notrun`
103 list=`echo "$list" | sed -f $tmp.expunged`
108 echo $list | fmt | sed -e 's/^/ /' >>check.log
109 $interrupt && echo "Interrupted!" >>check.log
111 if [ ! -z "$notrun" ]
113 echo "Not run:$notrun"
114 echo "Not run:$notrun" >>check.log
116 if [ ! -z "$n_bad" -a $n_bad != 0 ]
119 echo "Failed $n_bad of $try tests"
120 echo "Failures:$bad" | fmt >>check.log
121 echo "Failed $n_bad of $try tests" >>check.log
123 echo "Passed all $try tests"
124 echo "Passed all $try tests" >>check.log
132 trap "_wrapup; exit \$status" 0 1 2 3 15
135 # Save pid of check in a well known place, so that hangcheck can be sure it
136 # has the right pid (getting the pid from ps output is not reliable enough).
138 rm -rf /tmp/check.pid
139 echo $$ >/tmp/check.pid
142 # Save the status of check in a well known place, so that hangcheck can be
143 # sure to know where check is up to (getting test number from ps output is
144 # not reliable enough since the trace stuff has been introduced).
146 rm -rf /tmp/check.sts
147 echo "preamble" >/tmp/check.sts
149 # don't leave old full output behind on a clean run
152 # by default don't output timestamps
153 timestamp=${TIMESTAMP:=false}
157 [ -f check.time ] || touch check.time
159 if [ ! -z "$MKFS_OPTIONS" ]
161 echo "check: \$MKFS_OPTIONS specified -- \"$MKFS_OPTIONS\""
162 umount $SCRATCH_DEV 2>/dev/null
163 # call the overridden mkfs.xfs - make sure the FS is built
164 # the same as we'll create it later.
165 if ! mkfs_xfs -f $SCRATCH_DEV >$tmp.err 2>&1
167 echo "our local mkfs_xfs routine ..."
169 echo "check: failed to mkfs.xfs \$SCRATCH_DEV using specified options"
174 if [ ! -z "$MOUNT_OPTIONS" ]
176 echo "check: \$MOUNT_OPTIONS specified -- \"$MOUNT_OPTIONS\""
178 # call the overridden mount - make sure the FS starts as
179 # the same as we'll set it later.
180 if ! mount -t xfs $TEST_DEV $TEST_DIR >$tmp.err 2>&1
182 echo "our local mount routine ..."
184 # call the normal mount
185 echo "normal mount ..."
186 /bin/mount -t xfs $TEST_DEV $TEST_DIR
187 echo "check: failed to mount \$TEST_DEV using specified mount options"
203 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
207 echo "/^$seq\$/d" >>$tmp.expunged
210 echo " - no such test?"
211 echo "/^$seq\$/d" >>$tmp.expunged
213 # really going to try and run this one
216 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
217 [ "X$lasttime" != X ] && echo -n " ${lasttime}s ..."
218 rm -f core $seq.notrun
221 echo "$seq" >/tmp/check.sts
224 $timestamp && _timestamp
225 sh $seq >$tmp.rawout 2>&1
227 $timestamp && _timestamp
230 _fix_malloc <$tmp.rawout >$tmp.out
235 echo -n " [dumped core]"
240 if [ -f $seq.notrun ]
242 echo -n " [not run] "
244 notrun="$notrun $seq"
248 echo -n " [failed, exit status $sts]"
253 echo " - no qualified output"
256 if diff $seq.out $tmp.out >/dev/null 2>&1
263 echo "$seq `expr $stop - $start`" >>$tmp.time
266 echo " - output mismatch (see $seq.out.bad)"
267 mv $tmp.out $seq.out.bad
268 $diff $seq.out $seq.out.bad
276 # come here for each test, except when $showme is true
281 n_bad=`expr $n_bad + 1`
284 [ -f $seq.notrun ] || try=`expr $try + 1`