3 # Copyright (C) 2009 Red Hat, Inc.
4 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms 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,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Control script for QA
31 # by default don't output timestamps
32 timestamp
=${TIMESTAMP:=false}
34 # generic initialization
37 # we need common.config
38 if ! . .
/common.config
40 echo "$iam: failed to source common.config"
47 echo "check: failed to source common.rc"
56 # echo "check: QA must be run as root"
62 date "+%H %M %S" |
$AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
74 # remove files that were used by hangcheck
76 [ -f /tmp
/check.pid
] && rm -rf /tmp
/check.pid
77 [ -f /tmp
/check.sts
] && rm -rf /tmp
/check.sts
84 if [ -f check.
time -a -f $tmp.
time ]
86 cat check.
time $tmp.
time \
90 for (i in t) print i " " t[i]
94 mv $tmp.out check.
time
97 if [ -f $tmp.expunged
]
99 notrun
=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
100 try
=`expr $try - $notrun`
101 list
=`echo "$list" | sed -f $tmp.expunged`
106 echo $list |
fmt |
sed -e 's/^/ /' >>check.log
107 $interrupt && echo "Interrupted!" >>check.log
109 if [ ! -z "$notrun" ]
111 echo "Not run:$notrun"
112 echo "Not run:$notrun" >>check.log
114 if [ ! -z "$n_bad" -a $n_bad != 0 ]
117 echo "Failed $n_bad of $try tests"
118 echo "Failures:$bad" |
fmt >>check.log
119 echo "Failed $n_bad of $try tests" >>check.log
121 echo "Passed all $try tests"
122 echo "Passed all $try tests" >>check.log
127 rm -f /tmp
/*.out
/tmp
/*.err
/tmp
/*.
time
128 rm -f /tmp
/check.pid
/tmp
/check.sts
132 trap "_wrapup; exit \$status" 0 1 2 3 15
135 # Save pid of check in a well known place, so that hangcheck can be sure it
136 # has the right pid (getting the pid from ps output is not reliable enough).
138 rm -rf /tmp
/check.pid
139 echo $$
>/tmp
/check.pid
142 # Save the status of check in a well known place, so that hangcheck can be
143 # sure to know where check is up to (getting test number from ps output is
144 # not reliable enough since the trace stuff has been introduced).
146 rm -rf /tmp
/check.sts
147 echo "preamble" >/tmp
/check.sts
149 # don't leave old full output behind on a clean run
152 [ -f check.
time ] ||
touch check.
time
154 FULL_IMGFMT_DETAILS
=`_full_imgfmt_details`
155 FULL_IMGPROTO_DETAILS
=`_full_imgproto_details`
156 FULL_HOST_DETAILS
=`_full_platform_details`
157 #FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
158 #FULL_MOUNT_OPTIONS=`_scratch_mount_options`
162 QEMU_IMG -- $QEMU_IMG
164 QEMU_NBD -- $QEMU_NBD
165 IMGFMT -- $FULL_IMGFMT_DETAILS
166 IMGPROTO -- $FULL_IMGPROTO_DETAILS
167 PLATFORM -- $FULL_HOST_DETAILS
168 SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER
171 #MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
172 #MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
176 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG
182 if [ -n "$TESTS_REMAINING_LOG" ] ; then
183 sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp
184 mv $TESTS_REMAINING_LOG.tmp
$TESTS_REMAINING_LOG
192 elif [ -f expunged
] && $expunge && egrep "^$seq([ ]|\$)" expunged
>/dev
/null
196 echo "/^$seq\$/d" >>$tmp.expunged
199 echo " - no such test?"
200 echo "/^$seq\$/d" >>$tmp.expunged
202 # really going to try and run this one
205 lasttime
=`sed -n -e "/^$seq /s/.* //p" <check.time`
206 if [ "X$lasttime" != X
]; then
207 echo -n " ${lasttime}s ..."
209 echo -n " " # prettier output with timestamps.
211 rm -f core
$seq.notrun
214 echo "$seq" >/tmp
/check.sts
217 $timestamp && echo -n " ["`date "+%T"`"]"
218 [ ! -x $seq ] && chmod u
+x
$seq # ensure we can run it
219 MALLOC_PERTURB_
=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
220 .
/$seq >$tmp.out
2>&1
222 $timestamp && _timestamp
227 echo -n " [dumped core]"
232 if [ -f $seq.notrun
]
234 $timestamp ||
echo -n " [not run] "
235 $timestamp && echo " [not run]" && echo -n " $seq -- "
237 notrun
="$notrun $seq"
241 echo -n " [failed, exit status $sts]"
246 if [ "$CACHEMODE" = "none" ]; then
247 [ -f $seq.out.nocache
] && reference
=$seq.out.nocache
250 if [ ! -f $reference ]
252 echo " - no qualified output"
255 if diff -w $reference $tmp.out
>/dev
/null
2>&1
262 echo "$seq `expr $stop - $start`" >>$tmp.
time
265 echo " - output mismatch (see $seq.out.bad)"
266 mv $tmp.out
$seq.out.bad
267 $diff -w $reference $seq.out.bad
275 # come here for each test, except when $showme is true
280 n_bad
=`expr $n_bad + 1`
283 [ -f $seq.notrun
] || try
=`expr $try + 1`