From nobody Tue Feb 10 20:28:36 2026 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; dkim=fail; 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 1502315843901723.4902936800216; Wed, 9 Aug 2017 14:57:23 -0700 (PDT) Received: from localhost ([::1]:50022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfYyg-0003ta-Bt for importer@patchew.org; Wed, 09 Aug 2017 17:57:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfYwk-0002QT-Tr for qemu-devel@nongnu.org; Wed, 09 Aug 2017 17:55:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfYwj-0006Uv-Js for qemu-devel@nongnu.org; Wed, 09 Aug 2017 17:55:23 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dfYwj-0006UM-Ds; Wed, 09 Aug 2017 17:55:21 -0400 Received: by mail-wr0-x244.google.com with SMTP id g32so5295001wrd.5; Wed, 09 Aug 2017 14:55:21 -0700 (PDT) Received: from donizetti.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id v41sm4390478wrc.65.2017.08.09.14.55.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Aug 2017 14:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hqiye1dztfgjGdXqutT5p2qHXzCshwcqvdhc3yogOpY=; b=o03XomY9u5VPAO+ipJHSwFfcWIx+RKITMoHjjggQ08QqSBUbhmEsGCiiGTkB26zwbF Wzh5PzgkJoyOHimy6WdGSZuVcJbk/biQl85GRh2HoXlo1aUxAZaQEnwfrKFFdDHpJbam wIeEo9g+jd413VhKTmRRuY3KJ6I198I3zgR601N8K/XR3N5aakXU1DxvT3J8khTEHKTx L+bnF6eELT/KONi2dCwtZwvCwOIFpERe0hfwGgHRCa3esOD+QiaxJb2xqCoX18WOM+Ge z7121acBfKLba8rMIjh1kfC5WEa3W+B2pwOrfQmMc+GpgeBxpfOfQVlcq/aq3N0oilTQ emnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Hqiye1dztfgjGdXqutT5p2qHXzCshwcqvdhc3yogOpY=; b=A4F0EsVdB7P6EwIa26GObqg9byo16PmPOGPPrmRPf2Ei++DEZ7XxrW+e5uUXo3gTMa V05cOu9sCqvsyMOjJgWkd71NQtnACUEe+rNH+8HRjlM5YKXNg3+IP+S3zjXdJRdqVop+ We+z5ET6wa6q+CPFRPyQDVF8VI8EGAj21WBju5BHPjBxqqVhOMv/i6b3EX1Xk3wdsaPh HWKEGUnWpYLFm6fJzEWY14QjprbCcUoDS12N51u6SjJpiP+y8Ook+FSvY4msggkefNaR c41XWk2IE/xQvcAZnjSAwu3ebibLhB1ZQBmDU7GNoZalllAGqW+tVVad3Y0tPFVZz3Zp xrQw== X-Gm-Message-State: AHYfb5i2+B0lSTTIVaptOncHjwCEsNVxY0rAPiNhmbRuLYwI/yM6ivG7 yjGyPY8bPy7anaMmnOE= X-Received: by 10.223.180.66 with SMTP id v2mr6284770wrd.210.1502315720085; Wed, 09 Aug 2017 14:55:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 Aug 2017 23:55:04 +0200 Message-Id: <20170809215510.22802-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170809215510.22802-1-pbonzini@redhat.com> References: <20170809215510.22802-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH 06/12] qemu-iotests: do not do useless search for QEMU_*_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-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the exception of qnio_server, all the variables are initialized by "check" prior to "common" being sourced. They cannot be empty. Only the "realpath" invocation is useful, and 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 --- tests/qemu-iotests/common | 19 ++++++++++++++ tests/qemu-iotests/common.config | 54 ------------------------------------= ---- 2 files changed, 19 insertions(+), 54 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index f58e56fc40..33557abe6c 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -42,6 +42,25 @@ _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 +} + +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")") +if [ -z "$QEMU_VXHS_PROG" ]; then + export QEMU_VXHS_PROG=3D"`set_prog_path qnio_server`" +fi + diff=3D"diff -u" verbose=3Dfalse debug=3Dfalse diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index ee10c23672..9d535415b5 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -30,28 +30,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,38 +39,6 @@ _optstr_add() fi } =20 -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_IMG_EXTRA_ARGS=3D if [ "$IMGOPTSSYNTAX" =3D "true" ]; then QEMU_IMG_EXTRA_ARGS=3D"--image-opts $QEMU_IMG_EXTRA_ARGS" --=20 2.13.3