sm501: Ignore no-op blits
[qemu/ar7.git] / tests / qemu-iotests / check
blob9c461cf76de8f9bebd54273349f804df7241d774
1 #!/usr/bin/env bash
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
22 status=0
23 needwrap=true
24 try=0
25 n_bad=0
26 bad=""
27 notrun=""
28 casenotrun=""
29 interrupt=true
30 makecheck=false
32 _init_error()
34 echo "check: $1" >&2
35 exit 1
38 if [ -L "$0" ]
39 then
40 # called from the build tree
41 source_iotests=$(dirname "$(readlink "$0")")
42 if [ -z "$source_iotests" ]
43 then
44 _init_error "failed to obtain source tree name from check symlink"
46 source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
47 build_iotests=$PWD
48 else
49 # called from the source tree
50 source_iotests=$PWD
51 # this may be an in-tree build (note that in the following code we may not
52 # assume that it truly is and have to test whether the build results
53 # actually exist)
54 build_iotests=$PWD
57 build_root="$build_iotests/../.."
59 # we need common.env
60 if ! . "$build_iotests/common.env"
61 then
62 _init_error "failed to source common.env (make sure the qemu-iotests are run from tests/qemu-iotests in the build tree)"
65 # we need common.config
66 if ! . "$source_iotests/common.config"
67 then
68 _init_error "failed to source common.config"
71 _full_imgfmt_details()
73 if [ -n "$IMGOPTS" ]; then
74 echo "$IMGFMT ($IMGOPTS)"
75 else
76 echo "$IMGFMT"
80 _full_platform_details()
82 os=$(uname -s)
83 host=$(hostname -s)
84 kernel=$(uname -r)
85 platform=$(uname -m)
86 echo "$os/$platform $host $kernel"
89 _full_env_details()
91 cat <<EOF
92 QEMU -- "$QEMU_PROG" $QEMU_OPTIONS
93 QEMU_IMG -- "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS
94 QEMU_IO -- "$QEMU_IO_PROG" $QEMU_IO_OPTIONS
95 QEMU_NBD -- "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS
96 IMGFMT -- $FULL_IMGFMT_DETAILS
97 IMGPROTO -- $IMGPROTO
98 PLATFORM -- $FULL_HOST_DETAILS
99 TEST_DIR -- $TEST_DIR
100 SOCK_DIR -- $SOCK_DIR
101 SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER
106 # $1 = prog to look for
107 set_prog_path()
109 p=$(command -v $1 2> /dev/null)
110 if [ -n "$p" -a -x "$p" ]; then
111 type -p "$p"
112 else
113 return 1
117 if [ -z "$TEST_DIR" ]; then
118 TEST_DIR=$PWD/scratch
120 mkdir -p "$TEST_DIR" || _init_error 'Failed to create TEST_DIR'
122 tmp_sock_dir=false
123 if [ -z "$SOCK_DIR" ]; then
124 SOCK_DIR=$(mktemp -d)
125 tmp_sock_dir=true
127 mkdir -p "$SOCK_DIR" || _init_error 'Failed to create SOCK_DIR'
129 diff="diff -u"
130 verbose=false
131 debug=false
132 group=false
133 xgroup=false
134 imgopts=false
135 showme=false
136 sortme=false
137 expunge=true
138 have_test_arg=false
139 cachemode=false
140 aiomode=false
142 tmp="${TEST_DIR}"/$$
143 rm -f $tmp.list $tmp.tmp $tmp.sed
145 export IMGFMT=raw
146 export IMGFMT_GENERIC=true
147 export IMGPROTO=file
148 export IMGOPTS=""
149 export CACHEMODE="writeback"
150 export AIOMODE="threads"
151 export QEMU_IO_OPTIONS=""
152 export QEMU_IO_OPTIONS_NO_FMT=""
153 export CACHEMODE_IS_DEFAULT=true
154 export VALGRIND_QEMU=
155 export IMGKEYSECRET=
156 export IMGOPTSSYNTAX=false
158 # Save current tty settings, since an aborting qemu call may leave things
159 # screwed up
160 STTY_RESTORE=
161 if test -t 0; then
162 STTY_RESTORE=$(stty -g)
165 for r
168 if $group
169 then
170 # arg after -g
171 group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
172 s/ .*//p
174 if [ -z "$group_list" ]
175 then
176 echo "Group \"$r\" is empty or not defined?"
177 exit 1
179 [ ! -s $tmp.list ] && touch $tmp.list
180 for t in $group_list
182 if grep -s "^$t\$" $tmp.list >/dev/null
183 then
185 else
186 echo "$t" >>$tmp.list
188 done
189 group=false
190 continue
192 elif $xgroup
193 then
194 # arg after -x
195 # Populate $tmp.list with all tests
196 awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
197 group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
198 s/ .*//p
200 if [ -z "$group_list" ]
201 then
202 echo "Group \"$r\" is empty or not defined?"
203 exit 1
205 numsed=0
206 rm -f $tmp.sed
207 for t in $group_list
209 if [ $numsed -gt 100 ]
210 then
211 sed -f $tmp.sed <$tmp.list >$tmp.tmp
212 mv $tmp.tmp $tmp.list
213 numsed=0
214 rm -f $tmp.sed
216 echo "/^$t\$/d" >>$tmp.sed
217 numsed=$(expr $numsed + 1)
218 done
219 sed -f $tmp.sed <$tmp.list >$tmp.tmp
220 mv $tmp.tmp $tmp.list
221 xgroup=false
222 continue
224 elif $imgopts
225 then
226 IMGOPTS="$r"
227 imgopts=false
228 continue
229 elif $cachemode
230 then
231 CACHEMODE="$r"
232 CACHEMODE_IS_DEFAULT=false
233 cachemode=false
234 continue
235 elif $aiomode
236 then
237 AIOMODE="$r"
238 aiomode=false
239 continue
242 xpand=true
243 case "$r"
246 -\? | -h | --help) # usage
247 echo "Usage: $0 [options] [testlist]"'
249 common options
250 -v verbose
251 -d debug
253 image format options
254 -raw test raw (default)
255 -bochs test bochs
256 -cloop test cloop
257 -parallels test parallels
258 -qcow test qcow
259 -qcow2 test qcow2
260 -qed test qed
261 -vdi test vdi
262 -vpc test vpc
263 -vhdx test vhdx
264 -vmdk test vmdk
265 -luks test luks
266 -dmg test dmg
268 image protocol options
269 -file test file (default)
270 -rbd test rbd
271 -sheepdog test sheepdog
272 -nbd test nbd
273 -ssh test ssh
274 -nfs test nfs
275 -vxhs test vxhs
277 other options
278 -xdiff graphical mode diff
279 -nocache use O_DIRECT on backing file
280 -misalign misalign memory allocations
281 -n show me, do not run tests
282 -o options -o options to pass to qemu-img create/convert
283 -c mode cache mode
284 -i mode AIO mode
285 -makecheck pretty print output for make check
287 testlist options
288 -g group[,group...] include tests from these groups
289 -x group[,group...] exclude tests from these groups
290 NNN include test NNN
291 NNN-NNN include test range (eg. 012-021)
293 exit 0
296 -raw)
297 IMGFMT=raw
298 xpand=false
301 -bochs)
302 IMGFMT=bochs
303 IMGFMT_GENERIC=false
304 xpand=false
307 -cloop)
308 IMGFMT=cloop
309 IMGFMT_GENERIC=false
310 xpand=false
313 -parallels)
314 IMGFMT=parallels
315 xpand=false
318 -qcow)
319 IMGFMT=qcow
320 xpand=false
323 -qcow2)
324 IMGFMT=qcow2
325 xpand=false
328 -luks)
329 IMGOPTSSYNTAX=true
330 IMGFMT=luks
331 IMGKEYSECRET=123456
332 xpand=false
335 -dmg)
336 IMGFMT=dmg
337 IMGFMT_GENERIC=false
338 xpand=false
341 -qed)
342 IMGFMT=qed
343 xpand=false
346 -vdi)
347 IMGFMT=vdi
348 xpand=false
351 -vmdk)
352 IMGFMT=vmdk
353 xpand=false
356 -vpc)
357 IMGFMT=vpc
358 xpand=false
361 -vhdx)
362 IMGFMT=vhdx
363 xpand=false
366 -file)
367 IMGPROTO=file
368 xpand=false
371 -rbd)
372 IMGPROTO=rbd
373 xpand=false
376 -sheepdog)
377 IMGPROTO=sheepdog
378 xpand=false
381 -nbd)
382 IMGPROTO=nbd
383 xpand=false
386 -vxhs)
387 IMGPROTO=vxhs
388 xpand=false
391 -ssh)
392 IMGPROTO=ssh
393 xpand=false
396 -nfs)
397 IMGPROTO=nfs
398 xpand=false
401 -nocache)
402 CACHEMODE="none"
403 CACHEMODE_IS_DEFAULT=false
404 xpand=false
407 -misalign)
408 QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --misalign"
409 xpand=false
412 -valgrind)
413 VALGRIND_QEMU='y'
414 xpand=false
417 -g) # -g group ... pick from group file
418 group=true
419 xpand=false
422 -xdiff) # graphical diff mode
423 xpand=false
425 if [ ! -z "$DISPLAY" ]
426 then
427 command -v xdiff >/dev/null 2>&1 && diff=xdiff
428 command -v gdiff >/dev/null 2>&1 && diff=gdiff
429 command -v tkdiff >/dev/null 2>&1 && diff=tkdiff
430 command -v xxdiff >/dev/null 2>&1 && diff=xxdiff
433 -makecheck) # makecheck friendly output
434 makecheck=true
435 xpand=false
437 -n) # show me, don't do it
438 showme=true
439 xpand=false
442 imgopts=true
443 xpand=false
446 cachemode=true
447 xpand=false
450 aiomode=true
451 xpand=false
453 -T) # deprecated timestamp option
454 xpand=false
457 verbose=true
458 xpand=false
461 debug=true
462 xpand=false
464 -x) # -x group ... exclude from group file
465 xgroup=true
466 xpand=false
468 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
469 echo "No tests?"
470 status=1
471 exit $status
474 [0-9]*-[0-9]*)
475 eval $(echo $r | sed -e 's/^/start=/' -e 's/-/ end=/')
478 [0-9]*-)
479 eval $(echo $r | sed -e 's/^/start=/' -e 's/-//')
480 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/.* //')
481 if [ -z "$end" ]
482 then
483 echo "No tests in range \"$r\"?"
484 status=1
485 exit $status
490 start=$r
491 end=$r
494 esac
496 # get rid of leading 0s as can be interpreted as octal
497 start=$(echo $start | sed 's/^0*//')
498 end=$(echo $end | sed 's/^0*//')
500 if $xpand
501 then
502 have_test_arg=true
503 awk </dev/null '
504 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
505 | while read id
507 if grep -s "^$id\( \|\$\)" "$source_iotests/group" >/dev/null
508 then
509 # in group file ... OK
510 echo $id >>$tmp.list
511 else
512 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
513 then
514 # expunged ... will be reported, but not run, later
515 echo $id >>$tmp.list
516 else
517 # oops
518 if [ "$start" == "$end" -a "$id" == "$end" ]
519 then
520 echo "$id - unknown test"
521 exit 1
522 else
523 echo "$id - unknown test, ignored"
527 done || exit 1
530 done
532 # Set qemu-io cache mode with $CACHEMODE we have
533 QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
534 # Set qemu-io aio mode with $AIOMODE we have
535 QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --aio $AIOMODE"
537 QEMU_IO_OPTIONS_NO_FMT="$QEMU_IO_OPTIONS"
538 if [ "$IMGOPTSSYNTAX" != "true" ]; then
539 QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT"
542 # Set default options for qemu-img create -o if they were not specified
543 if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
544 IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
546 if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
547 IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
549 if [ "$IMGFMT" == "vmdk" ] && ! (echo "$IMGOPTS" | grep "zeroed_grain=" > /dev/null); then
550 IMGOPTS=$(_optstr_add "$IMGOPTS" "zeroed_grain=on")
553 if [ -z "$SAMPLE_IMG_DIR" ]; then
554 SAMPLE_IMG_DIR="$source_iotests/sample_images"
557 export TEST_DIR
558 export SOCK_DIR
559 export SAMPLE_IMG_DIR
561 if [ -s $tmp.list ]
562 then
563 # found some valid test numbers ... this is good
565 else
566 if $have_test_arg
567 then
568 # had test numbers, but none in group file ... do nothing
569 touch $tmp.list
570 else
571 # no test numbers, do everything from group file
572 sed -n -e '/^[0-9][0-9][0-9]*/s/^\([0-9]*\).*/\1/p' <"$source_iotests/group" >$tmp.list
576 # should be sort -n, but this did not work for Linux when this
577 # was ported from IRIX
579 list=$(sort $tmp.list)
580 rm -f $tmp.list $tmp.tmp $tmp.sed
582 if [ -z "$QEMU_PROG" ]
583 then
584 if [ -x "$build_iotests/qemu" ]; then
585 export QEMU_PROG="$build_iotests/qemu"
586 elif [ -x "$build_root/${qemu_arch}-softmmu/qemu-system-${qemu_arch}" ]; then
587 export QEMU_PROG="$build_root/${qemu_arch}-softmmu/qemu-system-${qemu_arch}"
588 else
589 pushd "$build_root" > /dev/null
590 for binary in *-softmmu/qemu-system-*
592 if [ -x "$binary" ]
593 then
594 export QEMU_PROG="$build_root/$binary"
595 break
597 done
598 popd > /dev/null
599 [ "$QEMU_PROG" = "" ] && _init_error "qemu not found"
602 export QEMU_PROG="$(type -p "$QEMU_PROG")"
604 case "$QEMU_PROG" in
605 *qemu-system-arm|*qemu-system-aarch64)
606 export QEMU_OPTIONS="-nodefaults -display none -machine virt -accel qtest"
608 *qemu-system-tricore)
609 export QEMU_OPTIONS="-nodefaults -display none -machine tricore_testboard -accel qtest"
612 export QEMU_OPTIONS="-nodefaults -display none -accel qtest"
614 esac
616 if [ -z "$QEMU_IMG_PROG" ]; then
617 if [ -x "$build_iotests/qemu-img" ]; then
618 export QEMU_IMG_PROG="$build_iotests/qemu-img"
619 elif [ -x "$build_root/qemu-img" ]; then
620 export QEMU_IMG_PROG="$build_root/qemu-img"
621 else
622 _init_error "qemu-img not found"
625 export QEMU_IMG_PROG="$(type -p "$QEMU_IMG_PROG")"
627 if [ -z "$QEMU_IO_PROG" ]; then
628 if [ -x "$build_iotests/qemu-io" ]; then
629 export QEMU_IO_PROG="$build_iotests/qemu-io"
630 elif [ -x "$build_root/qemu-io" ]; then
631 export QEMU_IO_PROG="$build_root/qemu-io"
632 else
633 _init_error "qemu-io not found"
636 export QEMU_IO_PROG="$(type -p "$QEMU_IO_PROG")"
638 if [ -z $QEMU_NBD_PROG ]; then
639 if [ -x "$build_iotests/qemu-nbd" ]; then
640 export QEMU_NBD_PROG="$build_iotests/qemu-nbd"
641 elif [ -x "$build_root/qemu-nbd" ]; then
642 export QEMU_NBD_PROG="$build_root/qemu-nbd"
643 else
644 _init_error "qemu-nbd not found"
647 export QEMU_NBD_PROG="$(type -p "$QEMU_NBD_PROG")"
649 if [ -z "$QEMU_VXHS_PROG" ]; then
650 export QEMU_VXHS_PROG="$(set_prog_path qnio_server)"
653 if [ -x "$build_iotests/socket_scm_helper" ]
654 then
655 export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper"
658 python_usable=false
659 if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6) else 1)'
660 then
661 # Our python framework also requires virtio-blk
662 if "$QEMU_PROG" -M none -device help | grep -q virtio-blk >/dev/null 2>&1
663 then
664 python_usable=true
665 else
666 python_unusable_because="Missing virtio-blk in QEMU binary"
668 else
669 python_unusable_because="Unsupported Python version"
672 default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
673 default_alias_machine=$($QEMU_PROG -machine help | \
674 sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
675 if [[ "$default_alias_machine" ]]; then
676 default_machine="$default_alias_machine"
679 export QEMU_DEFAULT_MACHINE="$default_machine"
681 TIMESTAMP_FILE=check.time-$IMGPROTO-$IMGFMT
683 _wallclock()
685 date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }'
688 _wrapup()
690 if $showme
691 then
693 elif $needwrap
694 then
695 if [ -f $TIMESTAMP_FILE -a -f $tmp.time ]
696 then
697 cat $TIMESTAMP_FILE $tmp.time \
698 | awk '
699 { t[$1] = $2 }
700 END { if (NR > 0) {
701 for (i in t) print i " " t[i]
703 }' \
704 | sort -n >$tmp.out
705 mv $tmp.out $TIMESTAMP_FILE
708 if [ -f $tmp.expunged ]
709 then
710 notrun=$(wc -l <$tmp.expunged | sed -e 's/ *//g')
711 try=$(expr $try - $notrun)
712 list=$(echo "$list" | sed -f $tmp.expunged)
715 echo "" >>check.log
716 date >>check.log
717 echo $list | fmt | sed -e 's/^/ /' >>check.log
718 $interrupt && echo "Interrupted!" >>check.log
720 if [ ! -z "$notrun" ]
721 then
722 echo "Not run:$notrun"
723 echo "Not run:$notrun" >>check.log
725 if [ ! -z "$casenotrun" ]
726 then
727 echo "Some cases not run in:$casenotrun"
728 echo "Some cases not run in:$casenotrun" >>check.log
730 if [ ! -z "$n_bad" -a $n_bad != 0 ]
731 then
732 echo "Failures:$bad"
733 echo "Failed $n_bad of $try iotests"
734 echo "Failures:$bad" | fmt >>check.log
735 echo "Failed $n_bad of $try iotests" >>check.log
736 else
737 echo "Passed all $try iotests"
738 echo "Passed all $try iotests" >>check.log
740 needwrap=false
743 if test -n "$STTY_RESTORE"; then
744 stty $STTY_RESTORE
746 rm -f "${TEST_DIR}"/*.out "${TEST_DIR}"/*.err "${TEST_DIR}"/*.time
747 rm -f "${TEST_DIR}"/check.pid "${TEST_DIR}"/check.sts
748 rm -f $tmp.*
750 if $tmp_sock_dir
751 then
752 rm -rf "$SOCK_DIR"
756 trap "_wrapup; exit \$status" 0 1 2 3 15
758 # Report the test start and results. For makecheck we want to pretty
759 # print the whole report at the end of the execution.
760 # args: $seq, $starttime, $lasttime
761 _report_test_start()
763 if ! $makecheck; then
764 if [ -n "$3" ]; then
765 local lasttime=" (last: $3s)"
767 printf "%-8s %-10s [%s] %4s%-14s\r" "$1" "..." "$2" "..." "$lasttime"
770 # args:$seq $status $starttime $lasttime $thistime $details
771 _report_test_result()
773 local status lasttime thistime
774 if $makecheck; then
775 if [ -n "$2" ] && [ "$2" != "pass" ]; then
776 status=" [$2]"
778 printf " TEST iotest-$IMGFMT: %s%s\n" "$1" "$status"
779 return
782 if [ -n "$4" ]; then
783 lasttime=" (last: $4s)"
785 if [ -n "$5" ]; then
786 thistime=" $5s"
788 case "$2" in
789 "pass") status=$(printf "\e[32m%-10s\e[0m" "$2") ;;
790 "fail") status=$(printf "\e[1m\e[31m%-10s\e[0m" "$2") ;;
791 "not run") status=$(printf "\e[33m%-10s\e[0m" "$2") ;;
792 *) status=$(printf "%-10s" "$2") ;;
793 esac
795 printf "%-8s %s [%s] [%s] %4s%-14s %s\n" "$1" "$status" "$3" "$(date '+%T')" "$thistime" "$lasttime" "$6"
798 [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE
800 FULL_IMGFMT_DETAILS=$(_full_imgfmt_details)
801 FULL_HOST_DETAILS=$(_full_platform_details)
803 if ! $makecheck; then
804 _full_env_details
807 seq="check"
809 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG
811 for seq in $list
813 err=false # error flag
814 printdiff=false # show diff to reference output?
815 status="" # test result summary
816 results="" # test result details
817 thistime="" # time the test took
819 if [ -n "$TESTS_REMAINING_LOG" ] ; then
820 sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG > $TESTS_REMAINING_LOG.tmp
821 mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG
822 sync
825 lasttime=$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE)
826 starttime=$(date "+%T")
827 _report_test_start $seq $starttime $lasttime
829 if $showme
830 then
831 status="not run"
832 elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expunged >/dev/null
833 then
834 status="not run"
835 results="expunged"
836 rm -f $seq.out.bad
837 echo "/^$seq\$/d" >>$tmp.expunged
838 elif [ ! -f "$source_iotests/$seq" ]
839 then
840 status="not run"
841 results="no such test?"
842 echo "/^$seq\$/d" >>$tmp.expunged
843 else
844 # really going to try and run this one
846 rm -f $seq.out.bad
847 rm -f core $seq.notrun
848 rm -f $seq.casenotrun
850 start=$(_wallclock)
852 if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python3" ]; then
853 if $python_usable; then
854 run_command="$PYTHON $seq"
855 else
856 run_command="false"
857 echo "$python_unusable_because" > $seq.notrun
859 else
860 run_command="./$seq"
862 export OUTPUT_DIR=$PWD
863 if $debug; then
864 (cd "$source_iotests";
865 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
866 $run_command -d 2>&1 | tee $tmp.out)
867 else
868 (cd "$source_iotests";
869 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
870 $run_command >$tmp.out 2>&1)
872 sts=$?
873 stop=$(_wallclock)
875 if [ -f core ]
876 then
877 mv core $seq.core
878 status="fail"
879 results="[dumped core] $seq.core"
880 err=true
883 if [ -f $seq.notrun ]
884 then
885 # overwrites timestamp output
886 status="not run"
887 results="$(cat $seq.notrun)"
888 else
889 if [ $sts -ne 0 ]
890 then
891 status="fail"
892 results=$(printf %s "[failed, exit status $sts]")
893 err=true
896 reference="$source_iotests/$seq.out"
897 reference_machine="$source_iotests/$seq.$QEMU_DEFAULT_MACHINE.out"
898 if [ -f "$reference_machine" ]; then
899 reference="$reference_machine"
902 reference_format="$source_iotests/$seq.out.$IMGFMT"
903 if [ -f "$reference_format" ]; then
904 reference="$reference_format"
907 if [ "$CACHEMODE" = "none" ]; then
908 [ -f "$source_iotests/$seq.out.nocache" ] && reference="$source_iotests/$seq.out.nocache"
911 if [ ! -f "$reference" ]
912 then
913 status="fail"
914 results="no qualified output"
915 err=true
916 else
917 if diff -w "$reference" $tmp.out >/dev/null 2>&1
918 then
919 if ! $err; then
920 status="pass"
921 thistime=$(expr $stop - $start)
922 echo "$seq $thistime" >>$tmp.time
924 else
925 mv $tmp.out $seq.out.bad
926 status="fail"
927 results="output mismatch (see $seq.out.bad)"
928 printdiff=true
929 err=true
933 if [ -f $seq.casenotrun ]
934 then
935 cat $seq.casenotrun
936 casenotrun="$casenotrun $seq"
940 # come here for each test, except when $showme is true
942 _report_test_result $seq "$status" "$starttime" "$lasttime" "$thistime" "$results"
943 case "$status" in
944 "pass")
945 try=$(expr $try + 1)
947 "fail")
948 try=$(expr $try + 1)
949 if $makecheck; then
950 _full_env_details
952 if $printdiff; then
953 $diff -w "$reference" "$PWD"/$seq.out.bad
955 bad="$bad $seq"
956 n_bad=$(expr $n_bad + 1)
957 quick=false
959 "not run")
960 notrun="$notrun $seq"
962 esac
964 seq="after_$seq"
965 done
967 interrupt=false
968 status=$(expr $n_bad)
969 exit