From nobody Wed Dec 17 21:48:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507306984329900.790213565087; Fri, 6 Oct 2017 09:23:04 -0700 (PDT) Received: from localhost ([::1]:45744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0VOr-00085I-6k for importer@patchew.org; Fri, 06 Oct 2017 12:22:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0UyG-00012D-V7 for qemu-devel@nongnu.org; Fri, 06 Oct 2017 11:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0UyC-0003iM-W5 for qemu-devel@nongnu.org; Fri, 06 Oct 2017 11:55:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49169) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e0Uy6-0003XT-0m; Fri, 06 Oct 2017 11:55:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2E691E33C; Fri, 6 Oct 2017 15:55:16 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9CA367594; Fri, 6 Oct 2017 15:55:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F2E691E33C Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kwolf@redhat.com From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 6 Oct 2017 17:54:00 +0200 Message-Id: <20171006155422.10135-33-kwolf@redhat.com> In-Reply-To: <20171006155422.10135-1-kwolf@redhat.com> References: <20171006155422.10135-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 06 Oct 2017 15:55:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 32/54] qemu-iotests: merge "check" and "common" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini "check" is full of qemu-iotests--specific details. Separating it from "common" does not make much sense anymore. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/check | 533 ++++++++++++++++++++++++++++++++++++++++++= +- tests/qemu-iotests/common | 552 ------------------------------------------= ---- 2 files changed, 531 insertions(+), 554 deletions(-) delete mode 100644 tests/qemu-iotests/common diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 010bf48e92..176cb8e937 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -69,8 +69,537 @@ then _init_error "failed to source common.config" fi =20 -# we need common -. "$source_iotests/common" +_full_imgfmt_details() +{ + if [ -n "$IMGOPTS" ]; then + echo "$IMGFMT ($IMGOPTS)" + else + echo "$IMGFMT" + fi +} + +_full_platform_details() +{ + os=3D`uname -s` + host=3D`hostname -s` + kernel=3D`uname -r` + platform=3D`uname -m` + echo "$os/$platform $host $kernel" +} + +# $1 =3D prog to look for +set_prog_path() +{ + p=3D`command -v $1 2> /dev/null` + if [ -n "$p" -a -x "$p" ]; then + realpath -- "$(type -p "$p")" + else + return 1 + fi +} + +if [ -z "$TEST_DIR" ]; then + TEST_DIR=3D`pwd`/scratch +fi + +if [ ! -e "$TEST_DIR" ]; then + mkdir "$TEST_DIR" +fi + +diff=3D"diff -u" +verbose=3Dfalse +debug=3Dfalse +group=3Dfalse +xgroup=3Dfalse +imgopts=3Dfalse +showme=3Dfalse +sortme=3Dfalse +expunge=3Dtrue +have_test_arg=3Dfalse +cachemode=3Dfalse + +tmp=3D"${TEST_DIR}"/$$ +rm -f $tmp.list $tmp.tmp $tmp.sed + +export IMGFMT=3Draw +export IMGFMT_GENERIC=3Dtrue +export IMGPROTO=3Dfile +export IMGOPTS=3D"" +export CACHEMODE=3D"writeback" +export QEMU_IO_OPTIONS=3D"" +export QEMU_IO_OPTIONS_NO_FMT=3D"" +export CACHEMODE_IS_DEFAULT=3Dtrue +export QEMU_OPTIONS=3D"-nodefaults -machine accel=3Dqtest" +export VALGRIND_QEMU=3D +export IMGKEYSECRET=3D +export IMGOPTSSYNTAX=3Dfalse + +for r +do + + if $group + then + # arg after -g + group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ +s/ .*//p +}'` + if [ -z "$group_list" ] + then + echo "Group \"$r\" is empty or not defined?" + exit 1 + fi + [ ! -s $tmp.list ] && touch $tmp.list + for t in $group_list + do + if grep -s "^$t\$" $tmp.list >/dev/null + then + : + else + echo "$t" >>$tmp.list + fi + done + group=3Dfalse + continue + + elif $xgroup + then + # arg after -x + # Populate $tmp.list with all tests + awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.lis= t 2>/dev/null + group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ +s/ .*//p +}'` + if [ -z "$group_list" ] + then + echo "Group \"$r\" is empty or not defined?" + exit 1 + fi + numsed=3D0 + rm -f $tmp.sed + for t in $group_list + do + if [ $numsed -gt 100 ] + then + sed -f $tmp.sed <$tmp.list >$tmp.tmp + mv $tmp.tmp $tmp.list + numsed=3D0 + rm -f $tmp.sed + fi + echo "/^$t\$/d" >>$tmp.sed + numsed=3D`expr $numsed + 1` + done + sed -f $tmp.sed <$tmp.list >$tmp.tmp + mv $tmp.tmp $tmp.list + xgroup=3Dfalse + continue + + elif $imgopts + then + IMGOPTS=3D"$r" + imgopts=3Dfalse + continue + elif $cachemode + then + CACHEMODE=3D"$r" + CACHEMODE_IS_DEFAULT=3Dfalse + cachemode=3Dfalse + continue + fi + + xpand=3Dtrue + case "$r" + in + + -\? | -h | --help) # usage + echo "Usage: $0 [options] [testlist]"' + +common options + -v verbose + -d debug + +image format options + -raw test raw (default) + -bochs test bochs + -cloop test cloop + -parallels test parallels + -qcow test qcow + -qcow2 test qcow2 + -qed test qed + -vdi test vdi + -vpc test vpc + -vhdx test vhdx + -vmdk test vmdk + -luks test luks + +image protocol options + -file test file (default) + -rbd test rbd + -sheepdog test sheepdog + -nbd test nbd + -ssh test ssh + -nfs test nfs + -vxhs test vxhs + +other options + -xdiff graphical mode diff + -nocache use O_DIRECT on backing file + -misalign misalign memory allocations + -n show me, do not run tests + -o options -o options to pass to qemu-img create/convert + -T output timestamps + -c mode cache mode + +testlist options + -g group[,group...] include tests from these groups + -x group[,group...] exclude tests from these groups + NNN include test NNN + NNN-NNN include test range (eg. 012-021) +' + exit 0 + ;; + + -raw) + IMGFMT=3Draw + xpand=3Dfalse + ;; + + -bochs) + IMGFMT=3Dbochs + IMGFMT_GENERIC=3Dfalse + xpand=3Dfalse + ;; + + -cloop) + IMGFMT=3Dcloop + IMGFMT_GENERIC=3Dfalse + xpand=3Dfalse + ;; + + -parallels) + IMGFMT=3Dparallels + IMGFMT_GENERIC=3Dfalse + xpand=3Dfalse + ;; + + -qcow) + IMGFMT=3Dqcow + xpand=3Dfalse + ;; + + -qcow2) + IMGFMT=3Dqcow2 + xpand=3Dfalse + ;; + + -luks) + IMGOPTSSYNTAX=3Dtrue + IMGFMT=3Dluks + IMGKEYSECRET=3D123456 + xpand=3Dfalse + ;; + + -qed) + IMGFMT=3Dqed + xpand=3Dfalse + ;; + + -vdi) + IMGFMT=3Dvdi + xpand=3Dfalse + ;; + + -vmdk) + IMGFMT=3Dvmdk + xpand=3Dfalse + ;; + + -vpc) + IMGFMT=3Dvpc + xpand=3Dfalse + ;; + + -vhdx) + IMGFMT=3Dvhdx + xpand=3Dfalse + ;; + + -file) + IMGPROTO=3Dfile + xpand=3Dfalse + ;; + + -rbd) + IMGPROTO=3Drbd + xpand=3Dfalse + ;; + + -sheepdog) + IMGPROTO=3Dsheepdog + xpand=3Dfalse + ;; + + -nbd) + IMGPROTO=3Dnbd + xpand=3Dfalse + ;; + + -vxhs) + IMGPROTO=3Dvxhs + xpand=3Dfalse + ;; + + -ssh) + IMGPROTO=3Dssh + xpand=3Dfalse + ;; + + -nfs) + IMGPROTO=3Dnfs + xpand=3Dfalse + ;; + + -nocache) + CACHEMODE=3D"none" + CACHEMODE_IS_DEFAULT=3Dfalse + xpand=3Dfalse + ;; + + -misalign) + QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS --misalign" + xpand=3Dfalse + ;; + + -valgrind) + VALGRIND_QEMU=3D'y' + xpand=3Dfalse + ;; + + -g) # -g group ... pick from group file + group=3Dtrue + xpand=3Dfalse + ;; + + -xdiff) # graphical diff mode + xpand=3Dfalse + + if [ ! -z "$DISPLAY" ] + then + command -v xdiff >/dev/null 2>&1 && diff=3Dxdiff + command -v gdiff >/dev/null 2>&1 && diff=3Dgdiff + command -v tkdiff >/dev/null 2>&1 && diff=3Dtkdiff + command -v xxdiff >/dev/null 2>&1 && diff=3Dxxdiff + fi + ;; + + -n) # show me, don't do it + showme=3Dtrue + xpand=3Dfalse + ;; + -o) + imgopts=3Dtrue + xpand=3Dfalse + ;; + -c) + cachemode=3Dtrue + xpand=3Dfalse + ;; + -T) # turn on timestamp output + timestamp=3Dtrue + xpand=3Dfalse + ;; + + -v) + verbose=3Dtrue + xpand=3Dfalse + ;; + -d) + debug=3Dtrue + xpand=3Dfalse + ;; + -x) # -x group ... exclude from group file + xgroup=3Dtrue + xpand=3Dfalse + ;; + '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]') + echo "No tests?" + status=3D1 + exit $status + ;; + + [0-9]*-[0-9]*) + eval `echo $r | sed -e 's/^/start=3D/' -e 's/-/ end=3D/'` + ;; + + [0-9]*-) + eval `echo $r | sed -e 's/^/start=3D/' -e 's/-//'` + end=3D`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/.* //'` + if [ -z "$end" ] + then + echo "No tests in range \"$r\"?" + status=3D1 + exit $status + fi + ;; + + *) + start=3D$r + end=3D$r + ;; + + esac + + # get rid of leading 0s as can be interpreted as octal + start=3D`echo $start | sed 's/^0*//'` + end=3D`echo $end | sed 's/^0*//'` + + if $xpand + then + have_test_arg=3Dtrue + awk /dev/null + then + # in group file ... OK + echo $id >>$tmp.list + else + if [ -f expunged ] && $expunge && egrep "^$id([ ]|= \$)" expunged >/dev/null + then + # expunged ... will be reported, but not run, later + echo $id >>$tmp.list + else + # oops + if [ "$start" =3D=3D "$end" -a "$id" =3D=3D "$end" ] + then + echo "$id - unknown test" + exit 1 + else + echo "$id - unknown test, ignored" + fi + fi + fi + done || exit 1 + fi + +done + +# Set qemu-io cache mode with $CACHEMODE we have +QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS --cache $CACHEMODE" + +QEMU_IO_OPTIONS_NO_FMT=3D"$QEMU_IO_OPTIONS" +if [ "$IMGOPTSSYNTAX" !=3D "true" ]; then + QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS -f $IMGFMT" +fi + +# Set default options for qemu-img create -o if they were not specified +if [ "$IMGFMT" =3D=3D "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=3D" >= /dev/null); then + IMGOPTS=3D$(_optstr_add "$IMGOPTS" "compat=3D1.1") +fi +if [ "$IMGFMT" =3D=3D "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=3D"= > /dev/null); then + IMGOPTS=3D$(_optstr_add "$IMGOPTS" "iter-time=3D10") +fi + +if [ -z "$SAMPLE_IMG_DIR" ]; then + SAMPLE_IMG_DIR=3D"$source_iotests/sample_images" +fi + +export TEST_DIR +export SAMPLE_IMG_DIR + +if [ -s $tmp.list ] +then + # found some valid test numbers ... this is good + : +else + if $have_test_arg + then + # had test numbers, but none in group file ... do nothing + touch $tmp.list + else + # no test numbers, do everything from group file + sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <"$source_iotest= s/group" >$tmp.list + fi +fi + +# should be sort -n, but this did not work for Linux when this +# was ported from IRIX +# +list=3D`sort $tmp.list` +rm -f $tmp.list $tmp.tmp $tmp.sed + +if [ -z "$QEMU_PROG" ] +then + if [ -x "$build_iotests/qemu" ]; then + export QEMU_PROG=3D"$build_iotests/qemu" + elif [ -x "$build_root/$arch-softmmu/qemu-system-$arch" ]; then + export QEMU_PROG=3D"$build_root/$arch-softmmu/qemu-system-$arch" + else + pushd "$build_root" > /dev/null + for binary in *-softmmu/qemu-system-* + do + if [ -x "$binary" ] + then + export QEMU_PROG=3D"$build_root/$binary" + break + fi + done + popd > /dev/null + [ "$QEMU_PROG" =3D "" ] && _init_error "qemu not found" + fi +fi +export QEMU_PROG=3D$(realpath -- "$(type -p "$QEMU_PROG")") + +if [ -z "$QEMU_IMG_PROG" ]; then + if [ -x "$build_iotests/qemu-img" ]; then + export QEMU_IMG_PROG=3D"$build_iotests/qemu-img" + elif [ -x "$build_root/qemu-img" ]; then + export QEMU_IMG_PROG=3D"$build_root/qemu-img" + else + _init_error "qemu-img not found" + fi +fi +export QEMU_IMG_PROG=3D$(realpath -- "$(type -p "$QEMU_IMG_PROG")") + +if [ -z "$QEMU_IO_PROG" ]; then + if [ -x "$build_iotests/qemu-io" ]; then + export QEMU_IO_PROG=3D"$build_iotests/qemu-io" + elif [ -x "$build_root/qemu-io" ]; then + export QEMU_IO_PROG=3D"$build_root/qemu-io" + else + _init_error "qemu-io not found" + fi +fi +export QEMU_IO_PROG=3D$(realpath -- "$(type -p "$QEMU_IO_PROG")") + +if [ -z $QEMU_NBD_PROG ]; then + if [ -x "$build_iotests/qemu-nbd" ]; then + export QEMU_NBD_PROG=3D"$build_iotests/qemu-nbd" + elif [ -x "$build_root/qemu-nbd" ]; then + export QEMU_NBD_PROG=3D"$build_root/qemu-nbd" + else + _init_error "qemu-nbd not found" + fi +fi +export QEMU_NBD_PROG=3D$(realpath -- "$(type -p "$QEMU_NBD_PROG")") + +if [ -z "$QEMU_VXHS_PROG" ]; then + export QEMU_VXHS_PROG=3D"`set_prog_path qnio_server`" +fi + +if [ -x "$build_iotests/socket_scm_helper" ] +then + export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" +fi + +default_machine=3D$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//= p') +default_alias_machine=3D$($QEMU_PROG -machine help | \ + sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }") +if [[ "$default_alias_machine" ]]; then + default_machine=3D"$default_alias_machine" +fi + +export QEMU_DEFAULT_MACHINE=3D"$default_machine" =20 TIMESTAMP_FILE=3Dcheck.time-$IMGPROTO-$IMGFMT =20 diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common deleted file mode 100644 index 365d3c4349..0000000000 --- a/tests/qemu-iotests/common +++ /dev/null @@ -1,552 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2009 Red Hat, Inc. -# Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it would be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# -# common procedures for QA scripts -# - -_full_imgfmt_details() -{ - if [ -n "$IMGOPTS" ]; then - echo "$IMGFMT ($IMGOPTS)" - else - echo "$IMGFMT" - fi -} - -_full_platform_details() -{ - os=3D`uname -s` - host=3D`hostname -s` - kernel=3D`uname -r` - platform=3D`uname -m` - echo "$os/$platform $host $kernel" -} - -# $1 =3D prog to look for -set_prog_path() -{ - p=3D`command -v $1 2> /dev/null` - if [ -n "$p" -a -x "$p" ]; then - realpath -- "$(type -p "$p")" - else - return 1 - fi -} - -if [ -z "$TEST_DIR" ]; then - TEST_DIR=3D`pwd`/scratch -fi - -if [ ! -e "$TEST_DIR" ]; then - mkdir "$TEST_DIR" -fi - -diff=3D"diff -u" -verbose=3Dfalse -debug=3Dfalse -group=3Dfalse -xgroup=3Dfalse -imgopts=3Dfalse -showme=3Dfalse -sortme=3Dfalse -expunge=3Dtrue -have_test_arg=3Dfalse -cachemode=3Dfalse - -tmp=3D"${TEST_DIR}"/$$ -rm -f $tmp.list $tmp.tmp $tmp.sed - -export IMGFMT=3Draw -export IMGFMT_GENERIC=3Dtrue -export IMGPROTO=3Dfile -export IMGOPTS=3D"" -export CACHEMODE=3D"writeback" -export QEMU_IO_OPTIONS=3D"" -export QEMU_IO_OPTIONS_NO_FMT=3D"" -export CACHEMODE_IS_DEFAULT=3Dtrue -export QEMU_OPTIONS=3D"-nodefaults -machine accel=3Dqtest" -export VALGRIND_QEMU=3D -export IMGKEYSECRET=3D -export IMGOPTSSYNTAX=3Dfalse - -for r -do - - if $group - then - # arg after -g - group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ -s/ .*//p -}'` - if [ -z "$group_list" ] - then - echo "Group \"$r\" is empty or not defined?" - exit 1 - fi - [ ! -s $tmp.list ] && touch $tmp.list - for t in $group_list - do - if grep -s "^$t\$" $tmp.list >/dev/null - then - : - else - echo "$t" >>$tmp.list - fi - done - group=3Dfalse - continue - - elif $xgroup - then - # arg after -x - # Populate $tmp.list with all tests - awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.lis= t 2>/dev/null - group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ -s/ .*//p -}'` - if [ -z "$group_list" ] - then - echo "Group \"$r\" is empty or not defined?" - exit 1 - fi - numsed=3D0 - rm -f $tmp.sed - for t in $group_list - do - if [ $numsed -gt 100 ] - then - sed -f $tmp.sed <$tmp.list >$tmp.tmp - mv $tmp.tmp $tmp.list - numsed=3D0 - rm -f $tmp.sed - fi - echo "/^$t\$/d" >>$tmp.sed - numsed=3D`expr $numsed + 1` - done - sed -f $tmp.sed <$tmp.list >$tmp.tmp - mv $tmp.tmp $tmp.list - xgroup=3Dfalse - continue - - elif $imgopts - then - IMGOPTS=3D"$r" - imgopts=3Dfalse - continue - elif $cachemode - then - CACHEMODE=3D"$r" - CACHEMODE_IS_DEFAULT=3Dfalse - cachemode=3Dfalse - continue - fi - - xpand=3Dtrue - case "$r" - in - - -\? | -h | --help) # usage - echo "Usage: $0 [options] [testlist]"' - -common options - -v verbose - -d debug - -image format options - -raw test raw (default) - -bochs test bochs - -cloop test cloop - -parallels test parallels - -qcow test qcow - -qcow2 test qcow2 - -qed test qed - -vdi test vdi - -vpc test vpc - -vhdx test vhdx - -vmdk test vmdk - -luks test luks - -image protocol options - -file test file (default) - -rbd test rbd - -sheepdog test sheepdog - -nbd test nbd - -ssh test ssh - -nfs test nfs - -vxhs test vxhs - -other options - -xdiff graphical mode diff - -nocache use O_DIRECT on backing file - -misalign misalign memory allocations - -n show me, do not run tests - -o options -o options to pass to qemu-img create/convert - -T output timestamps - -c mode cache mode - -testlist options - -g group[,group...] include tests from these groups - -x group[,group...] exclude tests from these groups - NNN include test NNN - NNN-NNN include test range (eg. 012-021) -' - exit 0 - ;; - - -raw) - IMGFMT=3Draw - xpand=3Dfalse - ;; - - -bochs) - IMGFMT=3Dbochs - IMGFMT_GENERIC=3Dfalse - xpand=3Dfalse - ;; - - -cloop) - IMGFMT=3Dcloop - IMGFMT_GENERIC=3Dfalse - xpand=3Dfalse - ;; - - -parallels) - IMGFMT=3Dparallels - IMGFMT_GENERIC=3Dfalse - xpand=3Dfalse - ;; - - -qcow) - IMGFMT=3Dqcow - xpand=3Dfalse - ;; - - -qcow2) - IMGFMT=3Dqcow2 - xpand=3Dfalse - ;; - - -luks) - IMGOPTSSYNTAX=3Dtrue - IMGFMT=3Dluks - IMGKEYSECRET=3D123456 - xpand=3Dfalse - ;; - - -qed) - IMGFMT=3Dqed - xpand=3Dfalse - ;; - - -vdi) - IMGFMT=3Dvdi - xpand=3Dfalse - ;; - - -vmdk) - IMGFMT=3Dvmdk - xpand=3Dfalse - ;; - - -vpc) - IMGFMT=3Dvpc - xpand=3Dfalse - ;; - - -vhdx) - IMGFMT=3Dvhdx - xpand=3Dfalse - ;; - - -file) - IMGPROTO=3Dfile - xpand=3Dfalse - ;; - - -rbd) - IMGPROTO=3Drbd - xpand=3Dfalse - ;; - - -sheepdog) - IMGPROTO=3Dsheepdog - xpand=3Dfalse - ;; - - -nbd) - IMGPROTO=3Dnbd - xpand=3Dfalse - ;; - - -vxhs) - IMGPROTO=3Dvxhs - xpand=3Dfalse - ;; - - -ssh) - IMGPROTO=3Dssh - xpand=3Dfalse - ;; - - -nfs) - IMGPROTO=3Dnfs - xpand=3Dfalse - ;; - - -nocache) - CACHEMODE=3D"none" - CACHEMODE_IS_DEFAULT=3Dfalse - xpand=3Dfalse - ;; - - -misalign) - QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS --misalign" - xpand=3Dfalse - ;; - - -valgrind) - VALGRIND_QEMU=3D'y' - xpand=3Dfalse - ;; - - -g) # -g group ... pick from group file - group=3Dtrue - xpand=3Dfalse - ;; - - -xdiff) # graphical diff mode - xpand=3Dfalse - - if [ ! -z "$DISPLAY" ] - then - command -v xdiff >/dev/null 2>&1 && diff=3Dxdiff - command -v gdiff >/dev/null 2>&1 && diff=3Dgdiff - command -v tkdiff >/dev/null 2>&1 && diff=3Dtkdiff - command -v xxdiff >/dev/null 2>&1 && diff=3Dxxdiff - fi - ;; - - -n) # show me, don't do it - showme=3Dtrue - xpand=3Dfalse - ;; - -o) - imgopts=3Dtrue - xpand=3Dfalse - ;; - -c) - cachemode=3Dtrue - xpand=3Dfalse - ;; - -T) # turn on timestamp output - timestamp=3Dtrue - xpand=3Dfalse - ;; - - -v) - verbose=3Dtrue - xpand=3Dfalse - ;; - -d) - debug=3Dtrue - xpand=3Dfalse - ;; - -x) # -x group ... exclude from group file - xgroup=3Dtrue - xpand=3Dfalse - ;; - '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]') - echo "No tests?" - status=3D1 - exit $status - ;; - - [0-9]*-[0-9]*) - eval `echo $r | sed -e 's/^/start=3D/' -e 's/-/ end=3D/'` - ;; - - [0-9]*-) - eval `echo $r | sed -e 's/^/start=3D/' -e 's/-//'` - end=3D`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/.* //'` - if [ -z "$end" ] - then - echo "No tests in range \"$r\"?" - status=3D1 - exit $status - fi - ;; - - *) - start=3D$r - end=3D$r - ;; - - esac - - # get rid of leading 0s as can be interpreted as octal - start=3D`echo $start | sed 's/^0*//'` - end=3D`echo $end | sed 's/^0*//'` - - if $xpand - then - have_test_arg=3Dtrue - awk /dev/null - then - # in group file ... OK - echo $id >>$tmp.list - else - if [ -f expunged ] && $expunge && egrep "^$id([ ]|= \$)" expunged >/dev/null - then - # expunged ... will be reported, but not run, later - echo $id >>$tmp.list - else - # oops - if [ "$start" =3D=3D "$end" -a "$id" =3D=3D "$end" ] - then - echo "$id - unknown test" - exit 1 - else - echo "$id - unknown test, ignored" - fi - fi - fi - done || exit 1 - fi - -done - -# Set qemu-io cache mode with $CACHEMODE we have -QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS --cache $CACHEMODE" - -QEMU_IO_OPTIONS_NO_FMT=3D"$QEMU_IO_OPTIONS" -if [ "$IMGOPTSSYNTAX" !=3D "true" ]; then - QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS -f $IMGFMT" -fi - -# Set default options for qemu-img create -o if they were not specified -if [ "$IMGFMT" =3D=3D "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=3D" >= /dev/null); then - IMGOPTS=3D$(_optstr_add "$IMGOPTS" "compat=3D1.1") -fi -if [ "$IMGFMT" =3D=3D "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=3D"= > /dev/null); then - IMGOPTS=3D$(_optstr_add "$IMGOPTS" "iter-time=3D10") -fi - -if [ -z "$SAMPLE_IMG_DIR" ]; then - SAMPLE_IMG_DIR=3D"$source_iotests/sample_images" -fi - -export TEST_DIR -export SAMPLE_IMG_DIR - -if [ -s $tmp.list ] -then - # found some valid test numbers ... this is good - : -else - if $have_test_arg - then - # had test numbers, but none in group file ... do nothing - touch $tmp.list - else - # no test numbers, do everything from group file - sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <"$source_iotest= s/group" >$tmp.list - fi -fi - -# should be sort -n, but this did not work for Linux when this -# was ported from IRIX -# -list=3D`sort $tmp.list` -rm -f $tmp.list $tmp.tmp $tmp.sed - -if [ -z "$QEMU_PROG" ] -then - if [ -x "$build_iotests/qemu" ]; then - export QEMU_PROG=3D"$build_iotests/qemu" - elif [ -x "$build_root/$arch-softmmu/qemu-system-$arch" ]; then - export QEMU_PROG=3D"$build_root/$arch-softmmu/qemu-system-$arch" - else - pushd "$build_root" > /dev/null - for binary in *-softmmu/qemu-system-* - do - if [ -x "$binary" ] - then - export QEMU_PROG=3D"$build_root/$binary" - break - fi - done - popd > /dev/null - [ "$QEMU_PROG" =3D "" ] && _init_error "qemu not found" - fi -fi -export QEMU_PROG=3D$(realpath -- "$(type -p "$QEMU_PROG")") - -if [ -z "$QEMU_IMG_PROG" ]; then - if [ -x "$build_iotests/qemu-img" ]; then - export QEMU_IMG_PROG=3D"$build_iotests/qemu-img" - elif [ -x "$build_root/qemu-img" ]; then - export QEMU_IMG_PROG=3D"$build_root/qemu-img" - else - _init_error "qemu-img not found" - fi -fi -export QEMU_IMG_PROG=3D$(realpath -- "$(type -p "$QEMU_IMG_PROG")") - -if [ -z "$QEMU_IO_PROG" ]; then - if [ -x "$build_iotests/qemu-io" ]; then - export QEMU_IO_PROG=3D"$build_iotests/qemu-io" - elif [ -x "$build_root/qemu-io" ]; then - export QEMU_IO_PROG=3D"$build_root/qemu-io" - else - _init_error "qemu-io not found" - fi -fi -export QEMU_IO_PROG=3D$(realpath -- "$(type -p "$QEMU_IO_PROG")") - -if [ -z $QEMU_NBD_PROG ]; then - if [ -x "$build_iotests/qemu-nbd" ]; then - export QEMU_NBD_PROG=3D"$build_iotests/qemu-nbd" - elif [ -x "$build_root/qemu-nbd" ]; then - export QEMU_NBD_PROG=3D"$build_root/qemu-nbd" - else - _init_error "qemu-nbd not found" - fi -fi -export QEMU_NBD_PROG=3D$(realpath -- "$(type -p "$QEMU_NBD_PROG")") - -if [ -z "$QEMU_VXHS_PROG" ]; then - export QEMU_VXHS_PROG=3D"`set_prog_path qnio_server`" -fi - -if [ -x "$build_iotests/socket_scm_helper" ] -then - export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" -fi - -default_machine=3D$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//= p') -default_alias_machine=3D$($QEMU_PROG -machine help | \ - sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }") -if [[ "$default_alias_machine" ]]; then - default_machine=3D"$default_alias_machine" -fi - -export QEMU_DEFAULT_MACHINE=3D"$default_machine" --=20 2.13.6