From nobody Wed Apr 16 12:18:53 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 1516716697310857.7725138392778; Tue, 23 Jan 2018 06:11:37 -0800 (PST) Received: from localhost ([::1]:59773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edzIW-0002Cw-I3 for importer@patchew.org; Tue, 23 Jan 2018 09:11:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edz9r-0003Zb-Ci for qemu-devel@nongnu.org; Tue, 23 Jan 2018 09:02:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edz9q-0005w8-Br for qemu-devel@nongnu.org; Tue, 23 Jan 2018 09:02:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edz9i-0005r2-Qx; Tue, 23 Jan 2018 09:02:31 -0500 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 E6D3C37EE7; Tue, 23 Jan 2018 14:02:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-26.ams2.redhat.com [10.36.117.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 636E2BA9D; Tue, 23 Jan 2018 14:02:28 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 23 Jan 2018 15:01:48 +0100 Message-Id: <20180123140201.31163-17-kwolf@redhat.com> In-Reply-To: <20180123140201.31163-1-kwolf@redhat.com> References: <20180123140201.31163-1-kwolf@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, 23 Jan 2018 14:02:29 +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 16/29] iotests: Drop format-specific in _filter_img_info 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: Max Reitz _filter_img_info should remove format-specific information, too. We already have such a filter in _img_info, and it is very useful for query-block-named-block-nodes (etc.), too. However, in 198 we need that information (but we still want the rest of the filter), so make that filtering optional. Note that "the rest of the filter" includes filtering of the test directory, so we can drop the _filter_testdir from 198 at the same time. Signed-off-by: Max Reitz Message-id: 20171123020832.8165-7-mreitz@redhat.com Reviewed-by: Eric Blake Reviewed-by: Fam Zheng Signed-off-by: Max Reitz --- tests/qemu-iotests/198 | 6 ++++-- tests/qemu-iotests/common.filter | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198 index 34ef666381..a84a058396 100755 --- a/tests/qemu-iotests/198 +++ b/tests/qemu-iotests/198 @@ -91,11 +91,13 @@ $QEMU_IO --object $SECRET0 --object $SECRET1 -c "read -= P 0x9 0 $size" --image-op =20 echo echo "=3D=3D checking image base =3D=3D" -$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info | _filter_test= dir | sed -e "/^disk size:/ D" +$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-speci= fic \ + | sed -e "/^disk size:/ D" =20 echo echo "=3D=3D checking image layer =3D=3D" -$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info | _filter_tes= tdir | sed -e "/^disk size:/ D" +$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-spec= ific \ + | sed -e "/^disk size:/ D" =20 =20 # success, all done diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index f08248bfd9..cb2be23340 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -140,6 +140,15 @@ _filter_img_create() =20 _filter_img_info() { + if [[ "$1" =3D=3D "--format-specific" ]]; then + local format_specific=3D1 + shift + else + local format_specific=3D0 + fi + + discard=3D0 + regex_json_spec_start=3D'^ *"format-specific": \{' sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ -e "s#$IMGFMT#IMGFMT#g" \ @@ -160,7 +169,25 @@ _filter_img_info() -e "/block_state_zero: \\(on\\|off\\)/d" \ -e "/log_size: [0-9]\\+/d" \ -e "s/iters: [0-9]\\+/iters: 1024/" \ - -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-00000000000= 0/" + -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-00000000000= 0/" | \ + while IFS=3D'' read -r line; do + if [[ $format_specific =3D=3D 1 ]]; then + discard=3D0 + elif [[ $line =3D=3D "Format specific information:" ]]; then + discard=3D1 + elif [[ $line =3D~ $regex_json_spec_start ]]; then + discard=3D2 + regex_json_spec_end=3D"^${line%%[^ ]*}\\},? *$" + fi + if [[ $discard =3D=3D 0 ]]; then + echo "$line" + elif [[ $discard =3D=3D 1 && ! $line ]]; then + echo + discard=3D0 + elif [[ $discard =3D=3D 2 && $line =3D~ $regex_json_spec_end ]]; t= hen + discard=3D0 + fi + done } =20 # filter out offsets and file names from qemu-img map; good for both --=20 2.13.6