4 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like. Any license provided herein, whether implied or
17 # otherwise, applies only to this software file. Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA 94043, or:
30 # For further information regarding this notice, see:
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 # Control script for QA
37 # $Header: /build2/depot/linux/pcp/dev/qa/RCS/check,v 2.32 1999/10/18 06:58:20 kenmcd Exp $
49 # generic initialization
53 echo "check: failed to source common.rc"
59 echo "check: QA must be run as root"
65 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
77 # remove files that were used by hangcheck
79 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
80 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
87 if [ -f check.time -a -f $tmp.time ]
89 cat check.time $tmp.time \
93 for (i in t) print i " " t[i]
97 mv $tmp.out check.time
100 if [ -f $tmp.expunged ]
102 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
103 try=`expr $try - $notrun`
104 list=`echo "$list" | sed -f $tmp.expunged`
109 echo $list | fmt | sed -e 's/^/ /' >>check.log
110 $interrupt && echo "Interrupted!" >>check.log
112 if [ ! -z "$notrun" ]
114 echo "Not run:$notrun"
115 echo "Not run:$notrun" >>check.log
117 if [ ! -z "$n_bad" -a $n_bad != 0 ]
120 echo "Failed $n_bad of $try tests"
121 echo "Failures:$bad" | fmt >>check.log
122 echo "Failed $n_bad of $try tests" >>check.log
124 echo "Passed all $try tests"
125 echo "Passed all $try tests" >>check.log
133 trap "_wrapup; exit \$status" 0 1 2 3 15
136 # Save pid of check in a well known place, so that hangcheck can be sure it
137 # has the right pid (getting the pid from ps output is not reliable enough).
139 rm -rf /tmp/check.pid
140 echo $$ >/tmp/check.pid
143 # Save the status of check in a well known place, so that hangcheck can be
144 # sure to know where check is up to (getting test number from ps output is
145 # not reliable enough since the trace stuff has been introduced).
147 rm -rf /tmp/check.sts
148 echo "preamble" >/tmp/check.sts
150 # don't leave old full output behind on a clean run
153 # by default don't output timestamps
158 [ -f check.time ] || touch check.time
160 if [ ! -z "$MKFS_OPTIONS" ]
162 echo "check: \$MKFS_OPTIONS specified - \"$MKFS_OPTIONS\""
163 umount $SCRATCH_DEV 2>/dev/null
164 # call the overridden mkfs.xfs - make sure the FS is built
165 # the same as we'll create it later.
166 if ! mkfs_xfs -f $SCRATCH_DEV >$tmp.err 2>&1
168 echo "our local mkfs_xfs routine ..."
170 echo "check: failed to mkfs.xfs \$SCRATCH_DEV using specified options"
175 if [ ! -z "$MOUNT_OPTIONS" ]
177 echo "check: \$MOUNT_OPTIONS specified - \"$MOUNT_OPTIONS\""
179 # call the overridden mount - make sure the FS starts as
180 # the same as we'll set it later.
181 if ! mount -t xfs $TEST_DEV $TEST_DIR >$tmp.err 2>&1
183 echo "our local mount routine ..."
185 # call the normal mount
186 echo "normal mount ..."
187 /bin/mount -t xfs $TEST_DEV $TEST_DIR
188 echo "check: failed to mount \$TEST_DEV using specified mount options"
204 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
208 echo "/^$seq\$/d" >>$tmp.expunged
211 echo " - no such test?"
212 echo "/^$seq\$/d" >>$tmp.expunged
214 # really going to try and run this one
217 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
218 [ "X$lasttime" != X ] && echo -n " ${lasttime}s ..."
219 rm -f core $seq.notrun
222 echo "$seq" >/tmp/check.sts
225 $timestamp && _timestamp
226 sh $seq >$tmp.rawout 2>&1
228 $timestamp && _timestamp
231 _fix_malloc <$tmp.rawout >$tmp.out
236 echo -n " [dumped core]"
241 if [ -f $seq.notrun ]
243 echo -n " [not run] "
245 notrun="$notrun $seq"
249 echo -n " [failed, exit status $sts]"
254 echo " - no qualified output"
257 if diff $seq.out $tmp.out >/dev/null 2>&1
264 echo "$seq `expr $stop - $start`" >>$tmp.time
267 echo " - output mismatch (see $seq.out.bad)"
268 mv $tmp.out $seq.out.bad
269 $diff $seq.out $seq.out.bad
277 # come here for each test, except when $showme is true
282 n_bad=`expr $n_bad + 1`
285 [ -f $seq.notrun ] || try=`expr $try + 1`