From nobody Tue Dec 16 07:06:05 2025 Delivered-To: importer@patchew.org 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1585092313; cv=none; d=zohomail.com; s=zohoarc; b=hUt41P30AfqMJaT5XE+sJ3yMz0f/g5Z+Pl4vMU3+tFDeoG9K7xReNSsGpV+diMIz2TLaslLZ1U7QckjOvuInrkI4uXp0bduXr+OBXBXAuN9/ZybkwHQSj18YasGo9k2vB/85GJSgRn4gxMST18ivYoTQTtIM7JpHe0pOUgiAGNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585092313; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W0YjqPNVav5l4BTZupSoEKVM5UlhLCtLwyLDUL165Ng=; b=I10rV7VuB4fkjNZzpLDexS1Ur5W7un7/wqwa9IQVKXsdCtotayXRDyWc++sm0poCvcUAAOn84R1p6tDq8M8i30Fn4Cimvk5DxhmxZnmC58PKpLWRWbiJqpc/sQoh4rJPtY541MrQ/LuEbyfRjsIB3p6EWHY1RvN13vglMcP2Vp8= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585092313536463.3298989482121; Tue, 24 Mar 2020 16:25:13 -0700 (PDT) Received: from localhost ([::1]:56632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGsv2-0005XG-7t for importer@patchew.org; Tue, 24 Mar 2020 19:25:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51562) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGssH-00082I-4N for qemu-devel@nongnu.org; Tue, 24 Mar 2020 19:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGssF-00022X-US for qemu-devel@nongnu.org; Tue, 24 Mar 2020 19:22:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:53565) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGssF-000228-Q0 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 19:22:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-tSwNDBN3PaeTIWY4xuF2cw-1; Tue, 24 Mar 2020 19:22:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 734AD18FE882; Tue, 24 Mar 2020 23:21:58 +0000 (UTC) Received: from probe.redhat.com (ovpn-112-191.rdu2.redhat.com [10.10.112.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id A19FF5D9C5; Tue, 24 Mar 2020 23:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585092139; 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=W0YjqPNVav5l4BTZupSoEKVM5UlhLCtLwyLDUL165Ng=; b=CUFm8R5DzJhjXyUh8UUQxZx26inHCZaooauREBK+BqosSHI1fURR2NxNgjdkAzFlucxUWD 7kVElXNNvuGSciCEplVLwBaaXtRHTF3zDOgZiy6qBijsL2ySFniZuFr6ueEQtVIROx3Kh4 ju7OsfIQt2CtMp6oPdqq6hJowIWdH+Q= X-MC-Unique: tSwNDBN3PaeTIWY4xuF2cw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v9 10/14] iotests: add hmp helper with logging Date: Tue, 24 Mar 2020 19:20:59 -0400 Message-Id: <20200324232103.4195-11-jsnow@redhat.com> In-Reply-To: <20200324232103.4195-1-jsnow@redhat.com> References: <20200324232103.4195-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , ehabkost@redhat.com, qemu-block@nongnu.org, philmd@redhat.com, armbru@redhat.com, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Just a mild cleanup while I was here. Although we now have universal qmp logging on or off, many existing callers to hmp functions don't expect that output to be logged, which causes quite a few changes in the test output. For now, just offer a use_log parameter. Signed-off-by: John Snow Reviewed-by: Max Reitz --- tests/qemu-iotests/iotests.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e12d6e533e..4faee06f14 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -540,25 +540,29 @@ def add_incoming(self, addr): self._args.append(addr) return self =20 - def pause_drive(self, drive, event=3DNone): - '''Pause drive r/w operations''' + def hmp(self, command_line: str, use_log: bool =3D False): + cmd =3D 'human-monitor-command' + kwargs =3D {'command-line': command_line} + if use_log: + return self.qmp_log(cmd, **kwargs) + else: + return self.qmp(cmd, **kwargs) + + def pause_drive(self, drive: str, event: Optional[str] =3D None) -> No= ne: + """Pause drive r/w operations""" if not event: self.pause_drive(drive, "read_aio") self.pause_drive(drive, "write_aio") return - self.qmp('human-monitor-command', - command_line=3D'qemu-io %s "break %s bp_%s"' - % (drive, event, drive)) + self.hmp(f'qemu-io {drive} "break {event} bp_{drive}"') =20 - def resume_drive(self, drive): - self.qmp('human-monitor-command', - command_line=3D'qemu-io %s "remove_break bp_%s"' - % (drive, drive)) + def resume_drive(self, drive: str) -> None: + """Resume drive r/w operations""" + self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"') =20 - def hmp_qemu_io(self, drive, cmd): - '''Write to a given drive using an HMP command''' - return self.qmp('human-monitor-command', - command_line=3D'qemu-io %s "%s"' % (drive, cmd)) + def hmp_qemu_io(self, drive: str, cmd: str, use_log: bool =3D False) -= > None: + """Write to a given drive using an HMP command""" + return self.hmp(f'qemu-io {drive} "{cmd}"', use_log=3Duse_log) =20 def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): if output is None: --=20 2.21.1