From nobody Wed Dec 17 05:39:24 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 1507306497898122.61557530978871; Fri, 6 Oct 2017 09:14:57 -0700 (PDT) Received: from localhost ([::1]:45696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0VH1-0000ad-0O for importer@patchew.org; Fri, 06 Oct 2017 12:14:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0Uy8-0000sl-S6 for qemu-devel@nongnu.org; Fri, 06 Oct 2017 11:55:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0Uy7-0003b0-LZ for qemu-devel@nongnu.org; Fri, 06 Oct 2017 11:55:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e0Uy1-0003Th-V8; Fri, 06 Oct 2017 11:55:14 -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 E0BAA81DE3; Fri, 6 Oct 2017 15:55:12 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id F260767585; Fri, 6 Oct 2017 15:55:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E0BAA81DE3 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.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:53:57 +0200 Message-Id: <20171006155422.10135-30-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.25]); Fri, 06 Oct 2017 15:55:13 +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 29/54] 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-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 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 Signed-off-by: Kevin Wolf --- 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.6