3 # Control script for QA
5 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc. All Rights Reserved.
18 export QA_CHECK_FS=${QA_CHECK_FS:=true}
20 # by default don't output timestamps
21 timestamp=${TIMESTAMP:=false}
23 # generic initialization
26 # we need common.config
27 if ! . ./common.config
29 echo "$iam: failed to source common.config"
40 echo "check: failed to source common.rc"
46 echo "check: QA must be run as root"
52 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
64 # remove files that were used by hangcheck
66 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
67 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
74 if [ -f check.time -a -f $tmp.time ]
76 cat check.time $tmp.time \
80 for (i in t) print i " " t[i]
84 mv $tmp.out check.time
87 if [ -f $tmp.expunged ]
89 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
90 n_try=`expr $n_try - $notrun`
91 list=`echo "$list" | sed -f $tmp.expunged`
96 echo $list | fmt | sed -e 's/^/ /' >>check.log
97 $interrupt && echo "Interrupted!" >>check.log
99 if [ ! -z "$n_try" -a $n_try != 0 ]
104 if [ ! -z "$notrun" ]
106 echo "Not run:$notrun"
107 echo "Not run:$notrun" >>check.log
110 if [ ! -z "$n_bad" -a $n_bad != 0 ]
113 echo "Failed $n_bad of $n_try tests"
114 echo "Failures:$bad" | fmt >>check.log
115 echo "Failed $n_bad of $n_try tests" >>check.log
117 echo "Passed all $n_try tests"
118 echo "Passed all $n_try tests" >>check.log
123 rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
124 rm -f /tmp/check.pid /tmp/check.sts
128 trap "_wrapup; exit \$status" 0 1 2 3 15
131 # Save pid of check in a well known place, so that hangcheck can be sure it
132 # has the right pid (getting the pid from ps output is not reliable enough).
134 rm -rf /tmp/check.pid
135 echo $$ >/tmp/check.pid
138 # Save the status of check in a well known place, so that hangcheck can be
139 # sure to know where check is up to (getting test number from ps output is
140 # not reliable enough since the trace stuff has been introduced).
142 rm -rf /tmp/check.sts
143 echo "preamble" >/tmp/check.sts
145 # don't leave old full output behind on a clean run
148 [ -f check.time ] || touch check.time
150 FULL_FSTYP_DETAILS=`_full_fstyp_details`
151 FULL_HOST_DETAILS=`_full_platform_details`
152 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
153 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
156 FSTYP -- $FULL_FSTYP_DETAILS
157 PLATFORM -- $FULL_HOST_DETAILS
158 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
159 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
163 if [ ! -z "$SCRATCH_DEV" ]; then
164 umount $SCRATCH_DEV 2>/dev/null
165 # call the overridden mkfs - make sure the FS is built
166 # the same as we'll create it later.
168 if ! _scratch_mkfs $flag >$tmp.err 2>&1
170 echo "our local _scratch_mkfs routine ..."
172 echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
176 # call the overridden mount - make sure the FS mounts with
177 # the same options that we'll mount with later.
178 if ! _scratch_mount >$tmp.err 2>&1
180 echo "our local mount routine ..."
182 echo "check: failed to mount \$SCRATCH_DEV using specified options"
190 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG
196 if [ -n "$TESTS_REMAINING_LOG" ] ; then
197 sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp
198 mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG
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 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
233 ./$seq >$tmp.rawout 2>&1
235 $timestamp && _timestamp
238 _fix_malloc <$tmp.rawout >$tmp.out
243 echo -n " [dumped core]"
248 if [ -f $seq.notrun ]
250 $timestamp || echo -n " [not run] "
251 $timestamp && echo " [not run]" && echo -n " $seq -- "
253 notrun="$notrun $seq"
257 echo -n " [failed, exit status $sts]"
262 echo " - no qualified output"
265 if diff $seq.out $tmp.out >/dev/null 2>&1
272 echo "$seq `expr $stop - $start`" >>$tmp.time
275 echo " - output mismatch (see $seq.out.bad)"
276 mv $tmp.out $seq.out.bad
277 $diff $seq.out $seq.out.bad
285 # come here for each test, except when $showme is true
290 n_bad=`expr $n_bad + 1`
293 if [ ! -f $seq.notrun ]
296 n_try=`expr $n_try + 1`