3 # Control script for QA
5 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
17 export QA_CHECK_FS=${QA_CHECK_FS:=true}
19 # generic initialization
23 echo "check: failed to source common.rc"
29 echo "check: QA must be run as root"
35 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
47 # remove files that were used by hangcheck
49 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
50 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
57 if [ -f check.time -a -f $tmp.time ]
59 cat check.time $tmp.time \
63 for (i in t) print i " " t[i]
67 mv $tmp.out check.time
70 if [ -f $tmp.expunged ]
72 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
73 try=`expr $try - $notrun`
74 list=`echo "$list" | sed -f $tmp.expunged`
79 echo $list | fmt | sed -e 's/^/ /' >>check.log
80 $interrupt && echo "Interrupted!" >>check.log
84 echo "Not run:$notrun"
85 echo "Not run:$notrun" >>check.log
87 if [ ! -z "$n_bad" -a $n_bad != 0 ]
90 echo "Failed $n_bad of $try tests"
91 echo "Failures:$bad" | fmt >>check.log
92 echo "Failed $n_bad of $try tests" >>check.log
94 echo "Passed all $try tests"
95 echo "Passed all $try tests" >>check.log
100 rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
101 rm -f /tmp/check.pid /tmp/check.sts
105 trap "_wrapup; exit \$status" 0 1 2 3 15
108 # Save pid of check in a well known place, so that hangcheck can be sure it
109 # has the right pid (getting the pid from ps output is not reliable enough).
111 rm -rf /tmp/check.pid
112 echo $$ >/tmp/check.pid
115 # Save the status of check in a well known place, so that hangcheck can be
116 # sure to know where check is up to (getting test number from ps output is
117 # not reliable enough since the trace stuff has been introduced).
119 rm -rf /tmp/check.sts
120 echo "preamble" >/tmp/check.sts
122 # don't leave old full output behind on a clean run
125 # by default don't output timestamps
126 timestamp=${TIMESTAMP:=false}
130 [ -f check.time ] || touch check.time
132 FULL_FSTYP_DETAILS=`_full_fstyp_details`
133 FULL_HOST_DETAILS=`_full_platform_details`
134 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
135 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
138 FSTYP -- $FULL_FSTYP_DETAILS
139 PLATFORM -- $FULL_HOST_DETAILS
140 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
141 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
145 umount $SCRATCH_DEV 2>/dev/null
146 # call the overridden mkfs - make sure the FS is built
147 # the same as we'll create it later.
149 if ! _scratch_mkfs $flag >$tmp.err 2>&1
151 echo "our local _scratch_mkfs routine ..."
153 echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
157 # call the overridden mount - make sure the FS mounts with
158 # the same options that we'll mount with later.
159 if ! _scratch_mount >$tmp.err 2>&1
161 echo "our local mount routine ..."
163 echo "check: failed to mount \$SCRATCH_DEV using specified options"
178 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
182 echo "/^$seq\$/d" >>$tmp.expunged
185 echo " - no such test?"
186 echo "/^$seq\$/d" >>$tmp.expunged
188 # really going to try and run this one
191 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
192 if [ "X$lasttime" != X ]; then
193 echo -n " ${lasttime}s ..."
195 echo -n " " # prettier output with timestamps.
197 rm -f core $seq.notrun
200 echo "$seq" >/tmp/check.sts
203 $timestamp && echo -n " ["`date "+%T"`"]"
204 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
205 ./$seq >$tmp.rawout 2>&1
207 $timestamp && _timestamp
210 _fix_malloc <$tmp.rawout >$tmp.out
215 echo -n " [dumped core]"
220 if [ -f $seq.notrun ]
222 $timestamp || echo -n " [not run] "
223 $timestamp && echo " [not run]" && echo -n " $seq -- "
225 notrun="$notrun $seq"
229 echo -n " [failed, exit status $sts]"
234 echo " - no qualified output"
237 if diff $seq.out $tmp.out >/dev/null 2>&1
244 echo "$seq `expr $stop - $start`" >>$tmp.time
247 echo " - output mismatch (see $seq.out.bad)"
248 mv $tmp.out $seq.out.bad
249 $diff $seq.out $seq.out.bad
257 # come here for each test, except when $showme is true
262 n_bad=`expr $n_bad + 1`
265 [ -f $seq.notrun ] || try=`expr $try + 1`