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/
45 export QA_CHECK_FS=${QA_CHECK_FS:=true}
47 # generic initialization
51 echo "check: failed to source common.rc"
57 echo "check: QA must be run as root"
63 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
75 # remove files that were used by hangcheck
77 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
78 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
85 if [ -f check.time -a -f $tmp.time ]
87 cat check.time $tmp.time \
91 for (i in t) print i " " t[i]
95 mv $tmp.out check.time
98 if [ -f $tmp.expunged ]
100 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
101 try=`expr $try - $notrun`
102 list=`echo "$list" | sed -f $tmp.expunged`
107 echo $list | fmt | sed -e 's/^/ /' >>check.log
108 $interrupt && echo "Interrupted!" >>check.log
110 if [ ! -z "$notrun" ]
112 echo "Not run:$notrun"
113 echo "Not run:$notrun" >>check.log
115 if [ ! -z "$n_bad" -a $n_bad != 0 ]
118 echo "Failed $n_bad of $try tests"
119 echo "Failures:$bad" | fmt >>check.log
120 echo "Failed $n_bad of $try tests" >>check.log
122 echo "Passed all $try tests"
123 echo "Passed all $try tests" >>check.log
128 rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
129 rm -f /tmp/check.pid /tmp/check.sts
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
154 timestamp=${TIMESTAMP:=false}
158 [ -f check.time ] || touch check.time
160 FULL_FSTYP_DETAILS=`_full_fstyp_details`
161 FULL_HOST_DETAILS=`_full_platform_details`
162 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
163 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
166 FSTYP -- $FULL_FSTYP_DETAILS
167 PLATFORM -- $FULL_HOST_DETAILS
168 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
169 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
173 umount $SCRATCH_DEV 2>/dev/null
174 # call the overridden mkfs.xfs - make sure the FS is built
175 # the same as we'll create it later.
177 if ! _scratch_mkfs_xfs $flag >$tmp.err 2>&1
179 echo "our local _scratch_mkfs_xfs routine ..."
181 echo "check: failed to mkfs.xfs \$SCRATCH_DEV using specified options"
185 # call the overridden mount - make sure the FS mounts with
186 # the same options that we'll mount with later.
187 if ! _scratch_mount >$tmp.err 2>&1
189 echo "our local mount routine ..."
191 echo "check: failed to mount \$SCRATCH_DEV using specified options"
206 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
210 echo "/^$seq\$/d" >>$tmp.expunged
213 echo " - no such test?"
214 echo "/^$seq\$/d" >>$tmp.expunged
216 # really going to try and run this one
219 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
220 if [ "X$lasttime" != X ]; then
221 echo -n " ${lasttime}s ..."
223 echo -n " " # prettier output with timestamps.
225 rm -f core $seq.notrun
228 echo "$seq" >/tmp/check.sts
231 $timestamp && echo -n " ["`date "+%T"`"]"
232 sh $seq >$tmp.rawout 2>&1
233 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
234 ./$seq >$tmp.rawout 2>&1
236 $timestamp && _timestamp
239 _fix_malloc <$tmp.rawout >$tmp.out
244 echo -n " [dumped core]"
249 if [ -f $seq.notrun ]
251 $timestamp || echo -n " [not run] "
252 $timestamp && echo " [not run]" && echo -n " $seq -- "
254 notrun="$notrun $seq"
258 echo -n " [failed, exit status $sts]"
263 echo " - no qualified output"
266 if diff $seq.out $tmp.out >/dev/null 2>&1
273 echo "$seq `expr $stop - $start`" >>$tmp.time
276 echo " - output mismatch (see $seq.out.bad)"
277 mv $tmp.out $seq.out.bad
278 $diff $seq.out $seq.out.bad
286 # come here for each test, except when $showme is true
291 n_bad=`expr $n_bad + 1`
294 [ -f $seq.notrun ] || try=`expr $try + 1`