]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/qemu-iotests/common
d95ba4cddcf3d07b595d297c5bd6996ba3faed35
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, see <http://www.gnu.org/licenses/>.
19 # common procedures for QA scripts
43 rm -f $tmp.list
$tmp.tmp
$tmp.
sed
46 export QEMU_IO_OPTIONS
=""
54 group_list
=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
57 if [ -z "$group_list" ]
59 echo "Group \"$r\" is empty or not defined?"
62 [ ! -s $tmp.list
] && touch $tmp.list
65 if grep -s "^$t\$" $tmp.list
>/dev
/null
78 [ ! -s $tmp.list
] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list
2>/dev
/null
79 group_list
=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
82 if [ -z "$group_list" ]
84 echo "Group \"$r\" is empty or not defined?"
91 if [ $numsed -gt 100 ]
93 sed -f $tmp.
sed <$tmp.list
>$tmp.tmp
98 echo "/^$t\$/d" >>$tmp.
sed
99 numsed
=`expr $numsed + 1`
101 sed -f $tmp.
sed <$tmp.list
>$tmp.tmp
102 mv $tmp.tmp
$tmp.list
111 -\? |
-h |
--help) # usage
112 echo "Usage: $0 [options] [testlist]"'
118 -raw test raw (default)
126 -xdiff graphical mode diff
127 -nocache use O_DIRECT on backing file
128 -misalign misalign memory allocations
129 -n show me, do not run tests
131 -r randomize test order
134 -g group[,group...] include tests from these groups
135 -x group[,group...] exclude tests from these groups
137 NNN-NNN include test range (eg. 012-021)
183 QEMU_IO_OPTIONS
="$QEMU_IO_OPTIONS --nocache"
188 QEMU_IO_OPTIONS
="$QEMU_IO_OPTIONS --misalign"
192 -g) # -g group ... pick from group file
197 -xdiff) # graphical diff mode
200 if [ ! -z "$DISPLAY" ]
202 which xdiff
>/dev
/null
2>&1 && diff=xdiff
203 which gdiff
>/dev
/null
2>&1 && diff=gdiff
204 which tkdiff
>/dev
/null
2>&1 && diff=tkdiff
205 which xxdiff
>/dev
/null
2>&1 && diff=xxdiff
209 -n) # show me, don't do it
213 -r) # randomize test order
218 -T) # turn on timestamp output
227 -x) # -x group ... exclude from group file
231 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
238 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
242 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
243 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/.* //'`
246 echo "No tests in range \"$r\"?"
259 # get rid of leading 0s as can be interpreted as octal
260 start
=`echo $start | sed 's/^0*//'`
261 end
=`echo $end | sed 's/^0*//'`
266 $AWK_PROG </dev
/null
'
267 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
270 if grep -s "^$id " group
>/dev
/null
272 # in group file ... OK
275 if [ -f expunged
] && $expunge && egrep "^$id([ ]|\$)" expunged
>/dev
/null
277 # expunged ... will be reported, but not run, later
281 echo "$id - unknown test, ignored"
291 # found some valid test numbers ... this is good
296 # had test numbers, but none in group file ... do nothing
299 # no test numbers, do everything from group file
300 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group
>$tmp.list
304 # should be sort -n, but this did not work for Linux when this
305 # was ported from IRIX
307 list
=`sort $tmp.list`
308 rm -f $tmp.list
$tmp.tmp
$tmp.
sed
312 list
=`echo $list | awk -f randomize.awk`
315 [ "$QEMU" = "" ] && _fatal
"qemu not found"
316 [ "$QEMU_IMG" = "" ] && _fatal
"qemu-img not found"
317 [ "$QEMU_IO" = "" ] && _fatal
"qemu-img not found"