From nobody Sat May 18 07:48:56 2024 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 1505227845836487.7458419368918; Tue, 12 Sep 2017 07:50:45 -0700 (PDT) Received: from localhost ([::1]:36327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmWR-0008MI-7K for importer@patchew.org; Tue, 12 Sep 2017 10:50:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRF-0003sB-N0 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmR9-0001lx-3g for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmR2-0001eD-Rl; Tue, 12 Sep 2017 10:45:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8CAF7EA8E; Tue, 12 Sep 2017 14:45:07 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86DE977DE2; Tue, 12 Sep 2017 14:45:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D8CAF7EA8E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:50 +0200 Message-Id: <20170912144459.11359-2-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Sep 2017 14:45:08 +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] [PATCH 01/10] qemu-iotests: remove dead code 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-block@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" This includes shell function, shell variables and command line options (randomize.awk does not exist). Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 28 ----------------- tests/qemu-iotests/common | 23 -------------- tests/qemu-iotests/common.config | 26 --------------- tests/qemu-iotests/common.rc | 68 ------------------------------------= ---- 4 files changed, 145 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index d504b6e455..4a6ed67b42 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -65,7 +65,6 @@ then export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" fi =20 -# if ./qemu exists, it should be prioritized and will be chosen by common.= config if [[ -z "$QEMU_PROG" && ! -x './qemu' ]] then arch=3D$(uname -m 2> /dev/null) @@ -140,12 +139,6 @@ _timestamp() =20 _wrapup() { - # for hangcheck ... - # remove files that were used by hangcheck - # - [ -f "${TEST_DIR}"/check.pid ] && rm -rf "${TEST_DIR}"/check.pid - [ -f "${TEST_DIR}"/check.sts ] && rm -rf "${TEST_DIR}"/check.sts - if $showme then : @@ -201,24 +194,6 @@ END { if (NR > 0) { =20 trap "_wrapup; exit \$status" 0 1 2 3 15 =20 -# for hangcheck ... -# Save pid of check in a well known place, so that hangcheck can be sure it -# has the right pid (getting the pid from ps output is not reliable enough= ). -# -rm -rf "${TEST_DIR}"/check.pid -echo $$ > "${TEST_DIR}"/check.pid - -# for hangcheck ... -# Save the status of check in a well known place, so that hangcheck can be -# sure to know where check is up to (getting test number from ps output is -# not reliable enough since the trace stuff has been introduced). -# -rm -rf "${TEST_DIR}"/check.sts -echo "preamble" > "${TEST_DIR}"/check.sts - -# don't leave old full output behind on a clean run -rm -f check.full - [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE =20 FULL_IMGFMT_DETAILS=3D`_full_imgfmt_details` @@ -276,9 +251,6 @@ do fi rm -f core $seq.notrun =20 - # for hangcheck ... - echo "$seq" > "${TEST_DIR}"/check.sts - start=3D`_wallclock` $timestamp && printf %s " [$(date "+%T")]" =20 diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index d34c11c056..867918895b 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -19,17 +19,6 @@ # common procedures for QA scripts # =20 -_setenvironment() -{ - MSGVERB=3D"text:action" - export MSGVERB -} - -rm -f "$OUTPUT_DIR/$iam.out" -_setenvironment - -check=3D${check-true} - diff=3D"diff -u" verbose=3Dfalse debug=3Dfalse @@ -40,7 +29,6 @@ showme=3Dfalse sortme=3Dfalse expunge=3Dtrue have_test_arg=3Dfalse -randomize=3Dfalse cachemode=3Dfalse rm -f $tmp.list $tmp.tmp $tmp.sed =20 @@ -170,7 +158,6 @@ other options -n show me, do not run tests -o options -o options to pass to qemu-img create/convert -T output timestamps - -r randomize test order -c mode cache mode =20 testlist options @@ -327,11 +314,6 @@ testlist options cachemode=3Dtrue xpand=3Dfalse ;; - -r) # randomize test order - randomize=3Dtrue - xpand=3Dfalse - ;; - -T) # turn on timestamp output timestamp=3Dtrue xpand=3Dfalse @@ -445,11 +427,6 @@ fi list=3D`sort $tmp.list` rm -f $tmp.list $tmp.tmp $tmp.sed =20 -if $randomize -then - list=3D`echo $list | awk -f randomize.awk` -fi - [ "$QEMU" =3D "" ] && _fatal "qemu not found" [ "$QEMU_IMG" =3D "" ] && _fatal "qemu-img not found" [ "$QEMU_IO" =3D "" ] && _fatal "qemu-io not found" diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index e0883a0c65..b599c72211 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -15,33 +15,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# -# setup and check for config parameters, and in particular -# -# EMAIL - email of the script runner. -# TEST_DIR - scratch test directory -# -# - These can be added to $HOST_CONFIG_DIR (witch default to ./config) -# below or a separate local configuration file can be used (using -# the HOST_OPTIONS variable). -# - This script is shared by the stress test system and the auto-qa -# system (includes both regression test and benchmark components). -# - this script shouldn't make any assertions about filesystem -# validity or mountedness. -# - # all tests should use a common language setting to prevent golden # output mismatches. export LANG=3DC =20 PATH=3D".:$PATH" =20 -HOST=3D`hostname -s 2> /dev/null` HOSTOS=3D`uname -s` =20 -EMAIL=3Droot@localhost # where auto-qa will send its status messages -export HOST_OPTIONS=3D${HOST_OPTIONS:=3Dlocal.config} -export CHECK_OPTIONS=3D${CHECK_OPTIONS:=3D"-g auto"} export PWD=3D`pwd` =20 export _QEMU_HANDLE=3D0 @@ -78,11 +59,6 @@ _fatal() export AWK_PROG=3D"`set_prog_path awk`" [ "$AWK_PROG" =3D "" ] && _fatal "awk not found" =20 -export SED_PROG=3D"`set_prog_path sed`" -[ "$SED_PROG" =3D "" ] && _fatal "sed not found" - -export PS_ALL_FLAGS=3D"-ef" - if [ -z "$QEMU_PROG" ]; then export QEMU_PROG=3D"`set_prog_path qemu`" fi @@ -198,8 +174,6 @@ fi =20 export QEMU_DEFAULT_MACHINE=3D"$default_machine" =20 -[ -f /etc/qemu-iotest.config ] && . /etc/qemu-iotest.config - if [ -z "$TEST_DIR" ]; then TEST_DIR=3D`pwd`/scratch fi diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 8d486dbeb4..5938d5145f 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -293,51 +293,6 @@ _img_info() done } =20 -_get_pids_by_name() -{ - if [ $# -ne 1 ] - then - echo "Usage: _get_pids_by_name process-name" 1>&2 - exit 1 - fi - - # Algorithm ... all ps(1) variants have a time of the form MM:SS or - # HH:MM:SS before the psargs field, use this as the search anchor. - # - # Matches with $1 (process-name) occur if the first psarg is $1 - # or ends in /$1 ... the matching uses sed's regular expressions, - # so passing a regex into $1 will work. - - ps $PS_ALL_FLAGS \ - | sed -n \ - -e 's/$/ /' \ - -e 's/[ ][ ]*/ /g' \ - -e 's/^ //' \ - -e 's/^[^ ]* //' \ - -e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \ - -e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p" -} - -# fqdn for localhost -# -_get_fqdn() -{ - host=3D`hostname` - $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 =3D=3D "Name:") print $2 }' -} - -# check if run as root -# -_need_to_be_root() -{ - id=3D`id | $SED_PROG -e 's/(.*//' -e 's/.*=3D//'` - if [ "$id" -ne 0 ] - then - echo "Arrgh ... you need to be root (not uid=3D$id) to run this te= st" - exit 1 - fi -} - # bail out, setting up .notrun file # _notrun() @@ -491,28 +446,5 @@ _full_platform_details() echo "$os/$platform $host $kernel" } =20 -_link_out_file() -{ - if [ -z "$1" ]; then - echo Error must pass \$seq. - exit - fi - rm -f $1 - if [ "`uname`" =3D=3D "IRIX64" ] || [ "`uname`" =3D=3D "IRIX" ]; then - ln -s $1.irix $1 - elif [ "`uname`" =3D=3D "Linux" ]; then - ln -s $1.linux $1 - else - echo Error test $seq does not run on the operating system: `uname` - exit - fi -} - -_die() -{ - echo $@ - exit 1 -} - # make sure this script returns success true --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505227641015789.4865306069801; Tue, 12 Sep 2017 07:47:21 -0700 (PDT) Received: from localhost ([::1]:36312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmT7-00057r-Gj for importer@patchew.org; Tue, 12 Sep 2017 10:47:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRA-0003nN-OR for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmR6-0001kK-RU for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmR4-0001hA-G3; Tue, 12 Sep 2017 10:45:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AE76742; Tue, 12 Sep 2017 14:45:09 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D25278C12; Tue, 12 Sep 2017 14:45:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6AE76742 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:51 +0200 Message-Id: <20170912144459.11359-3-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 12 Sep 2017 14:45:09 +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] [PATCH 02/10] qemu-iotests: get rid of AWK_PROG 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-block@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" Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 4 ++-- tests/qemu-iotests/common | 2 +- tests/qemu-iotests/common.config | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 4a6ed67b42..5c0d0c51dc 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -128,7 +128,7 @@ tmp=3D"${TEST_DIR}"/$$ =20 _wallclock() { - date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }' + date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }' } =20 _timestamp() @@ -147,7 +147,7 @@ _wrapup() if [ -f $TIMESTAMP_FILE -a -f $tmp.time ] then cat $TIMESTAMP_FILE $tmp.time \ - | $AWK_PROG ' + | awk ' { t[$1] =3D $2 } END { if (NR > 0) { for (i in t) print i " " t[i] diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 867918895b..130f647a4d 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -366,7 +366,7 @@ testlist options if $xpand then have_test_arg=3Dtrue - $AWK_PROG Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505227654880628.336032878959; Tue, 12 Sep 2017 07:47:34 -0700 (PDT) Received: from localhost ([::1]:36315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmTN-0005Md-UA for importer@patchew.org; Tue, 12 Sep 2017 10:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRE-0003qS-Bi for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRD-0001p5-8K for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmR7-0001k0-0f; Tue, 12 Sep 2017 10:45:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C60F883C2; Tue, 12 Sep 2017 14:45:12 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDBA277DDD; Tue, 12 Sep 2017 14:45:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0C60F883C2 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:52 +0200 Message-Id: <20170912144459.11359-4-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 12 Sep 2017 14:45:12 +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] [PATCH 03/10] qemu-iotests: move "check" code out of common.rc 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-block@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" Some functions in common.rc are never used by the tests. Move them out of that file and into common, which is already included only by "check". Code that actually *is* common to "check" and tests can be placed in common.config. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/common | 25 ++++++++++++++++++++++++- tests/qemu-iotests/common.config | 12 ++++++++++++ tests/qemu-iotests/common.rc | 40 ------------------------------------= ---- 3 files changed, 36 insertions(+), 41 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 130f647a4d..2e98e64d5c 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -19,6 +19,24 @@ # common procedures for QA scripts # =20 +_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" +} + diff=3D"diff -u" verbose=3Dfalse debug=3Dfalse @@ -404,7 +422,12 @@ if [ "$IMGOPTSSYNTAX" !=3D "true" ]; then fi =20 # Set default options for qemu-img create -o if they were not specified -_set_default_imgopts +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 =20 if [ -s $tmp.list ] then diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index 0f571d46eb..91da65f3dc 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -27,6 +27,9 @@ export PWD=3D`pwd` =20 export _QEMU_HANDLE=3D0 =20 +# make sure we have a standard umask +umask 022 + # $1 =3D prog to look for, $2* =3D default pathnames if not found in $PATH set_prog_path() { @@ -49,6 +52,15 @@ set_prog_path() return 1 } =20 +_optstr_add() +{ + if [ -n "$1" ]; then + echo "$1,$2" + else + echo "$2" + fi +} + _fatal() { echo "$*" diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 5938d5145f..6f6e03366f 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -50,9 +50,6 @@ then fi fi =20 -# make sure we have a standard umask -umask 022 - if [ "$IMGOPTSSYNTAX" =3D "true" ]; then DRIVER=3D"driver=3D$IMGFMT" if [ "$IMGFMT" =3D "luks" ]; then @@ -94,25 +91,6 @@ else fi ORIG_TEST_IMG=3D"$TEST_IMG" =20 -_optstr_add() -{ - if [ -n "$1" ]; then - echo "$1,$2" - else - echo "$2" - fi -} - -_set_default_imgopts() -{ - 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 -} - _use_sample_img() { SAMPLE_IMG_FILE=3D"${1%\.bz2}" @@ -428,23 +406,5 @@ _require_command() [ -x "$c" ] || _notrun "$1 utility required, skipped this test" } =20 -_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" -} - # make sure this script returns success true --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505227646828529.6609653463363; Tue, 12 Sep 2017 07:47:26 -0700 (PDT) Received: from localhost ([::1]:36313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmTF-0005DO-NF for importer@patchew.org; Tue, 12 Sep 2017 10:47:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRG-0003st-DM for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRE-0001q3-Sj for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43490) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmR9-0001lS-10; Tue, 12 Sep 2017 10:45:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10AD34A71F; Tue, 12 Sep 2017 14:45:14 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FBED77DDA; Tue, 12 Sep 2017 14:45:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 10AD34A71F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:53 +0200 Message-Id: <20170912144459.11359-5-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Sep 2017 14:45:14 +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] [PATCH 04/10] qemu-iotests: cleanup and fix search for programs 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-block@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" Instead of ./check failing when a binary is missing, we try each test case now and each one fails with tons of test case diffs. Also, all the variables were initialized by "check" prior to "common" being sourced, and then (uselessly) checked for emptiness again in "check". Centralize the search for programs in "common" (which will soon be one with "check"), including the "realpath" invocation which can be done just once in "check" rather than in the tests. For qnio_server, move the detection to "common", simplifying set_prog_path to stop handling the unused second argument, and embedding the "realpath" pass. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 41 --------------------- tests/qemu-iotests/common | 77 ++++++++++++++++++++++++++++++++++++= +--- tests/qemu-iotests/common.config | 61 +------------------------------ 3 files changed, 73 insertions(+), 106 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 5c0d0c51dc..b7c54390d3 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -60,47 +60,6 @@ fi =20 build_root=3D"$build_iotests/../.." =20 -if [ -x "$build_iotests/socket_scm_helper" ] -then - export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" -fi - -if [[ -z "$QEMU_PROG" && ! -x './qemu' ]] -then - arch=3D$(uname -m 2> /dev/null) - - if [[ -n $arch && -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 - fi -fi - -if [[ -z $QEMU_IMG_PROG && -x "$build_root/qemu-img" && ! -x './qemu-img' = ]] -then - export QEMU_IMG_PROG=3D"$build_root/qemu-img" -fi - -if [[ -z $QEMU_IO_PROG && -x "$build_root/qemu-io" && ! -x './qemu-io' ]] -then - export QEMU_IO_PROG=3D"$build_root/qemu-io" -fi - -if [[ -z $QEMU_NBD_PROG && -x "$build_root/qemu-nbd" && ! -x './qemu-nbd' = ]] -then - export QEMU_NBD_PROG=3D"$build_root/qemu-nbd" -fi - # we need common.env if ! . "$build_iotests/common.env" then diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 2e98e64d5c..abacc24114 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -37,6 +37,17 @@ _full_platform_details() echo "$os/$platform $host $kernel" } =20 +# $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 +} + diff=3D"diff -u" verbose=3Dfalse debug=3Dfalse @@ -450,10 +461,66 @@ fi list=3D`sort $tmp.list` rm -f $tmp.list $tmp.tmp $tmp.sed =20 -[ "$QEMU" =3D "" ] && _fatal "qemu not found" -[ "$QEMU_IMG" =3D "" ] && _fatal "qemu-img not found" -[ "$QEMU_IO" =3D "" ] && _fatal "qemu-io not found" +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")") =20 -if [ "$IMGPROTO" =3D "nbd" ] ; then - [ "$QEMU_NBD" =3D "" ] && _fatal "qemu-nbd not found" +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 diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index 91da65f3dc..c97c63983f 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -22,6 +22,7 @@ export LANG=3DC PATH=3D".:$PATH" =20 HOSTOS=3D`uname -s` +arch=3D`uname -m` =20 export PWD=3D`pwd` =20 @@ -30,28 +31,6 @@ export _QEMU_HANDLE=3D0 # make sure we have a standard umask umask 022 =20 -# $1 =3D prog to look for, $2* =3D default pathnames if not found in $PATH -set_prog_path() -{ - p=3D`command -v $1 2> /dev/null` - if [ -n "$p" -a -x "$p" ]; then - echo $p - return 0 - fi - p=3D$1 - - shift - for f; do - if [ -x $f ]; then - echo $f - return 0 - fi - done - - echo "" - return 1 -} - _optstr_add() { if [ -n "$1" ]; then @@ -61,44 +40,6 @@ _optstr_add() fi } =20 -_fatal() -{ - echo "$*" - status=3D1 - exit 1 -} - -if [ -z "$QEMU_PROG" ]; then - export QEMU_PROG=3D"`set_prog_path qemu`" -fi - -if [ -z "$QEMU_IMG_PROG" ]; then - export QEMU_IMG_PROG=3D"`set_prog_path qemu-img`" -fi - -if [ -z "$QEMU_IO_PROG" ]; then - export QEMU_IO_PROG=3D"`set_prog_path qemu-io`" -fi - -if [ -z "$QEMU_NBD_PROG" ]; then - export QEMU_NBD_PROG=3D"`set_prog_path qemu-nbd`" -fi - -if [ -z "$QEMU_VXHS_PROG" ]; then - export QEMU_VXHS_PROG=3D"`set_prog_path qnio_server`" -fi - -export QEMU_PROG=3D$(realpath -- "$(type -p "$QEMU_PROG")") -export QEMU_IMG_PROG=3D$(realpath -- "$(type -p "$QEMU_IMG_PROG")") -export QEMU_IO_PROG=3D$(realpath -- "$(type -p "$QEMU_IO_PROG")") -export QEMU_NBD_PROG=3D$(realpath -- "$(type -p "$QEMU_NBD_PROG")") - -# This program is not built as part of qemu but (possibly) provided by the -# system, so it may not be present at all -if [ -n "$QEMU_VXHS_PROG" ]; then - export QEMU_VXHS_PROG=3D$(realpath -- "$(type -p "$QEMU_VXHS_PROG")") -fi - _qemu_wrapper() { ( --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505227868417168.19979374972922; Tue, 12 Sep 2017 07:51:08 -0700 (PDT) Received: from localhost ([::1]:36331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmWp-0000Ju-L1 for importer@patchew.org; Tue, 12 Sep 2017 10:51:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRS-00043X-Mg for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRO-0001uD-1f for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56102) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRB-0001nN-50; Tue, 12 Sep 2017 10:45:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2889E85550; Tue, 12 Sep 2017 14:45:16 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70920784A6; Tue, 12 Sep 2017 14:45:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2889E85550 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:54 +0200 Message-Id: <20170912144459.11359-6-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Sep 2017 14:45:16 +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] [PATCH 05/10] qemu-iotests: limit non-_PROG-suffixed variables to common.rc 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-block@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" These are never used by "check", with one exception that does not need $QEMU_OPTIONS. Keep them in common.rc, which will be soon included only by the tests. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/039.out | 10 +++--- tests/qemu-iotests/061.out | 4 +-- tests/qemu-iotests/137.out | 2 +- tests/qemu-iotests/common.config | 69 ++----------------------------------= ---- tests/qemu-iotests/common.rc | 65 +++++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out index c6e0ac2da3..724d7b2508 100644 --- a/tests/qemu-iotests/039.out +++ b/tests/qemu-iotests/039.out @@ -11,7 +11,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; @@ -50,7 +50,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; @@ -68,7 +68,7 @@ incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; @@ -91,7 +91,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; @@ -105,7 +105,7 @@ Data may be corrupted, or further writes to the image m= ay corrupt it. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index a431b7f305..942485de99 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -57,7 +57,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; @@ -219,7 +219,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index c0e753483b..05efd74d17 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -31,7 +31,7 @@ Cache clean interval too big Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are an= y of the following: none, constant, cached, all wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.config: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D = "y" ]; then +./common.rc: Killed ( if [ "${VALGRIND_QEMU}" =3D=3D "y" = ]; then exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitcode=3D99= "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; else exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index c97c63983f..c7f0a7a7e0 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -40,71 +40,6 @@ _optstr_add() fi } =20 -_qemu_wrapper() -{ - ( - if [ -n "${QEMU_NEED_PID}" ]; then - echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" - fi - exec "$QEMU_PROG" $QEMU_OPTIONS "$@" - ) -} - -_qemu_img_wrapper() -{ - (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@") -} - -_qemu_io_wrapper() -{ - local VALGRIND_LOGFILE=3D"${TEST_DIR}"/$$.valgrind - local QEMU_IO_ARGS=3D"$QEMU_IO_OPTIONS" - if [ "$IMGOPTSSYNTAX" =3D "true" ]; then - QEMU_IO_ARGS=3D"--image-opts $QEMU_IO_ARGS" - if [ -n "$IMGKEYSECRET" ]; then - QEMU_IO_ARGS=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEYSEC= RET $QEMU_IO_ARGS" - fi - fi - local RETVAL - ( - if [ "${VALGRIND_QEMU}" =3D=3D "y" ]; then - exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitc= ode=3D99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - fi - ) - RETVAL=3D$? - if [ "${VALGRIND_QEMU}" =3D=3D "y" ]; then - if [ $RETVAL =3D=3D 99 ]; then - cat "${VALGRIND_LOGFILE}" - fi - rm -f "${VALGRIND_LOGFILE}" - fi - (exit $RETVAL) -} - -_qemu_nbd_wrapper() -{ - ( - echo $BASHPID > "${QEMU_TEST_DIR}/qemu-nbd.pid" - exec "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@" - ) -} - -_qemu_vxhs_wrapper() -{ - ( - echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" - exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" - ) -} - -export QEMU=3D_qemu_wrapper -export QEMU_IMG=3D_qemu_img_wrapper -export QEMU_IO=3D_qemu_io_wrapper -export QEMU_NBD=3D_qemu_nbd_wrapper -export QEMU_VXHS=3D_qemu_vxhs_wrapper - QEMU_IMG_EXTRA_ARGS=3D if [ "$IMGOPTSSYNTAX" =3D "true" ]; then QEMU_IMG_EXTRA_ARGS=3D"--image-opts $QEMU_IMG_EXTRA_ARGS" @@ -115,8 +50,8 @@ fi export QEMU_IMG_EXTRA_ARGS =20 =20 -default_machine=3D$($QEMU -machine help | sed -n '/(default)/ s/ .*//p') -default_alias_machine=3D$($QEMU -machine help | \ +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" diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 6f6e03366f..e7f74b4dbd 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -50,6 +50,71 @@ then fi fi =20 +_qemu_wrapper() +{ + ( + if [ -n "${QEMU_NEED_PID}" ]; then + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" + fi + exec "$QEMU_PROG" $QEMU_OPTIONS "$@" + ) +} + +_qemu_img_wrapper() +{ + (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@") +} + +_qemu_io_wrapper() +{ + local VALGRIND_LOGFILE=3D"${TEST_DIR}"/$$.valgrind + local QEMU_IO_ARGS=3D"$QEMU_IO_OPTIONS" + if [ "$IMGOPTSSYNTAX" =3D "true" ]; then + QEMU_IO_ARGS=3D"--image-opts $QEMU_IO_ARGS" + if [ -n "$IMGKEYSECRET" ]; then + QEMU_IO_ARGS=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEYSEC= RET $QEMU_IO_ARGS" + fi + fi + local RETVAL + ( + if [ "${VALGRIND_QEMU}" =3D=3D "y" ]; then + exec valgrind --log-file=3D"${VALGRIND_LOGFILE}" --error-exitc= ode=3D99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" + else + exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" + fi + ) + RETVAL=3D$? + if [ "${VALGRIND_QEMU}" =3D=3D "y" ]; then + if [ $RETVAL =3D=3D 99 ]; then + cat "${VALGRIND_LOGFILE}" + fi + rm -f "${VALGRIND_LOGFILE}" + fi + (exit $RETVAL) +} + +_qemu_nbd_wrapper() +{ + ( + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-nbd.pid" + exec "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@" + ) +} + +_qemu_vxhs_wrapper() +{ + ( + echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" + exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" + ) +} + +export QEMU=3D_qemu_wrapper +export QEMU_IMG=3D_qemu_img_wrapper +export QEMU_IO=3D_qemu_io_wrapper +export QEMU_NBD=3D_qemu_nbd_wrapper +export QEMU_VXHS=3D_qemu_vxhs_wrapper + if [ "$IMGOPTSSYNTAX" =3D "true" ]; then DRIVER=3D"driver=3D$IMGFMT" if [ "$IMGFMT" =3D "luks" ]; then --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505228016784693.9957774017134; Tue, 12 Sep 2017 07:53:36 -0700 (PDT) Received: from localhost ([::1]:36347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmZD-0002O1-QW for importer@patchew.org; Tue, 12 Sep 2017 10:53:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRI-0003v2-MI for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRH-0001rZ-Q2 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44910) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRF-0001qA-Hl; Tue, 12 Sep 2017 10:45:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C5714A6E0; Tue, 12 Sep 2017 14:45:20 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9170677DE5; Tue, 12 Sep 2017 14:45:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C5714A6E0 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:55 +0200 Message-Id: <20170912144459.11359-7-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Sep 2017 14:45:20 +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] [PATCH 06/10] qemu-iotests: do not include common.rc in "check" 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-block@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" It only provides functions used by the test programs. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 6 ------ tests/qemu-iotests/common.rc | 13 +++++-------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index b7c54390d3..4cb5b05908 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -72,12 +72,6 @@ then _init_error "failed to source common.config" fi =20 -# we need common.rc -if ! . "$source_iotests/common.rc" -then - _init_error "failed to source common.rc" -fi - # we need common . "$source_iotests/common" =20 diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index e7f74b4dbd..20f6821a69 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -40,14 +40,11 @@ poke_file() printf "$3" | dd "of=3D$1" bs=3D1 "seek=3D$2" conv=3Dnotrunc &>/dev/nu= ll } =20 -# we need common.config -if [ "$iam" !=3D "check" ] -then - if ! . ./common.config - then - echo "$iam: failed to source common.config" - exit 1 - fi + +if ! . ./common.config + then + echo "$iam: failed to source common.config" + exit 1 fi =20 _qemu_wrapper() --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505227675152654.0053902736406; Tue, 12 Sep 2017 07:47:55 -0700 (PDT) Received: from localhost ([::1]:36316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmTi-0005i2-2z for importer@patchew.org; Tue, 12 Sep 2017 10:47:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRP-00040b-VO for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRO-0001ul-P6 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25239) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRI-0001rV-4S; Tue, 12 Sep 2017 10:45:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D5BB4A6E9; Tue, 12 Sep 2017 14:45:23 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC5DF6FA84; Tue, 12 Sep 2017 14:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1D5BB4A6E9 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:56 +0200 Message-Id: <20170912144459.11359-8-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Sep 2017 14:45:23 +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] [PATCH 07/10] qemu-iotests: disintegrate more parts of common.config 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-block@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" Split "check" parts from tests part. For the directory setup, the actual computation of directories goes in "check", while the sanity checks go in the tests. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/common | 24 ++++++++++++++++++++ tests/qemu-iotests/common.config | 49 ------------------------------------= ---- tests/qemu-iotests/common.qemu | 1 + tests/qemu-iotests/common.rc | 25 ++++++++++++++++++++ 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index abacc24114..ee313af92f 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -48,6 +48,14 @@ set_prog_path() fi } =20 +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 @@ -440,6 +448,13 @@ if [ "$IMGFMT" =3D=3D "luks" ] && ! (echo "$IMGOPTS" |= grep "iter-time=3D" > /dev/null IMGOPTS=3D$(_optstr_add "$IMGOPTS" "iter-time=3D10") fi =20 +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 @@ -524,3 +539,12 @@ 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" diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index c7f0a7a7e0..cdcda54546 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -26,8 +26,6 @@ arch=3D`uname -m` =20 export PWD=3D`pwd` =20 -export _QEMU_HANDLE=3D0 - # make sure we have a standard umask umask 022 =20 @@ -40,52 +38,5 @@ _optstr_add() fi } =20 -QEMU_IMG_EXTRA_ARGS=3D -if [ "$IMGOPTSSYNTAX" =3D "true" ]; then - QEMU_IMG_EXTRA_ARGS=3D"--image-opts $QEMU_IMG_EXTRA_ARGS" - if [ -n "$IMGKEYSECRET" ]; then - QEMU_IMG_EXTRA_ARGS=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEY= SECRET $QEMU_IMG_EXTRA_ARGS" - fi -fi -export QEMU_IMG_EXTRA_ARGS - - -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" - -if [ -z "$TEST_DIR" ]; then - TEST_DIR=3D`pwd`/scratch -fi - -QEMU_TEST_DIR=3D"${TEST_DIR}" - -if [ ! -e "$TEST_DIR" ]; then - mkdir "$TEST_DIR" -fi - -if [ ! -d "$TEST_DIR" ]; then - echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory" - exit 1 -fi - -export TEST_DIR - -if [ -z "$SAMPLE_IMG_DIR" ]; then - SAMPLE_IMG_DIR=3D"$source_iotests/sample_images" -fi - -if [ ! -d "$SAMPLE_IMG_DIR" ]; then - echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not = a directory" - exit 1 -fi - -export SAMPLE_IMG_DIR - # make sure this script returns success true diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index 7645f1dc72..9f9aecc9df 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -31,6 +31,7 @@ QEMU_FIFO_IN=3D"${QEMU_TEST_DIR}/qmp-in-$$" QEMU_FIFO_OUT=3D"${QEMU_TEST_DIR}/qmp-out-$$" =20 QEMU_HANDLE=3D0 +export _QEMU_HANDLE=3D0 =20 # If bash version is >=3D 4.1, these will be overwritten and dynamic # file descriptor values assigned. diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 20f6821a69..f4dc0104e6 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -114,6 +114,10 @@ export QEMU_VXHS=3D_qemu_vxhs_wrapper =20 if [ "$IMGOPTSSYNTAX" =3D "true" ]; then DRIVER=3D"driver=3D$IMGFMT" + QEMU_IMG_EXTRA_ARGS=3D"--image-opts $QEMU_IMG_EXTRA_ARGS" + if [ -n "$IMGKEYSECRET" ]; then + QEMU_IMG_EXTRA_ARGS=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEY= SECRET $QEMU_IMG_EXTRA_ARGS" + fi if [ "$IMGFMT" =3D "luks" ]; then DRIVER=3D"$DRIVER,key-secret=3Dkeysec0" fi @@ -133,6 +137,7 @@ if [ "$IMGOPTSSYNTAX" =3D "true" ]; then TEST_IMG=3D"$DRIVER,file.driver=3D$IMGPROTO,file.filename=3D$TEST_= DIR/t.$IMGFMT" fi else + QEMU_IMG_EXTRA_ARGS=3D if [ "$IMGPROTO" =3D "file" ]; then TEST_IMG=3D$TEST_DIR/t.$IMGFMT elif [ "$IMGPROTO" =3D "nbd" ]; then @@ -153,6 +158,26 @@ else fi ORIG_TEST_IMG=3D"$TEST_IMG" =20 +if [ -z "$TEST_DIR" ]; then + TEST_DIR=3D`pwd`/scratch +fi + +QEMU_TEST_DIR=3D"${TEST_DIR}" + +if [ ! -e "$TEST_DIR" ]; then + mkdir "$TEST_DIR" +fi + +if [ ! -d "$TEST_DIR" ]; then + echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory" + exit 1 +fi + +if [ ! -d "$SAMPLE_IMG_DIR" ]; then + echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not = a directory" + exit 1 +fi + _use_sample_img() { SAMPLE_IMG_FILE=3D"${1%\.bz2}" --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505227832813674.6106744425465; Tue, 12 Sep 2017 07:50:32 -0700 (PDT) Received: from localhost ([::1]:36324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmWG-0008Eq-3N for importer@patchew.org; Tue, 12 Sep 2017 10:50:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRV-00046M-4i for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRP-0001vH-Mv for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15595) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRJ-0001s8-Hr; Tue, 12 Sep 2017 10:45:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84F46C047B61; Tue, 12 Sep 2017 14:45:24 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 736FC77DCA; Tue, 12 Sep 2017 14:45:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84F46C047B61 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:57 +0200 Message-Id: <20170912144459.11359-9-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 12 Sep 2017 14:45:24 +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] [PATCH 08/10] qemu-iotests: fix uninitialized variable 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-block@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" The variable is used in "common" but defined only after the file is sourced. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 2 -- tests/qemu-iotests/common | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 4cb5b05908..7aec176ac4 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -77,8 +77,6 @@ fi =20 TIMESTAMP_FILE=3Dcheck.time-$IMGPROTO-$IMGFMT =20 -tmp=3D"${TEST_DIR}"/$$ - _wallclock() { date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }' diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index ee313af92f..365d3c4349 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -67,6 +67,8 @@ sortme=3Dfalse expunge=3Dtrue have_test_arg=3Dfalse cachemode=3Dfalse + +tmp=3D"${TEST_DIR}"/$$ rm -f $tmp.list $tmp.tmp $tmp.sed =20 export IMGFMT=3Draw --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505228164965129.6416815071633; Tue, 12 Sep 2017 07:56:04 -0700 (PDT) Received: from localhost ([::1]:36368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmbc-0004Vw-7W for importer@patchew.org; Tue, 12 Sep 2017 10:56:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRZ-00049x-1W for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRU-0001xq-Bu for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50042) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRL-0001t3-JP; Tue, 12 Sep 2017 10:45:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C0741F56A; Tue, 12 Sep 2017 14:45:26 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A8586FA84; Tue, 12 Sep 2017 14:45:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C0741F56A 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=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:58 +0200 Message-Id: <20170912144459.11359-10-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 12 Sep 2017 14:45:26 +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] [PATCH 09/10] qemu-iotests: get rid of $iam 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-block@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" The variable is almost unused, and one of the two uses is actually uninitialized. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 5 +---- tests/qemu-iotests/common.rc | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 7aec176ac4..5dfd4bd51d 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -30,12 +30,9 @@ interrupt=3Dtrue # by default don't output timestamps timestamp=3D${TIMESTAMP:=3Dfalse} =20 -# generic initialization -iam=3Dcheck - _init_error() { - echo "$iam: $1" >&2 + echo "check: $1" >&2 exit 1 } =20 diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index f4dc0104e6..0e8a33c696 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -43,7 +43,7 @@ poke_file() =20 if ! . ./common.config then - echo "$iam: failed to source common.config" + echo "$0: failed to source common.config" exit 1 fi =20 --=20 2.13.5 From nobody Sat May 18 07:48:56 2024 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 1505228047699301.13603471770614; Tue, 12 Sep 2017 07:54:07 -0700 (PDT) Received: from localhost ([::1]:36352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmZi-0002ts-Tp for importer@patchew.org; Tue, 12 Sep 2017 10:54:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmRZ-00049y-24 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmRU-0001xd-2F for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:45:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50506) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drmRN-0001te-6w; Tue, 12 Sep 2017 10:45:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29595285D0; Tue, 12 Sep 2017 14:45:28 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id A21B877DD4; Tue, 12 Sep 2017 14:45:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 29595285D0 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=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 16:44:59 +0200 Message-Id: <20170912144459.11359-11-pbonzini@redhat.com> In-Reply-To: <20170912144459.11359-1-pbonzini@redhat.com> References: <20170912144459.11359-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 12 Sep 2017 14:45:28 +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] [PATCH 10/10] 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-block@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" "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 --- 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 5dfd4bd51d..2a2f7c604f 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.5