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 "$MOUNT_OPTIONS" ]
162 echo "check: \$MOUNT_OPTIONS specified - \"$MOUNT_OPTIONS\""
164 # call the overridden mount - make sure the FS starts as
165 # the same as we'll set it later.
166 if ! mount -t xfs $TEST_DEV $TEST_DIR >$tmp.err 2>&1
170 # call the normal mount
171 echo "normal mount ..."
172 /bin/mount -t xfs $TEST_DEV $TEST_DIR
173 echo "check: failed to mount \$TEST_DEV using specified mount options"
189 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
193 echo "/^$seq\$/d" >>$tmp.expunged
196 echo " - no such test?"
197 echo "/^$seq\$/d" >>$tmp.expunged
199 # really going to try and run this one
202 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
203 [ "X$lasttime" != X ] && echo -n " ${lasttime}s ..."
204 rm -f core $seq.notrun
207 echo "$seq" >/tmp/check.sts
210 $timestamp && _timestamp
211 sh $seq >$tmp.rawout 2>&1
213 $timestamp && _timestamp
216 _fix_malloc <$tmp.rawout >$tmp.out
221 echo -n " [dumped core]"
226 if [ -f $seq.notrun ]
228 echo -n " [not run] "
230 notrun="$notrun $seq"
234 echo -n " [failed, exit status $sts]"
239 echo " - no qualified output"
242 if diff $seq.out $tmp.out >/dev/null 2>&1
249 echo "$seq `expr $stop - $start`" >>$tmp.time
252 echo " - output mismatch (see $seq.out.bad)"
253 mv $tmp.out $seq.out.bad
254 $diff $seq.out $seq.out.bad
262 # come here for each test, except when $showme is true
267 n_bad=`expr $n_bad + 1`
270 [ -f $seq.notrun ] || try=`expr $try + 1`