3 # Copyright (C) 2009 Red Hat, Inc.
4 # Copyright (c) 2000-2005 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, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 # common procedures for QA scripts
44 rm -f $tmp.list
$tmp.tmp
$tmp.
sed
47 export QEMU_IO_OPTIONS
=""
55 group_list
=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
58 if [ -z "$group_list" ]
60 echo "Group \"$r\" is empty or not defined?"
63 [ ! -s $tmp.list
] && touch $tmp.list
66 if grep -s "^$t\$" $tmp.list
>/dev
/null
79 [ ! -s $tmp.list
] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list
2>/dev
/null
80 group_list
=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
83 if [ -z "$group_list" ]
85 echo "Group \"$r\" is empty or not defined?"
92 if [ $numsed -gt 100 ]
94 sed -f $tmp.
sed <$tmp.list
>$tmp.tmp
99 echo "/^$t\$/d" >>$tmp.
sed
100 numsed
=`expr $numsed + 1`
102 sed -f $tmp.
sed <$tmp.list
>$tmp.tmp
103 mv $tmp.tmp
$tmp.list
112 -\? |
-h |
--help) # usage
113 echo "Usage: $0 [options] [testlist]"'
119 -raw test raw (default)
125 -xdiff graphical mode diff
126 -nocache use O_DIRECT on backing file
127 -misalign misalign memory allocations
128 -n show me, do not run tests
130 -r randomize test order
133 -g group[,group...] include tests from these groups
134 -x group[,group...] exclude tests from these groups
136 NNN-NNN include test range (eg. 012-021)
172 QEMU_IO_OPTIONS
="$QEMU_IO_OPTIONS --nocache"
177 QEMU_IO_OPTIONS
="$QEMU_IO_OPTIONS --misalign"
181 -g) # -g group ... pick from group file
186 -xdiff) # graphical diff mode
189 if [ ! -z "$DISPLAY" ]
191 which xdiff
>/dev
/null
2>&1 && diff=xdiff
192 which gdiff
>/dev
/null
2>&1 && diff=gdiff
193 which tkdiff
>/dev
/null
2>&1 && diff=tkdiff
194 which xxdiff
>/dev
/null
2>&1 && diff=xxdiff
198 -n) # show me, don't do it
202 -r) # randomize test order
207 -T) # turn on timestamp output
216 -x) # -x group ... exclude from group file
220 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
227 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
231 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
232 end
=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //'`
235 echo "No tests in range \"$r\"?"
248 # get rid of leading 0s as can be interpreted as octal
249 start
=`echo $start | sed 's/^0*//'`
250 end
=`echo $end | sed 's/^0*//'`
255 $AWK_PROG </dev
/null
'
256 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
259 if grep -s "^$id " group
>/dev
/null
261 # in group file ... OK
264 if [ -f expunged
] && $expunge && egrep "^$id([ ]|\$)" expunged
>/dev
/null
266 # expunged ... will be reported, but not run, later
270 echo "$id - unknown test, ignored"
280 # found some valid test numbers ... this is good
285 # had test numbers, but none in group file ... do nothing
288 # no test numbers, do everything from group file
289 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group
>$tmp.list
293 # should be sort -n, but this did not work for Linux when this
294 # was ported from IRIX
296 list
=`sort $tmp.list`
297 rm -f $tmp.list
$tmp.tmp
$tmp.
sed
301 list
=`echo $list | awk -f randomize.awk`
304 [ "$QEMU" = "" ] && _fatal
"qemu not found"
305 [ "$QEMU_IMG" = "" ] && _fatal
"qemu-img not found"
306 [ "$QEMU_IO" = "" ] && _fatal
"qemu-img not found"