3 # Control script for QA
5 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc. All Rights Reserved.
17 export QA_CHECK_FS=${QA_CHECK_FS:=true}
19 # by default don't output timestamps
20 timestamp=${TIMESTAMP:=false}
22 # generic initialization
25 # we need common.config
26 if ! . ./common.config
28 echo "$iam: failed to source common.config"
39 echo "check: failed to source common.rc"
45 echo "check: QA must be run as root"
51 date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
63 # remove files that were used by hangcheck
65 [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
66 [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
73 if [ -f check.time -a -f $tmp.time ]
75 cat check.time $tmp.time \
79 for (i in t) print i " " t[i]
83 mv $tmp.out check.time
86 if [ -f $tmp.expunged ]
88 notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
89 try=`expr $try - $notrun`
90 list=`echo "$list" | sed -f $tmp.expunged`
95 echo $list | fmt | sed -e 's/^/ /' >>check.log
96 $interrupt && echo "Interrupted!" >>check.log
100 echo "Not run:$notrun"
101 echo "Not run:$notrun" >>check.log
103 if [ ! -z "$n_bad" -a $n_bad != 0 ]
106 echo "Failed $n_bad of $try tests"
107 echo "Failures:$bad" | fmt >>check.log
108 echo "Failed $n_bad of $try tests" >>check.log
110 echo "Passed all $try tests"
111 echo "Passed all $try tests" >>check.log
116 rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
117 rm -f /tmp/check.pid /tmp/check.sts
121 trap "_wrapup; exit \$status" 0 1 2 3 15
124 # Save pid of check in a well known place, so that hangcheck can be sure it
125 # has the right pid (getting the pid from ps output is not reliable enough).
127 rm -rf /tmp/check.pid
128 echo $$ >/tmp/check.pid
131 # Save the status of check in a well known place, so that hangcheck can be
132 # sure to know where check is up to (getting test number from ps output is
133 # not reliable enough since the trace stuff has been introduced).
135 rm -rf /tmp/check.sts
136 echo "preamble" >/tmp/check.sts
138 # don't leave old full output behind on a clean run
141 [ -f check.time ] || touch check.time
143 FULL_FSTYP_DETAILS=`_full_fstyp_details`
144 FULL_HOST_DETAILS=`_full_platform_details`
145 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
146 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
149 FSTYP -- $FULL_FSTYP_DETAILS
150 PLATFORM -- $FULL_HOST_DETAILS
151 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
152 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
156 umount $SCRATCH_DEV 2>/dev/null
157 # call the overridden mkfs - make sure the FS is built
158 # the same as we'll create it later.
160 if ! _scratch_mkfs $flag >$tmp.err 2>&1
162 echo "our local _scratch_mkfs routine ..."
164 echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
168 # call the overridden mount - make sure the FS mounts with
169 # the same options that we'll mount with later.
170 if ! _scratch_mount >$tmp.err 2>&1
172 echo "our local mount routine ..."
174 echo "check: failed to mount \$SCRATCH_DEV using specified options"
181 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG
187 if [ -n "$TESTS_REMAINING_LOG" ] ; then
188 sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp
189 mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG
197 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
201 echo "/^$seq\$/d" >>$tmp.expunged
204 echo " - no such test?"
205 echo "/^$seq\$/d" >>$tmp.expunged
207 # really going to try and run this one
210 lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
211 if [ "X$lasttime" != X ]; then
212 echo -n " ${lasttime}s ..."
214 echo -n " " # prettier output with timestamps.
216 rm -f core $seq.notrun
219 echo "$seq" >/tmp/check.sts
222 $timestamp && echo -n " ["`date "+%T"`"]"
223 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
224 ./$seq >$tmp.rawout 2>&1
226 $timestamp && _timestamp
229 _fix_malloc <$tmp.rawout >$tmp.out
234 echo -n " [dumped core]"
239 if [ -f $seq.notrun ]
241 $timestamp || echo -n " [not run] "
242 $timestamp && echo " [not run]" && echo -n " $seq -- "
244 notrun="$notrun $seq"
248 echo -n " [failed, exit status $sts]"
253 echo " - no qualified output"
256 if diff $seq.out $tmp.out >/dev/null 2>&1
263 echo "$seq `expr $stop - $start`" >>$tmp.time
266 echo " - output mismatch (see $seq.out.bad)"
267 mv $tmp.out $seq.out.bad
268 $diff $seq.out $seq.out.bad
276 # come here for each test, except when $showme is true
281 n_bad=`expr $n_bad + 1`
284 [ -f $seq.notrun ] || try=`expr $try + 1`