From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164679815237613.924773960885204; Tue, 8 Mar 2022 19:55:52 -0800 (PST) Received: from localhost ([::1]:50054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnQV-0005dJ-DW for importer@patchew.org; Tue, 08 Mar 2022 22:55:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnP8-0002DD-P2 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnP6-0002sW-V0 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-mWJm8eKHO3ax1nUtbJXB7w-1; Tue, 08 Mar 2022 22:54:21 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6142D1006AA8; Wed, 9 Mar 2022 03:54:20 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA0376C180; Wed, 9 Mar 2022 03:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wMRL5vCKMqSJ8xk2IWjcfX3vFXwqergihos7hXo/TGQ=; b=hu2/3KtCkkQx4xmtlAWVqQBSCS3sJIxGy1STLQM4Aa9EpMhuJTQJJm3IrwOSbQ1Qie5gUe Uikyvmx33YwxP4IAqIMfzhtWvToEnq3lbvXutZto813ZTk8hSYGMdwPGirs2eWya6pt0y0 5FfMTtIcw/8nfWCTFe/KMf70xK0JZVs= X-MC-Unique: mWJm8eKHO3ax1nUtbJXB7w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 01/14] iotests: add qemu_img_json() Date: Tue, 8 Mar 2022 22:53:54 -0500 Message-Id: <20220309035407.1848654-2-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798153327100001 Content-Type: text/plain; charset="utf-8" qemu_img_json() is a new helper built on top of qemu_img() that tries to pull a valid JSON document out of the stdout stream. In the event that the return code is negative (the program crashed), or the code is greater than zero and did not produce valid JSON output, the VerboseProcessError raised by qemu_img() is re-raised. In the event that the return code is zero but we can't parse valid JSON, allow the JSON deserialization error to be raised. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com --- tests/qemu-iotests/iotests.py | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7057db0686..546b142a6c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -276,6 +276,44 @@ def ordered_qmp(qmsg, conv_keys=3DTrue): def qemu_img_create(*args: str) -> subprocess.CompletedProcess[str]: return qemu_img('create', *args) =20 +def qemu_img_json(*args: str) -> Any: + """ + Run qemu-img and return its output as deserialized JSON. + + :raise CalledProcessError: + When qemu-img crashes, or returns a non-zero exit code without + producing a valid JSON document to stdout. + :raise JSONDecoderError: + When qemu-img returns 0, but failed to produce a valid JSON docume= nt. + + :return: A deserialized JSON object; probably a dict[str, Any]. + """ + json_data =3D ... # json.loads can legitimately return 'None'. + + try: + res =3D qemu_img(*args, combine_stdio=3DFalse) + except subprocess.CalledProcessError as exc: + # Terminated due to signal. Don't bother. + if exc.returncode < 0: + raise + + # Commands like 'check' can return failure (exit codes 2 and 3) + # to indicate command completion, but with errors found. For + # multi-command flexibility, ignore the exact error codes and + # *try* to load JSON. + try: + json_data =3D json.loads(exc.stdout) + except json.JSONDecodeError: + # Nope. This thing is toast. Raise the process error. + pass + + if json_data is ...: + raise + + if json_data is ...: + json_data =3D json.loads(res.stdout) + return json_data + def qemu_img_measure(*args): return json.loads(qemu_img_pipe("measure", "--output", "json", *args)) =20 --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798360261630.1098988976696; Tue, 8 Mar 2022 19:59:20 -0800 (PST) Received: from localhost ([::1]:59234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnTr-0003SK-8s for importer@patchew.org; Tue, 08 Mar 2022 22:59:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPC-0002EY-07 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnP7-0002sk-SV for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:27 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-246-MmNdfkQ9Pyy9oUVLLoR_ZA-1; Tue, 08 Mar 2022 22:54:22 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 419E6800050; Wed, 9 Mar 2022 03:54:21 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A14E70110; Wed, 9 Mar 2022 03:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ZAzXaNZvzoNawKE0fWFGah6At2Nl+97lXMDPCbNwUU=; b=N7UeX9UHLCi6t55XeQnk5j5U40Y/AiYU3X4W91ApaZp7ZJOGT/ldNUrOoq1WXjv+23uLNO CAWmY9u4aFw82w8unwsHD2l4dRqmAA4SZMXuWO0nq9kO4Sp7q2E+wsWpolVHafw61Qq/9g rutck36nhkLw1WL75WlmWggIDo4mr7s= X-MC-Unique: MmNdfkQ9Pyy9oUVLLoR_ZA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 02/14] iotests: use qemu_img_json() when applicable Date: Tue, 8 Mar 2022 22:53:55 -0500 Message-Id: <20220309035407.1848654-3-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798361172100001 Content-Type: text/plain; charset="utf-8" qemu_img_json() gives better diagnostic information on failure. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/iotests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 546b142a6c..7b37938d45 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -314,11 +314,11 @@ def qemu_img_json(*args: str) -> Any: json_data =3D json.loads(res.stdout) return json_data =20 -def qemu_img_measure(*args): - return json.loads(qemu_img_pipe("measure", "--output", "json", *args)) +def qemu_img_measure(*args: str) -> Any: + return qemu_img_json("measure", "--output", "json", *args) =20 -def qemu_img_check(*args): - return json.loads(qemu_img_pipe("check", "--output", "json", *args)) +def qemu_img_check(*args: str) -> Any: + return qemu_img_json("check", "--output", "json", *args) =20 def qemu_img_pipe(*args: str) -> str: '''Run qemu-img and return its output''' --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798346182558.1878611167082; Tue, 8 Mar 2022 19:59:06 -0800 (PST) Received: from localhost ([::1]:57722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnTc-0002Pu-4W for importer@patchew.org; Tue, 08 Mar 2022 22:59:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPA-0002FV-EA for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnP8-0002sx-Oh for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:28 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-a7mWeM4YPOSamalS7MYwng-1; Tue, 08 Mar 2022 22:54:24 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB9AA801AEB; Wed, 9 Mar 2022 03:54:23 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6904B6C180; Wed, 9 Mar 2022 03:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p2OgVa4C65TTwMqaNcpqPpN0V32xQ1mArAKqfBuCJWU=; b=M54ThxvMDEixbDN1T/J9IWMMQFR/HdoawFXw9JbiQvC/XYP7vjwRBLcBhk0hESoVmpALZC UQnBT48Ar703wOmh7NsgLgDNHYUNsWNr12wGpR7vU5FdBtvqavO1L4E/VKwG5ZBDcpzZyb Trdj1CyMheG4dWCoqEXxcWznJySA2+E= X-MC-Unique: a7mWeM4YPOSamalS7MYwng-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 03/14] iotests: add qemu_img_info() Date: Tue, 8 Mar 2022 22:53:56 -0500 Message-Id: <20220309035407.1848654-4-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798354206100001 Content-Type: text/plain; charset="utf-8" Add qemu_img_info() by analogy with qemu_img_measure() and qemu_img_check(). Modify image_size() to use this function instead to take advantage of the better diagnostic information on failure provided (ultimately) by qemu_img(). Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/065 | 5 ++--- tests/qemu-iotests/242 | 5 ++--- tests/qemu-iotests/iotests.py | 15 +++++++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index f7c1b68dad..9466ce7df4 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -24,7 +24,7 @@ import os import re import json import iotests -from iotests import qemu_img, qemu_img_pipe +from iotests import qemu_img, qemu_img_info, qemu_img_pipe import unittest =20 test_img =3D os.path.join(iotests.test_dir, 'test.img') @@ -49,8 +49,7 @@ class TestQemuImgInfo(TestImageInfoSpecific): human_compare =3D None =20 def test_json(self): - data =3D json.loads(qemu_img_pipe('info', '--output=3Djson', test_= img)) - data =3D data['format-specific'] + data =3D qemu_img_info(test_img)['format-specific'] self.assertEqual(data['type'], iotests.imgfmt) self.assertEqual(data['data'], self.json_compare) =20 diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 index 96a30152b0..547bf382e3 100755 --- a/tests/qemu-iotests/242 +++ b/tests/qemu-iotests/242 @@ -22,7 +22,7 @@ import iotests import json import struct -from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \ +from iotests import qemu_img_create, qemu_io, qemu_img_info, \ file_path, img_info_log, log, filter_qemu_io =20 iotests.script_initialize(supported_fmts=3D['qcow2'], @@ -39,8 +39,7 @@ flag_offset =3D 0x5000f def print_bitmap(extra_args): log('qemu-img info dump:\n') img_info_log(disk, extra_args=3Dextra_args) - result =3D json.loads(qemu_img_pipe('info', '--force-share', - '--output=3Djson', disk)) + result =3D qemu_img_info('--force-share', disk) if 'bitmaps' in result['format-specific']['data']: bitmaps =3D result['format-specific']['data']['bitmaps'] log('The same bitmaps in JSON format:') diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7b37938d45..62f82281a9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -320,6 +320,9 @@ def qemu_img_measure(*args: str) -> Any: def qemu_img_check(*args: str) -> Any: return qemu_img_json("check", "--output", "json", *args) =20 +def qemu_img_info(*args: str) -> Any: + return qemu_img_json('info', "--output", "json", *args) + def qemu_img_pipe(*args: str) -> str: '''Run qemu-img and return its output''' return qemu_img_pipe_and_status(*args)[0] @@ -570,10 +573,14 @@ def create_image(name, size): file.write(sector) i =3D i + 512 =20 -def image_size(img): - '''Return image's virtual size''' - r =3D qemu_img_pipe('info', '--output=3Djson', '-f', imgfmt, img) - return json.loads(r)['virtual-size'] +def image_size(img: str) -> int: + """Return image's virtual size""" + value =3D qemu_img_info('-f', imgfmt, img)['virtual-size'] + if not isinstance(value, int): + type_name =3D type(value).__name__ + raise TypeError("Expected 'int' for 'virtual-size', " + f"got '{value}' of type '{type_name}'") + return value =20 def is_str(val): return isinstance(val, str) --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798178517767.7143767284596; Tue, 8 Mar 2022 19:56:18 -0800 (PST) Received: from localhost ([::1]:50510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnQu-0005vW-1B for importer@patchew.org; Tue, 08 Mar 2022 22:56:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPC-0002Ma-JZ for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPB-0002ts-6e for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:30 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-3udddEWTPzeNt13RtR_D2w-1; Tue, 08 Mar 2022 22:54:25 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB0BDFC81; Wed, 9 Mar 2022 03:54:24 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F5096C180; Wed, 9 Mar 2022 03:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=16wjsOJ9rjZKX7D6nsSETGvgSlpAGVSo+ZZw10K6cSE=; b=TUsFQORR8tbP/57pTMu2Hy9iufBZw7MMvAFk8/VhMwa/H7UmHVdBdgPK3IIpydJwoOrc3x OCdHU3yghGmfIFwpAVhdt54wvMIIvVPaowEKnSdMec4yK2nnKdyjx/ambIySO6MFrJqT9S 3Q6bZV7YnQrlDDoYplFYHPrCGpFiYVU= X-MC-Unique: 3udddEWTPzeNt13RtR_D2w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 04/14] iotests/remove-bitmap-from-backing: use qemu_img_info() Date: Tue, 8 Mar 2022 22:53:57 -0500 Message-Id: <20220309035407.1848654-5-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798180060100003 Content-Type: text/plain; charset="utf-8" This removes two more usages of qemu_img_pipe() and replaces them with calls to qemu_img(), which provides better diagnostic information on failure. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/tests/remove-bitmap-from-backing | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/tests/remove-bitmap-from-backing b/tests/qe= mu-iotests/tests/remove-bitmap-from-backing index fee3141340..15be32dcb9 100755 --- a/tests/qemu-iotests/tests/remove-bitmap-from-backing +++ b/tests/qemu-iotests/tests/remove-bitmap-from-backing @@ -19,7 +19,7 @@ # =20 import iotests -from iotests import log, qemu_img_create, qemu_img, qemu_img_pipe +from iotests import log, qemu_img_create, qemu_img, qemu_img_info =20 iotests.script_initialize(supported_fmts=3D['qcow2'], unsupported_imgopts=3D['compat']) @@ -33,7 +33,7 @@ qemu_img_create('-f', iotests.imgfmt, '-b', base, =20 qemu_img('bitmap', '--add', base, 'bitmap0') # Just assert that our method of checking bitmaps in the image works. -assert 'bitmaps' in qemu_img_pipe('info', base) +assert 'bitmaps' in qemu_img_info(base)['format-specific']['data'] =20 vm =3D iotests.VM().add_drive(top, 'backing.node-name=3Dbase') vm.launch() @@ -68,5 +68,5 @@ if result !=3D {'return': {}}: =20 vm.shutdown() =20 -if 'bitmaps' in qemu_img_pipe('info', base): +if 'bitmaps' in qemu_img_info(base)['format-specific']['data']: log('ERROR: Bitmap is still in the base image') --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798148292519.5608539891753; Tue, 8 Mar 2022 19:55:48 -0800 (PST) Received: from localhost ([::1]:49924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnQR-0005YA-1E for importer@patchew.org; Tue, 08 Mar 2022 22:55:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPD-0002O3-0Z for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPB-0002tq-3j for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:30 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-302-xDH1lObvOEm0u1Rs9XD9uw-1; Tue, 08 Mar 2022 22:54:26 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 990881091DA5; Wed, 9 Mar 2022 03:54:25 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id E28056C180; Wed, 9 Mar 2022 03:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S/Ibqg4xB0LjxJzd0BLSKhI/BhKRajkO1237wCDupRE=; b=NKT1yZ9FXZBG5DzWOjNNM5aNz0sc5GRSrPI6/4WIl/ALoUQ02hrKiHiD6vtstcoEYxfHve Jketdeq2CMsUVffoo1jD3k3iVr/gtyGVQrC0RCBbVye5lPO9ijmRut2snm57Wle4Hc/XWD phtXH4Ov3yGjyZWT7UkR6LnhM2KSJNw= X-MC-Unique: xDH1lObvOEm0u1Rs9XD9uw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 05/14] iotests: add qemu_img_map() function Date: Tue, 8 Mar 2022 22:53:58 -0500 Message-Id: <20220309035407.1848654-6-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798149070100001 Content-Type: text/plain; charset="utf-8" Add a qemu_img_map() function by analogy with qemu_img_measure(), qemu_img_check(), and qemu_img_info() that all return JSON information. Replace calls to qemu_img_pipe('map', '--output=3Djson', ...) with this new function, which provides better diagnostic information on failure. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com --- tests/qemu-iotests/041 | 5 ++--- tests/qemu-iotests/211 | 6 +++--- tests/qemu-iotests/iotests.py | 3 +++ tests/qemu-iotests/tests/block-status-cache | 11 ++++------- tests/qemu-iotests/tests/parallels-read-bitmap | 6 ++---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index db9f5dc540..3e16acee56 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -24,7 +24,7 @@ import os import re import json import iotests -from iotests import qemu_img, qemu_img_pipe, qemu_io +from iotests import qemu_img, qemu_img_map, qemu_io =20 backing_img =3D os.path.join(iotests.test_dir, 'backing.img') target_backing_img =3D os.path.join(iotests.test_dir, 'target-backing.img') @@ -1360,8 +1360,7 @@ class TestFilters(iotests.QMPTestCase): =20 self.vm.qmp('blockdev-del', node_name=3D'target') =20 - target_map =3D qemu_img_pipe('map', '--output=3Djson', target_img) - target_map =3D json.loads(target_map) + target_map =3D qemu_img_map(target_img) =20 assert target_map[0]['start'] =3D=3D 0 assert target_map[0]['length'] =3D=3D 512 * 1024 diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 index f52cadade1..1a3b4596c8 100755 --- a/tests/qemu-iotests/211 +++ b/tests/qemu-iotests/211 @@ -59,7 +59,7 @@ with iotests.FilePath('t.vdi') as disk_path, \ vm.shutdown() =20 iotests.img_info_log(disk_path) - iotests.log(iotests.qemu_img_pipe('map', '--output=3Djson', disk_path)) + iotests.log(iotests.qemu_img_map(disk_path)) =20 # # Successful image creation (explicit defaults) @@ -83,7 +83,7 @@ with iotests.FilePath('t.vdi') as disk_path, \ vm.shutdown() =20 iotests.img_info_log(disk_path) - iotests.log(iotests.qemu_img_pipe('map', '--output=3Djson', disk_path)) + iotests.log(iotests.qemu_img_map(disk_path)) =20 # # Successful image creation (with non-default options) @@ -107,7 +107,7 @@ with iotests.FilePath('t.vdi') as disk_path, \ vm.shutdown() =20 iotests.img_info_log(disk_path) - iotests.log(iotests.qemu_img_pipe('map', '--output=3Djson', disk_path)) + iotests.log(iotests.qemu_img_map(disk_path)) =20 # # Invalid BlockdevRef diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 62f82281a9..3896440238 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -323,6 +323,9 @@ def qemu_img_check(*args: str) -> Any: def qemu_img_info(*args: str) -> Any: return qemu_img_json('info', "--output", "json", *args) =20 +def qemu_img_map(*args: str) -> Any: + return qemu_img_json('map', "--output", "json", *args) + def qemu_img_pipe(*args: str) -> str: '''Run qemu-img and return its output''' return qemu_img_pipe_and_status(*args)[0] diff --git a/tests/qemu-iotests/tests/block-status-cache b/tests/qemu-iotes= ts/tests/block-status-cache index 40e648e251..5a7bc2c149 100755 --- a/tests/qemu-iotests/tests/block-status-cache +++ b/tests/qemu-iotests/tests/block-status-cache @@ -22,7 +22,7 @@ import os import signal import iotests -from iotests import qemu_img_create, qemu_img_pipe, qemu_nbd +from iotests import qemu_img_create, qemu_img_map, qemu_nbd =20 =20 image_size =3D 1 * 1024 * 1024 @@ -76,8 +76,7 @@ class TestBscWithNbd(iotests.QMPTestCase): # to allocate the first sector to facilitate alignment probing), a= nd # then the rest to be zero. The BSC will thus contain (if anythin= g) # one range covering the first sector. - map_pre =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts', - nbd_img_opts) + map_pre =3D qemu_img_map('--image-opts', nbd_img_opts) =20 # qemu:allocation-depth maps for want_zero=3Dfalse. # want_zero=3Dfalse should (with the file driver, which the server= is @@ -111,14 +110,12 @@ class TestBscWithNbd(iotests.QMPTestCase): # never loop too many times here. for _ in range(2): # (Ignore the result, this is just to contaminate the cache) - qemu_img_pipe('map', '--output=3Djson', '--image-opts', - nbd_img_opts_alloc_depth) + qemu_img_map('--image-opts', nbd_img_opts_alloc_depth) =20 # Now let's see whether the cache reports everything as data, or # whether we get correct information (i.e. the same as we got on o= ur # first attempt). - map_post =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts= ', - nbd_img_opts) + map_post =3D qemu_img_map('--image-opts', nbd_img_opts) =20 if map_pre !=3D map_post: print('ERROR: Map information differs before and after queryin= g ' + diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap b/tests/qemu-io= tests/tests/parallels-read-bitmap index af6b9c5db3..38ab5fa5b2 100755 --- a/tests/qemu-iotests/tests/parallels-read-bitmap +++ b/tests/qemu-iotests/tests/parallels-read-bitmap @@ -18,9 +18,8 @@ # along with this program. If not, see . # =20 -import json import iotests -from iotests import qemu_nbd_popen, qemu_img_pipe, log, file_path +from iotests import qemu_nbd_popen, qemu_img_map, log, file_path =20 iotests.script_initialize(supported_fmts=3D['parallels']) =20 @@ -36,8 +35,7 @@ iotests.unarchive_sample_image('parallels-with-bitmap', d= isk) =20 with qemu_nbd_popen('--read-only', f'--socket=3D{nbd_sock}', f'--bitmap=3D{bitmap}', '-f', iotests.imgfmt, disk): - out =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts', nbd_op= ts) - chunks =3D json.loads(out) + chunks =3D qemu_img_map('--image-opts', nbd_opts) cluster =3D 64 * 1024 =20 log('dirty clusters (cluster size is 64K):') --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798484117164.45458865006276; Tue, 8 Mar 2022 20:01:24 -0800 (PST) Received: from localhost ([::1]:38704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnVq-00009f-8Y for importer@patchew.org; Tue, 08 Mar 2022 23:01:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPE-0002Qm-0R for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPB-0002tw-9J for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:31 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-UoLAMHkPOZiVTHRnGQsLoQ-1; Tue, 08 Mar 2022 22:54:27 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FFE5801AEB; Wed, 9 Mar 2022 03:54:26 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id C01AD6C180; Wed, 9 Mar 2022 03:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IsvqKXC+sfrrxcgF4USsVtcCqST5mtfgg+JjmWgZ5ao=; b=YT0RWOSrRWCQv9gaGa2qMRTqWTsBKPKuuQ3gqm6u3QvaJ+LJBC0aKdKMIp0xGD3W2xUun6 P9NIJVGcxzGb9IHxT7UgOSwKv33GYyaHemC6ElnfJtf80FH4tD/otinUXEzD5iWQV0kPir e1xGjN+vahM2CHxCOqFhugzNcRYWn4Q= X-MC-Unique: UoLAMHkPOZiVTHRnGQsLoQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 06/14] iotests: change supports_quorum to use qemu_img Date: Tue, 8 Mar 2022 22:53:59 -0500 Message-Id: <20220309035407.1848654-7-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798485814100001 Content-Type: text/plain; charset="utf-8" Similar to other recent changes: use the qemu_img() invocation that supports throwing loud, nasty exceptions when it fails for surprising reasons. (Why would "--help" ever fail? I don't know, but eliminating *all* calls to qemu-img that do not go through qemu_img() is my goal, so qemu_img_pipe() has to be removed.) Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 3896440238..698d5a7fdc 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1433,8 +1433,8 @@ def _verify_imgopts(unsupported: Sequence[str] =3D ()= ) -> None: notrun(f'not suitable for this imgopts: {imgopts}') =20 =20 -def supports_quorum(): - return 'quorum' in qemu_img_pipe('--help') +def supports_quorum() -> bool: + return 'quorum' in qemu_img('--help').stdout =20 def verify_quorum(): '''Skip test suite if quorum support is not available''' --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798357361211.23119985949097; Tue, 8 Mar 2022 19:59:17 -0800 (PST) Received: from localhost ([::1]:58948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnTp-0003Gk-9I for importer@patchew.org; Tue, 08 Mar 2022 22:59:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPE-0002SA-CS for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPC-0002uE-A6 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-454-6zed9cF0NHqgaQ0FhwINEw-1; Tue, 08 Mar 2022 22:54:28 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 751A6FC81; Wed, 9 Mar 2022 03:54:27 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id A03427010B; Wed, 9 Mar 2022 03:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQQt51M7XYJHxuO5nIX3wj9N/R34oqLZmz9EMgSPiuE=; b=VceEbfT8qikSx4zuBwiQ75JQiUnQBJIOP6y6DDs9qVuknSQjhZYu9fFsaF2p3zaMV6aDs7 U/2CXBZpwzE6/plA3Hd2I5wB4Z8Fp+0MJhfFDHZlbRwrQB+S++u8ozoiwpK0pNZDzFp2/x cxBQpJNUtNnQD7XJjtMVBcYs+uEmScg= X-MC-Unique: 6zed9cF0NHqgaQ0FhwINEw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 07/14] iotests: replace unchecked calls to qemu_img_pipe() Date: Tue, 8 Mar 2022 22:54:00 -0500 Message-Id: <20220309035407.1848654-8-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798358982100001 Content-Type: text/plain; charset="utf-8" qemu_img_pipe() discards the return code from qemu-img in favor of returning just its output. Some tests using this function don't save, log, or check the output either, though, which is unsafe. Replace all of these calls with a checked version. Tests affected are 194, 202, 203, 234, 262, and 303. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/194 | 4 ++-- tests/qemu-iotests/202 | 4 ++-- tests/qemu-iotests/203 | 4 ++-- tests/qemu-iotests/234 | 4 ++-- tests/qemu-iotests/262 | 2 +- tests/qemu-iotests/303 | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 index e44b8df728..68894371f5 100755 --- a/tests/qemu-iotests/194 +++ b/tests/qemu-iotests/194 @@ -33,8 +33,8 @@ with iotests.FilePath('source.img') as source_img_path, \ iotests.VM('dest') as dest_vm: =20 img_size =3D '1G' - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, source_img_path,= img_size) - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, dest_img_path, i= mg_size) + iotests.qemu_img_create('-f', iotests.imgfmt, source_img_path, img_siz= e) + iotests.qemu_img_create('-f', iotests.imgfmt, dest_img_path, img_size) =20 iotests.log('Launching VMs...') (source_vm.add_drive(source_img_path) diff --git a/tests/qemu-iotests/202 b/tests/qemu-iotests/202 index 8eb5f32d15..b784dcd791 100755 --- a/tests/qemu-iotests/202 +++ b/tests/qemu-iotests/202 @@ -35,8 +35,8 @@ with iotests.FilePath('disk0.img') as disk0_img_path, \ iotests.VM() as vm: =20 img_size =3D '10M' - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk0_img_path, = img_size) - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk1_img_path, = img_size) + iotests.qemu_img_create('-f', iotests.imgfmt, disk0_img_path, img_size) + iotests.qemu_img_create('-f', iotests.imgfmt, disk1_img_path, img_size) =20 iotests.log('Launching VM...') vm.launch() diff --git a/tests/qemu-iotests/203 b/tests/qemu-iotests/203 index ea30e50497..ab80fd0e44 100755 --- a/tests/qemu-iotests/203 +++ b/tests/qemu-iotests/203 @@ -33,8 +33,8 @@ with iotests.FilePath('disk0.img') as disk0_img_path, \ iotests.VM() as vm: =20 img_size =3D '10M' - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk0_img_path, = img_size) - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk1_img_path, = img_size) + iotests.qemu_img_create('-f', iotests.imgfmt, disk0_img_path, img_size) + iotests.qemu_img_create('-f', iotests.imgfmt, disk1_img_path, img_size) =20 iotests.log('Launching VM...') (vm.add_object('iothread,id=3Diothread0') diff --git a/tests/qemu-iotests/234 b/tests/qemu-iotests/234 index cb5f1753e0..a9f764bb2c 100755 --- a/tests/qemu-iotests/234 +++ b/tests/qemu-iotests/234 @@ -34,8 +34,8 @@ with iotests.FilePath('img') as img_path, \ iotests.VM(path_suffix=3D'a') as vm_a, \ iotests.VM(path_suffix=3D'b') as vm_b: =20 - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, backing_path, '6= 4M') - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, img_path, '64M') + iotests.qemu_img_create('-f', iotests.imgfmt, backing_path, '64M') + iotests.qemu_img_create('-f', iotests.imgfmt, img_path, '64M') =20 os.mkfifo(fifo_a) os.mkfifo(fifo_b) diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262 index 32d69988ef..2294fd5ecb 100755 --- a/tests/qemu-iotests/262 +++ b/tests/qemu-iotests/262 @@ -51,7 +51,7 @@ with iotests.FilePath('img') as img_path, \ =20 vm.add_device('virtio-blk,drive=3D%s,iothread=3Diothread0' % root) =20 - iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, img_path, '64M') + iotests.qemu_img_create('-f', iotests.imgfmt, img_path, '64M') =20 os.mkfifo(fifo) =20 diff --git a/tests/qemu-iotests/303 b/tests/qemu-iotests/303 index 16c2e10827..93aa5ce9b7 100755 --- a/tests/qemu-iotests/303 +++ b/tests/qemu-iotests/303 @@ -38,7 +38,7 @@ def create_bitmap(bitmap_number, disabled): if disabled: args.append('--disable') =20 - iotests.qemu_img_pipe(*args) + iotests.qemu_img(*args) =20 =20 def write_to_disk(offset, size): --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798522943556.2608477352828; Tue, 8 Mar 2022 20:02:02 -0800 (PST) Received: from localhost ([::1]:40328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnWT-0001J3-Kv for importer@patchew.org; Tue, 08 Mar 2022 23:02:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPH-0002bN-9C for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42073) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPF-0002vJ-1Z for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-Z1htn9hlPwahjwB8MBVUGg-1; Tue, 08 Mar 2022 22:54:29 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57160800050; Wed, 9 Mar 2022 03:54:28 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id A01FA6C180; Wed, 9 Mar 2022 03:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/cBgTf2eOQpwjDLoK22TIA14RL8GOYM/VL4SDCZlZs=; b=W4oaH1BuAfnFWZ9Sh7diLkzxCGtslFwmOqHYmrWXMvrxBGHuTmwWg0ITaIQLijmdNIwP7m pVQDdHSLHVk6Z8EpPOpo13MtKK3UiZnNP1GR35wYpIsIzNcTC4BIIiFnoZWO7HO5juHA8x 7C65J/hHNfjRwYyzkAFVttm+obm3H7w= X-MC-Unique: Z1htn9hlPwahjwB8MBVUGg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 08/14] iotests/149: Remove qemu_img_pipe() call Date: Tue, 8 Mar 2022 22:54:01 -0500 Message-Id: <20220309035407.1848654-9-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798523331100003 Content-Type: text/plain; charset="utf-8" qemu_img_pipe calls blank their output when the command being run is a 'create' call and the command succeeds. Thus, the normative output for this command in iotest 149 is to print a blank line. We can remove the logging from this invocation and use a checked invocation, but we still need to inspect the actual output to see if we want to retroactively skip the test due to missing cipher support. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/149 | 7 +++++-- tests/qemu-iotests/149.out | 21 --------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149 index d49646ca60..9bb96d6a1d 100755 --- a/tests/qemu-iotests/149 +++ b/tests/qemu-iotests/149 @@ -265,8 +265,11 @@ def qemu_img_create(config, size_mb): "%dM" % size_mb] =20 iotests.log("qemu-img " + " ".join(args), filters=3D[iotests.filter_te= st_dir]) - iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)), - filters=3D[iotests.filter_test_dir]) + try: + iotests.qemu_img(*args) + except subprocess.CalledProcessError as exc: + check_cipher_support(config, exc.output) + raise =20 def qemu_io_image_args(config, dev=3DFalse): """Get the args for access an image or device with qemu-io""" diff --git a/tests/qemu-iotests/149.out b/tests/qemu-iotests/149.out index ab879596ce..2cc5b82f7c 100644 --- a/tests/qemu-iotests/149.out +++ b/tests/qemu-iotests/149.out @@ -61,7 +61,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-aes-256-xts-pla= in64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha1.img = qiotest-145-aes-256-xts-plain64-sha1 # Write test pattern 0xa7 @@ -180,7 +179,6 @@ unlink TEST_DIR/luks-twofish-256-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img twofish-256= -xts-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dtwofish-256,ciph= er-mode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-twofish-256= -xts-plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-twofish-256-xts-plain64-sha1.= img qiotest-145-twofish-256-xts-plain64-sha1 # Write test pattern 0xa7 @@ -299,7 +297,6 @@ unlink TEST_DIR/luks-serpent-256-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img serpent-256= -xts-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dserpent-256,ciph= er-mode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-serpent-256= -xts-plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-256-xts-plain64-sha1.= img qiotest-145-serpent-256-xts-plain64-sha1 # Write test pattern 0xa7 @@ -418,7 +415,6 @@ unlink TEST_DIR/luks-cast5-128-cbc-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img cast5-128-c= bc-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dcast5-128,cipher= -mode=3Dcbc,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-cast5-128-cbc= -plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-cast5-128-cbc-plain64-sha1.im= g qiotest-145-cast5-128-cbc-plain64-sha1 # Write test pattern 0xa7 @@ -538,7 +534,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-cbc= -plain-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dcbc,ivgen-alg=3Dplain,hash-alg=3Dsha1 TEST_DIR/luks-aes-256-cbc-plain= -sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain-sha1.img qi= otest-145-aes-256-cbc-plain-sha1 # Write test pattern 0xa7 @@ -657,7 +652,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-cbc= -plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dcbc,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-aes-256-cbc-pla= in64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain64-sha1.img = qiotest-145-aes-256-cbc-plain64-sha1 # Write test pattern 0xa7 @@ -776,7 +770,6 @@ unlink TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-cbc= -essiv-sha256-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dcbc,ivgen-alg=3Dessiv,hash-alg=3Dsha1,ivgen-hash-alg=3Dsha256 TEST_DI= R/luks-aes-256-cbc-essiv-sha256-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-essiv-sha256-sha1= .img qiotest-145-aes-256-cbc-essiv-sha256-sha1 # Write test pattern 0xa7 @@ -895,7 +888,6 @@ unlink TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -essiv-sha256-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dessiv,hash-alg=3Dsha1,ivgen-hash-alg=3Dsha256 TEST_DI= R/luks-aes-256-xts-essiv-sha256-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-essiv-sha256-sha1= .img qiotest-145-aes-256-xts-essiv-sha256-sha1 # Write test pattern 0xa7 @@ -1014,7 +1006,6 @@ unlink TEST_DIR/luks-aes-128-xts-plain64-sha256-sha1.= img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-128-xts= -plain64-sha256-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-128,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-aes-128-xts-pla= in64-sha256-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-128-xts-plain64-sha256-sh= a1.img qiotest-145-aes-128-xts-plain64-sha256-sha1 # Write test pattern 0xa7 @@ -1133,7 +1124,6 @@ unlink TEST_DIR/luks-aes-192-xts-plain64-sha256-sha1.= img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-192-xts= -plain64-sha256-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-192,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-aes-192-xts-pla= in64-sha256-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-192-xts-plain64-sha256-sh= a1.img qiotest-145-aes-192-xts-plain64-sha256-sha1 # Write test pattern 0xa7 @@ -1252,7 +1242,6 @@ unlink TEST_DIR/luks-twofish-128-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img twofish-128= -xts-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dtwofish-128,ciph= er-mode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-twofish-128= -xts-plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-twofish-128-xts-plain64-sha1.= img qiotest-145-twofish-128-xts-plain64-sha1 # Write test pattern 0xa7 @@ -1372,7 +1361,6 @@ unlink TEST_DIR/luks-serpent-128-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img serpent-128= -xts-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dserpent-128,ciph= er-mode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-serpent-128= -xts-plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-128-xts-plain64-sha1.= img qiotest-145-serpent-128-xts-plain64-sha1 # Write test pattern 0xa7 @@ -1491,7 +1479,6 @@ unlink TEST_DIR/luks-serpent-192-xts-plain64-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img serpent-192= -xts-plain64-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Dserpent-192,ciph= er-mode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha1 TEST_DIR/luks-serpent-192= -xts-plain64-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-serpent-192-xts-plain64-sha1.= img qiotest-145-serpent-192-xts-plain64-sha1 # Write test pattern 0xa7 @@ -1612,7 +1599,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha224.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-sha224 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha224 TEST_DIR/luks-aes-256-xts-p= lain64-sha224.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha224.im= g qiotest-145-aes-256-xts-plain64-sha224 # Write test pattern 0xa7 @@ -1731,7 +1717,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha256.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-sha256 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha256 TEST_DIR/luks-aes-256-xts-p= lain64-sha256.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha256.im= g qiotest-145-aes-256-xts-plain64-sha256 # Write test pattern 0xa7 @@ -1850,7 +1835,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha384.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-sha384 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha384 TEST_DIR/luks-aes-256-xts-p= lain64-sha384.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha384.im= g qiotest-145-aes-256-xts-plain64-sha384 # Write test pattern 0xa7 @@ -1969,7 +1953,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-sha512.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-sha512 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dsha512 TEST_DIR/luks-aes-256-xts-p= lain64-sha512.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-sha512.im= g qiotest-145-aes-256-xts-plain64-sha512 # Write test pattern 0xa7 @@ -2088,7 +2071,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain64-ripemd160.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain64-ripemd160 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain64,hash-alg=3Dripemd160 TEST_DIR/luks-aes-256-xt= s-plain64-ripemd160.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain64-ripemd160= .img qiotest-145-aes-256-xts-plain64-ripemd160 # Write test pattern 0xa7 @@ -2281,7 +2263,6 @@ unlink TEST_DIR/luks-aes-256-xts-plain-sha1-pwallslot= s.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-xts= -plain-sha1-pwallslots =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3Dc2xvdDE=3D,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dxts,ivgen-alg=3Dplain,hash-alg=3Dsha1 TEST_DIR/luks-aes-256-xts-plain= -sha1-pwallslots.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-xts-plain-sha1-pwalls= lots.img qiotest-145-aes-256-xts-plain-sha1-pwallslots # Write test pattern 0xa7 @@ -2400,7 +2381,6 @@ unlink TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-cbc= -essiv-auto-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dcbc,ivgen-alg=3Dessiv,hash-alg=3Dsha1 TEST_DIR/luks-aes-256-cbc-essiv= -auto-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-essiv-auto-sha1.i= mg qiotest-145-aes-256-cbc-essiv-auto-sha1 # Write test pattern 0xa7 @@ -2519,7 +2499,6 @@ unlink TEST_DIR/luks-aes-256-cbc-plain64-sha256-sha1.= img # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D qemu-img aes-256-cbc= -plain64-sha256-sha1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # Create image qemu-img create -f luks --object secret,id=3Dsec0,data=3DMTIzNDU2,format= =3Dbase64 -o key-secret=3Dsec0,iter-time=3D10,cipher-alg=3Daes-256,cipher-m= ode=3Dcbc,ivgen-alg=3Dplain64,hash-alg=3Dsha1,ivgen-hash-alg=3Dsha256 TEST_= DIR/luks-aes-256-cbc-plain64-sha256-sha1.img 4194304M - # Open dev sudo cryptsetup -q -v luksOpen TEST_DIR/luks-aes-256-cbc-plain64-sha256-sh= a1.img qiotest-145-aes-256-cbc-plain64-sha256-sha1 # Write test pattern 0xa7 --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798367537238.1868546974589; Tue, 8 Mar 2022 19:59:27 -0800 (PST) Received: from localhost ([::1]:59912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnTy-0003uC-HS for importer@patchew.org; Tue, 08 Mar 2022 22:59:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPH-0002bq-Da for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54028) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPF-0002vS-ER for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-15-8qELQJxfOeW9_K-q3XjjJA-1; Tue, 08 Mar 2022 22:54:30 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 376B8824FA7; Wed, 9 Mar 2022 03:54:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FDB86C180; Wed, 9 Mar 2022 03:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1T8tdz+epH8dDDhITBtvE6w+xIb3eKAPuipEJEtNecY=; b=aELkfuocZ9Bvusc9VTnjyVKArh3BjlM3UYybZvatAV0DGPoThlM9/2D3OljP7kuZxB0BeN Pr8sLNRDLBrHqiJ52sVE4X3r8hW/h+kcjJbD4doaufzktIzsDNfbVs9Y+qCcE3c5eNsmuN ebe5wfgZKjY3AGx5dyogPgmY9tud+ug= X-MC-Unique: 8qELQJxfOeW9_K-q3XjjJA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 09/14] iotests: remove remaining calls to qemu_img_pipe() Date: Tue, 8 Mar 2022 22:54:02 -0500 Message-Id: <20220309035407.1848654-10-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798368244100002 Content-Type: text/plain; charset="utf-8" As part of moving all python iotest invocations of qemu-img onto a single qemu_img() implementation, remove a few lingering uses of qemu_img_pipe() from outside of iotests.py itself. Several cases here rely on the knowledge that qemu_img_pipe() suppresses *all* output on a successful case when the command being issued is 'create'. 065: This call's output is inspected, but it appears as if it's expected to succeed. Replace this call with the checked qemu_img() variant instead to get better diagnostics if/when qemu-img itself fails. 237: "create" call output isn't actually logged. Use qemu_img_create() instead, which checks the return code. Remove the empty lines from the test output. 296: Two calls; -create: Expected to succeed. Like other create calls, the output isn't actually logged. Switch to a checked variant (qemu_img_create) instead. The output for this test is a mixture of both test styles, so actually replace the blank line for readability. -amend: This is expected to fail. Log the output. After this patch, the only uses of qemu_img_pipe are internal to iotests.py and will be removed in subsequent patches. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/065 | 4 ++-- tests/qemu-iotests/237 | 3 +-- tests/qemu-iotests/237.out | 3 --- tests/qemu-iotests/296 | 12 ++++++------ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index 9466ce7df4..ba94e19349 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -24,7 +24,7 @@ import os import re import json import iotests -from iotests import qemu_img, qemu_img_info, qemu_img_pipe +from iotests import qemu_img, qemu_img_info import unittest =20 test_img =3D os.path.join(iotests.test_dir, 'test.img') @@ -54,7 +54,7 @@ class TestQemuImgInfo(TestImageInfoSpecific): self.assertEqual(data['data'], self.json_compare) =20 def test_human(self): - data =3D qemu_img_pipe('info', '--output=3Dhuman', test_img).split= ('\n') + data =3D qemu_img('info', '--output=3Dhuman', test_img).stdout.spl= it('\n') data =3D data[(data.index('Format specific information:') + 1) :data.index('')] for field in data: diff --git a/tests/qemu-iotests/237 b/tests/qemu-iotests/237 index 43dfd3bd40..5ea13eb01f 100755 --- a/tests/qemu-iotests/237 +++ b/tests/qemu-iotests/237 @@ -165,8 +165,7 @@ with iotests.FilePath('t.vmdk') as disk_path, \ iotests.log("") =20 for path in [ extent1_path, extent2_path, extent3_path ]: - msg =3D iotests.qemu_img_pipe('create', '-f', imgfmt, path, '0') - iotests.log(msg, [iotests.filter_testfiles]) + iotests.qemu_img_create('-f', imgfmt, path, '0') =20 vm.add_blockdev('driver=3Dfile,filename=3D%s,node-name=3Dext1' % (exte= nt1_path)) vm.add_blockdev('driver=3Dfile,filename=3D%s,node-name=3Dext2' % (exte= nt2_path)) diff --git a/tests/qemu-iotests/237.out b/tests/qemu-iotests/237.out index aeb9724492..62b8865677 100644 --- a/tests/qemu-iotests/237.out +++ b/tests/qemu-iotests/237.out @@ -129,9 +129,6 @@ Job failed: Cannot find device=3D'this doesn't exist' n= or node-name=3D'this doesn't =20 =3D=3D=3D Other subformats =3D=3D=3D =20 - - - =3D=3D Missing extent =3D=3D =20 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": = {"driver": "vmdk", "file": "node0", "size": 33554432, "subformat": "monolit= hicFlat"}}} diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 index f80ef3434a..0d21b740a7 100755 --- a/tests/qemu-iotests/296 +++ b/tests/qemu-iotests/296 @@ -76,7 +76,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # create the encrypted block device using qemu-img def createImg(self, file, secret): =20 - output =3D iotests.qemu_img_pipe( + iotests.qemu_img( 'create', '--object', *secret.to_cmdline_object(), '-f', iotests.imgfmt, @@ -84,8 +84,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): '-o', 'iter-time=3D10', file, '1M') - - iotests.log(output, filters=3D[iotests.filter_test_dir]) + iotests.log('') =20 # attempts to add a key using qemu-img def addKey(self, file, secret, new_secret): @@ -99,7 +98,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } } =20 - output =3D iotests.qemu_img_pipe( + output =3D iotests.qemu_img( 'amend', '--object', *secret.to_cmdline_object(), '--object', *new_secret.to_cmdline_object(), @@ -108,8 +107,9 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): '-o', 'new-secret=3D' + new_secret.id(), '-o', 'iter-time=3D10', =20 - "json:" + json.dumps(image_options) - ) + "json:" + json.dumps(image_options), + check=3DFalse # Expected to fail. Log output. + ).stdout =20 iotests.log(output, filters=3D[iotests.filter_test_dir]) =20 --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798521002987.7327888851291; Tue, 8 Mar 2022 20:02:01 -0800 (PST) Received: from localhost ([::1]:40310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnWR-0001IZ-T8 for importer@patchew.org; Tue, 08 Mar 2022 23:01:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPI-0002gg-Ji for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPG-0002w5-SA for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-444-QLw_F_wtPs630agNIFNivg-1; Tue, 08 Mar 2022 22:54: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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D1718031E1; Wed, 9 Mar 2022 03:54:30 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75D9B6C180; Wed, 9 Mar 2022 03:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QOPH7Li9PuXqw8RH5o/slidpTv02H4wzLrFYbYKKJYo=; b=dQ02vAKfFXupuAn61dJHTUfJCwpsyF8TQWv1Ys3NT3nXqRK9T7oqd4tHmY+rQBkl89JZa+ Shl0izj3E7cGN6WkIWcBP6/MzF4GerMbFlkAefW+95sU3IhV1F4Q76k6JHfNRTKpXct3Mi XBtGCbnBDSU2Eg+KiOdnLgoGLbgkrQQ= X-MC-Unique: QLw_F_wtPs630agNIFNivg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 10/14] iotests: use qemu_img() in has_working_luks() Date: Tue, 8 Mar 2022 22:54:03 -0500 Message-Id: <20220309035407.1848654-11-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798522998100001 Content-Type: text/plain; charset="utf-8" Admittedly a mostly lateral move, but qemu_img() is essentially the replacement for qemu_img_pipe_and_status(). It will give slightly better diagnostics on crash. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/iotests.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 698d5a7fdc..1b6e28ba64 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1450,20 +1450,20 @@ def has_working_luks() -> Tuple[bool, str]: """ =20 img_file =3D f'{test_dir}/luks-test.luks' - (output, status) =3D \ - qemu_img_pipe_and_status('create', '-f', 'luks', - '--object', luks_default_secret_object, - '-o', luks_default_key_secret_opt, - '-o', 'iter-time=3D10', - img_file, '1G') + res =3D qemu_img('create', '-f', 'luks', + '--object', luks_default_secret_object, + '-o', luks_default_key_secret_opt, + '-o', 'iter-time=3D10', + img_file, '1G', + check=3DFalse) try: os.remove(img_file) except OSError: pass =20 - if status !=3D 0: - reason =3D output - for line in output.splitlines(): + if res.returncode: + reason =3D res.stdout + for line in res.stdout.splitlines(): if img_file + ':' in line: reason =3D line.split(img_file + ':', 1)[1].strip() break --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798618771864.9009067419623; Tue, 8 Mar 2022 20:03:38 -0800 (PST) Received: from localhost ([::1]:45784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnY1-0004vP-Lf for importer@patchew.org; Tue, 08 Mar 2022 23:03:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPJ-0002l8-KT for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPH-0002wP-KC for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-idZ2pZ-PMt60QOJ6_C2UVA-1; Tue, 08 Mar 2022 22:54:32 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CE501091DA2; Wed, 9 Mar 2022 03:54:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 560596C1A9; Wed, 9 Mar 2022 03:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xq+mb17o2YezEZhGwrSY5PGERKOMQxkBvcWa63NUlY8=; b=HY+RhclfgEEm0ijWT2tBAslXzNxDBE7ri2Dx93oH/LZ9wczOgpXcDRuqdgAVI5GG1k/f8u 0uRzmaxXigP0ubow0cZxU/7HfcrtC8TjcTcc+3xdzqqL8fNCNoHbbZTbDLnFCQtS4dZpzX uQLTZb1KY7h45cTa9tg0urvWEB5SKqs= X-MC-Unique: idZ2pZ-PMt60QOJ6_C2UVA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 11/14] iotests: replace qemu_img_log('create', ...) calls Date: Tue, 8 Mar 2022 22:54:04 -0500 Message-Id: <20220309035407.1848654-12-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798620727100001 Content-Type: text/plain; charset="utf-8" qemu_img_log() calls into qemu_img_pipe(), which always removes output for 'create' commands on success anyway. Replace all of these calls to the simpler qemu_img_create(...) which doesn't log, but raises a detailed exception object on failure instead. Blank lines are removed from output files where appropriate. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/255 | 8 ++++---- tests/qemu-iotests/255.out | 4 ---- tests/qemu-iotests/274 | 17 ++++++++--------- tests/qemu-iotests/274.out | 29 ----------------------------- tests/qemu-iotests/280 | 2 +- tests/qemu-iotests/280.out | 1 - 6 files changed, 13 insertions(+), 48 deletions(-) diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 index 3d6d0e80cb..f86fa851b6 100755 --- a/tests/qemu-iotests/255 +++ b/tests/qemu-iotests/255 @@ -42,8 +42,8 @@ with iotests.FilePath('t.qcow2') as disk_path, \ size_str =3D str(size) =20 iotests.create_image(base_path, size) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, mid_path, size_st= r) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, disk_path, size_s= tr) + iotests.qemu_img_create('-f', iotests.imgfmt, mid_path, size_str) + iotests.qemu_img_create('-f', iotests.imgfmt, disk_path, size_str) =20 # Create a backing chain like this: # base <- [throttled: bps-read=3D4096] <- mid <- overlay @@ -92,8 +92,8 @@ with iotests.FilePath('src.qcow2') as src_path, \ size =3D 128 * 1024 * 1024 size_str =3D str(size) =20 - iotests.qemu_img_log('create', '-f', iotests.imgfmt, src_path, size_st= r) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, dst_path, size_st= r) + iotests.qemu_img_create('-f', iotests.imgfmt, src_path, size_str) + iotests.qemu_img_create('-f', iotests.imgfmt, dst_path, size_str) =20 iotests.log(iotests.qemu_io('-f', iotests.imgfmt, '-c', 'write 0 1M', src_path), diff --git a/tests/qemu-iotests/255.out b/tests/qemu-iotests/255.out index 11a05a5213..2e837cbb5f 100644 --- a/tests/qemu-iotests/255.out +++ b/tests/qemu-iotests/255.out @@ -3,8 +3,6 @@ Finishing a commit job with background reads =20 =3D=3D=3D Create backing chain and start VM =3D=3D=3D =20 - - =3D=3D=3D Start background read requests =3D=3D=3D =20 =3D=3D=3D Run a commit job =3D=3D=3D @@ -21,8 +19,6 @@ Closing the VM while a job is being cancelled =20 =3D=3D=3D Create images and start VM =3D=3D=3D =20 - - wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 index 080a90f10f..2495e051a2 100755 --- a/tests/qemu-iotests/274 +++ b/tests/qemu-iotests/274 @@ -31,12 +31,11 @@ size_long =3D 2 * 1024 * 1024 size_diff =3D size_long - size_short =20 def create_chain() -> None: - iotests.qemu_img_log('create', '-f', iotests.imgfmt, base, - str(size_long)) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', base, - '-F', iotests.imgfmt, mid, str(size_short)) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', mid, - '-F', iotests.imgfmt, top, str(size_long)) + iotests.qemu_img_create('-f', iotests.imgfmt, base, str(size_long)) + iotests.qemu_img_create('-f', iotests.imgfmt, '-b', base, + '-F', iotests.imgfmt, mid, str(size_short)) + iotests.qemu_img_create('-f', iotests.imgfmt, '-b', mid, + '-F', iotests.imgfmt, top, str(size_long)) =20 iotests.qemu_io_log('-c', 'write -P 1 0 %d' % size_long, base) =20 @@ -160,9 +159,9 @@ with iotests.FilePath('base') as base, \ ('off', '512k', '256k', '500k', '436k')]: =20 iotests.log('=3D=3D=3D preallocation=3D%s =3D=3D=3D' % prealloc) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, base, base_si= ze) - iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', base, - '-F', iotests.imgfmt, top, top_size_old) + iotests.qemu_img_create('-f', iotests.imgfmt, base, base_size) + iotests.qemu_img_create('-f', iotests.imgfmt, '-b', base, + '-F', iotests.imgfmt, top, top_size_old) iotests.qemu_io_log('-c', 'write -P 1 %s 64k' % off, base) =20 # After this, top_size_old to base_size should be allocated/zeroed. diff --git a/tests/qemu-iotests/274.out b/tests/qemu-iotests/274.out index 1ce40d839a..acd8b166a6 100644 --- a/tests/qemu-iotests/274.out +++ b/tests/qemu-iotests/274.out @@ -1,7 +1,4 @@ =3D=3D Commit tests =3D=3D - - - wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -63,9 +60,6 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing HMP commit (top -> mid) =3D=3D=3D - - - wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -92,9 +86,6 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing QMP active commit (top -> mid) =3D=3D=3D - - - wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -127,9 +118,6 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing qemu-img commit (top -> base) =3D=3D=3D - - - wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -154,9 +142,6 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing QMP active commit (top -> base) =3D=3D=3D - - - wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -190,8 +175,6 @@ read 1048576/1048576 bytes at offset 1048576 =20 =3D=3D Resize tests =3D=3D =3D=3D=3D preallocation=3Doff =3D=3D=3D - - wrote 65536/65536 bytes at offset 5368709120 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -207,8 +190,6 @@ read 65536/65536 bytes at offset 5368709120 { "start": 1073741824, "length": 7516192768, "depth": 0, "present": true, = "zero": true, "data": false}] =20 =3D=3D=3D preallocation=3Dmetadata =3D=3D=3D - - wrote 65536/65536 bytes at offset 33285996544 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -229,8 +210,6 @@ read 65536/65536 bytes at offset 33285996544 { "start": 34896609280, "length": 536870912, "depth": 0, "present": true, = "zero": true, "data": false, "offset": 2685075456}] =20 =3D=3D=3D preallocation=3Dfalloc =3D=3D=3D - - wrote 65536/65536 bytes at offset 9437184 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -246,8 +225,6 @@ read 65536/65536 bytes at offset 9437184 { "start": 5242880, "length": 10485760, "depth": 0, "present": true, "zero= ": false, "data": true, "offset": 327680}] =20 =3D=3D=3D preallocation=3Dfull =3D=3D=3D - - wrote 65536/65536 bytes at offset 11534336 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -263,8 +240,6 @@ read 65536/65536 bytes at offset 11534336 { "start": 8388608, "length": 4194304, "depth": 0, "present": true, "zero"= : false, "data": true, "offset": 327680}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D - - wrote 65536/65536 bytes at offset 259072 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -281,8 +256,6 @@ read 65536/65536 bytes at offset 259072 { "start": 262144, "length": 262144, "depth": 0, "present": true, "zero": = true, "data": false}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D - - wrote 65536/65536 bytes at offset 344064 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -298,8 +271,6 @@ read 65536/65536 bytes at offset 344064 { "start": 262144, "length": 262144, "depth": 0, "present": true, "zero": = true, "data": false}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D - - wrote 65536/65536 bytes at offset 446464 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 index 628f3c33ca..5f50500fdb 100755 --- a/tests/qemu-iotests/280 +++ b/tests/qemu-iotests/280 @@ -33,7 +33,7 @@ with iotests.FilePath('base') as base_path , \ iotests.FilePath('top') as top_path, \ iotests.VM() as vm: =20 - iotests.qemu_img_log('create', '-f', iotests.imgfmt, base_path, '64M') + iotests.qemu_img_create('-f', iotests.imgfmt, base_path, '64M') =20 iotests.log('=3D=3D=3D Launch VM =3D=3D=3D') vm.add_object('iothread,id=3Diothread0') diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out index e39164c579..c75f437c00 100644 --- a/tests/qemu-iotests/280.out +++ b/tests/qemu-iotests/280.out @@ -1,4 +1,3 @@ - =3D=3D=3D Launch VM =3D=3D=3D Enabling migration QMP events on VM... {"return": {}} --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798640667986.7421054657084; Tue, 8 Mar 2022 20:04:00 -0800 (PST) Received: from localhost ([::1]:47300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnYN-0005vy-LJ for importer@patchew.org; Tue, 08 Mar 2022 23:03:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPK-0002mn-9p for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPI-0002wl-HR for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-f_v0Jl6UPoug6bPxmfNV0A-1; Tue, 08 Mar 2022 22:54:32 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DED8F1854E21; Wed, 9 Mar 2022 03:54:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 339D66C1A9; Wed, 9 Mar 2022 03:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RYhTiv8EGWprPlhggPHWjxdAzIcQTsasbcjM/7beeo8=; b=InofcGCWHFV3DShVcuEAZK4B5w5eBZjK577Eho7DmqlZYBwkMgDhs4c9xUWgo9pVrJxsAs LojoIRKfVH1d4rh+qDLLPDZfa0sw3QikLoND+aoXYNVeq0p4zoeWbn6wRNsDBspQG+bKHT I0bkc50FaFVAjjYPzkKZ02OHMtbzCZw= X-MC-Unique: f_v0Jl6UPoug6bPxmfNV0A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 12/14] iotests: remove qemu_img_pipe_and_status() Date: Tue, 8 Mar 2022 22:54:05 -0500 Message-Id: <20220309035407.1848654-13-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798642607100003 Content-Type: text/plain; charset="utf-8" With the exceptional 'create' calls removed in the prior commit, change qemu_img_log() and img_info_log() to call qemu_img() directly instead. In keeping with the spirit of diff-based tests, allow these calls to qemu_img() to return an unchecked non-zero status code -- because any error we'd see from the output is going into the log anyway. Every last call to qemu-img is now either checked for a return code of zero or has its output logged. It should be very hard to accidentally ignore the return code *or* output from qemu-img now; intentional malice remains unhandled. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com --- tests/qemu-iotests/iotests.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1b6e28ba64..f8d966cd73 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -207,15 +207,6 @@ def qemu_img_create_prepare_args(args: List[str]) -> L= ist[str]: =20 return result =20 -def qemu_img_pipe_and_status(*args: str) -> Tuple[str, int]: - """ - Run qemu-img and return both its output and its exit code - """ - is_create =3D bool(args and args[0] =3D=3D 'create') - full_args =3D qemu_img_args + qemu_img_create_prepare_args(list(args)) - return qemu_tool_pipe_and_status('qemu-img', full_args, - drop_successful_output=3Dis_create) - def qemu_img(*args: str, check: bool =3D True, combine_stdio: bool =3D True ) -> subprocess.CompletedProcess[str]: """ @@ -326,17 +317,14 @@ def qemu_img_info(*args: str) -> Any: def qemu_img_map(*args: str) -> Any: return qemu_img_json('map', "--output", "json", *args) =20 -def qemu_img_pipe(*args: str) -> str: - '''Run qemu-img and return its output''' - return qemu_img_pipe_and_status(*args)[0] - -def qemu_img_log(*args): - result =3D qemu_img_pipe(*args) - log(result, filters=3D[filter_testfiles]) +def qemu_img_log(*args: str) -> subprocess.CompletedProcess[str]: + result =3D qemu_img(*args, check=3DFalse) + log(result.stdout, filters=3D[filter_testfiles]) return result =20 -def img_info_log(filename, filter_path=3DNone, use_image_opts=3DFalse, - extra_args=3D()): +def img_info_log(filename: str, filter_path: Optional[str] =3D None, + use_image_opts: bool =3D False, extra_args: Sequence[str]= =3D (), + ) -> None: args =3D ['info'] if use_image_opts: args.append('--image-opts') @@ -345,7 +333,7 @@ def img_info_log(filename, filter_path=3DNone, use_imag= e_opts=3DFalse, args +=3D extra_args args.append(filename) =20 - output =3D qemu_img_pipe(*args) + output =3D qemu_img(*args, check=3DFalse).stdout if not filter_path: filter_path =3D filename log(filter_img_info(output, filter_path)) --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164679878463392.04637534778522; Tue, 8 Mar 2022 20:06:24 -0800 (PST) Received: from localhost ([::1]:51304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnah-0000HM-Ev for importer@patchew.org; Tue, 08 Mar 2022 23:06:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPT-0003La-7P for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPR-0002xz-Or for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-uQMGpBs9MfamMS9jWkfxOg-1; Tue, 08 Mar 2022 22:54:42 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 221991006AA5; Wed, 9 Mar 2022 03:54:41 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1194F6C180; Wed, 9 Mar 2022 03:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w0Gq0KP7awtLm+nP716sAWgOBDi7BO9wUdiEzI8cpTQ=; b=dfg+CquSsQLX9S3WdWvx5COL3fw73pxAoWC3OMSqaEOSYkdMCbsb+6aYjUFcSuCX/B8zZR TUkYnLcaeL2CFXfpxgNboYwWqv9ByGI81eOrob/lS5GaToVJRdGHSTGXZN0XoD9wSQV6RY yLLw3mX65Nobp+CnRRrmz17fHEaaixE= X-MC-Unique: uQMGpBs9MfamMS9jWkfxOg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 13/14] iotests: make qemu_img_log() check log level Date: Tue, 8 Mar 2022 22:54:06 -0500 Message-Id: <20220309035407.1848654-14-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798784895100001 Content-Type: text/plain; charset="utf-8" Improve qemu_img_log() to actually check if logging is turned on. If it isn't, revert to the behavior of qemu_img(). This is done so that there really is no way to avoid scrutinizing qemu-ing subprocess calls by accident. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com Reviewed-by: Hanna Reitz --- tests/qemu-iotests/iotests.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f8d966cd73..6af503058f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -318,7 +318,19 @@ def qemu_img_map(*args: str) -> Any: return qemu_img_json('map', "--output", "json", *args) =20 def qemu_img_log(*args: str) -> subprocess.CompletedProcess[str]: - result =3D qemu_img(*args, check=3DFalse) + """ + Logged, unchecked variant of qemu_img() that allows non-zero exit code= s. + + If logging is perceived to be disabled, this function will fall back + to prohibiting non-zero return codes. + + :raise VerboseProcessError: + When the return code is negative, or when logging is disabled + on any non-zero return code. + + :return: a CompletedProcess instance with returncode and console outpu= t. + """ + result =3D qemu_img(*args, check=3Dnot logging_enabled()) log(result.stdout, filters=3D[filter_testfiles]) return result =20 @@ -1640,6 +1652,11 @@ def activate_logging(): test_logger.setLevel(logging.INFO) test_logger.propagate =3D False =20 +def logging_enabled() -> bool: + """Return True if iotest logging is active.""" + return (test_logger.hasHandlers() + and test_logger.getEffectiveLevel() >=3D logging.INFO) + # This is called from script-style iotests without a single point of entry def script_initialize(*args, **kwargs): """Initialize script-style tests without running any tests.""" --=20 2.34.1 From nobody Sat May 18 20:37:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646798630872897.7962148758248; Tue, 8 Mar 2022 20:03:50 -0800 (PST) Received: from localhost ([::1]:46698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRnYE-0005Xs-OP for importer@patchew.org; Tue, 08 Mar 2022 23:03:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPS-0003GZ-AN for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRnPQ-0002xv-P1 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 22:54:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-575-IersrFBrNK6pKXKEHh6l5w-1; Tue, 08 Mar 2022 22:54:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 036B71854E26; Wed, 9 Mar 2022 03:54:42 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.34.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48F306C180; Wed, 9 Mar 2022 03:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646798084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ry1ENCgZDPUVVTcMkZ3v+26XUHnErnWXaNZgkRXd0Pk=; b=W9yew4ZUfbJLq7wNvN3GuG/HOi1nkDeM/g8rnVTTexdonloxMftPn1hBMaAn8OEOsCezN8 bVbQH1GoVj3hToLlJ4PEW5CQUd2cpL7igkX0ybDnE1jJFc1NoMLI3JKd7YGnhX1YNYf2S/ okWKtZk7zFEMHiveXzpfQhBUMnhK2bo= X-MC-Unique: IersrFBrNK6pKXKEHh6l5w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 14/14] iotests: make img_info_log() call qemu_img_log() Date: Tue, 8 Mar 2022 22:54:07 -0500 Message-Id: <20220309035407.1848654-15-jsnow@redhat.com> In-Reply-To: <20220309035407.1848654-1-jsnow@redhat.com> References: <20220309035407.1848654-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Hanna Reitz , Eric Blake , 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-ZM-MESSAGEID: 1646798638589100001 Content-Type: text/plain; charset="utf-8" Add configurable filters to qemu_img_log(), and re-write img_info_log() to call into qemu_img_log() with a custom filter instead. After this patch, every last call to qemu_img() is now guaranteed to either have its return code checked for zero, OR have its output actually visibly logged somewhere. Signed-off-by: John Snow Based-On: 20220308015728.1269649-1-jsnow@redhat.com --- tests/qemu-iotests/iotests.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6af503058f..0c69327c00 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -317,10 +317,14 @@ def qemu_img_info(*args: str) -> Any: def qemu_img_map(*args: str) -> Any: return qemu_img_json('map', "--output", "json", *args) =20 -def qemu_img_log(*args: str) -> subprocess.CompletedProcess[str]: +def qemu_img_log( + *args: str, + filters: Iterable[Callable[[str], str]] =3D (), +) -> subprocess.CompletedProcess[str]: """ Logged, unchecked variant of qemu_img() that allows non-zero exit code= s. =20 + By default, output will be filtered through filter_testfiles(). If logging is perceived to be disabled, this function will fall back to prohibiting non-zero return codes. =20 @@ -331,7 +335,7 @@ def qemu_img_log(*args: str) -> subprocess.CompletedPro= cess[str]: :return: a CompletedProcess instance with returncode and console outpu= t. """ result =3D qemu_img(*args, check=3Dnot logging_enabled()) - log(result.stdout, filters=3D[filter_testfiles]) + log(result.stdout, filters=3Dfilters or [filter_testfiles]) return result =20 def img_info_log(filename: str, filter_path: Optional[str] =3D None, @@ -345,10 +349,11 @@ def img_info_log(filename: str, filter_path: Optional= [str] =3D None, args +=3D extra_args args.append(filename) =20 - output =3D qemu_img(*args, check=3DFalse).stdout if not filter_path: filter_path =3D filename - log(filter_img_info(output, filter_path)) + qemu_img_log( + *args, + filters=3D[lambda output: filter_img_info(output, filter_path)]) =20 def qemu_io_wrap_args(args: Sequence[str]) -> List[str]: if '-f' in args or '--image-opts' in args: --=20 2.34.1