From nobody Sun Jul 13 21:10:04 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621497591; cv=none; d=zohomail.com; s=zohoarc; b=BNwCNtHLGqy/t4f8fHZ6XutLPB3Au8SaqfQVzgsRxqq4IBo7iO3K+ZjIoUjI1fzKg8+bEelcgTgSdoIamb807v4CzcBNHUF4wdVts3RDhMcf2pAUhUTmpv9o8lab/tDqY5Q263laUYR4+pkHt2yFcEKg81mUX6pWE4gX1AY4Db4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621497591; 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=TCP7F+eP023nKfejrg+KZvYtdvpma2dSNHK5/lE9Bjw=; b=TJyocekR5dCVKSvra1f7600icKXvRVd4Y/ghs6zFOB6OhLKVk+blzyHsIBPavbf34e/+VNlrYoMIqf59bgqic/CtBsF66ybpUvBskxA9d81Q1dH6x/HlfRMPzSaLK3TvnJL56cG4ZmDaqSUjsnkMuH3sadVkcwmA5ZYrXCzzyVg= 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+importer2=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 1621497591853405.2410110754256; Thu, 20 May 2021 00:59:51 -0700 (PDT) Received: from localhost ([::1]:53972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljdaw-0005Dl-OJ for importer2@patchew.org; Thu, 20 May 2021 03:59:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdVb-000478-1k for qemu-devel@nongnu.org; Thu, 20 May 2021 03:54:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljdVQ-0006bH-Jj for qemu-devel@nongnu.org; Thu, 20 May 2021 03:54:18 -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-338-0MwvWT2vNwGOKScGRtsOIg-1; Thu, 20 May 2021 03:54:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4078D107AD39; Thu, 20 May 2021 07:53:55 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-52.ams2.redhat.com [10.36.113.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1A076E6FF; Thu, 20 May 2021 07:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621497246; 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=TCP7F+eP023nKfejrg+KZvYtdvpma2dSNHK5/lE9Bjw=; b=TxaBYIt3OyVO6A3HmYpOigSpzcuwBX9DiC6o6zco7XFN0x9Kpv0wdn3M0+i5oQCkEK6P2O QaE60fJEwNln1qYm46Ghe46i9ccRBiREnG5+pC51jcah8hdQ6hWuNZ6ltmhQ4yl0fDlr+A iLwi0wmy4UquGpeYUxa2t6hmhI0H9Bg= X-MC-Unique: 0MwvWT2vNwGOKScGRtsOIg-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH v4 14/15] qemu-iotests: add option to show qemu binary logs on stdout Date: Thu, 20 May 2021 09:52:35 +0200 Message-Id: <20210520075236.44723-15-eesposit@redhat.com> In-Reply-To: <20210520075236.44723-1-eesposit@redhat.com> References: <20210520075236.44723-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eesposit@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.39, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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 , Emanuele Giuseppe Esposito , Eduardo Habkost , qemu-devel@nongnu.org, Max Reitz , Cleber Rosa , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Using the flag -p, allow the qemu binary to print to stdout. Reviewed-by: Max Reitz Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 4 +++- tests/qemu-iotests/iotests.py | 9 +++++++++ tests/qemu-iotests/testenv.py | 9 +++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 2101cedfe3..51b90681ab 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -33,6 +33,8 @@ def make_argparser() -> argparse.ArgumentParser: help=3D'pretty print output for make check') =20 p.add_argument('-d', dest=3D'debug', action=3D'store_true', help=3D'de= bug') + p.add_argument('-p', dest=3D'print', action=3D'store_true', + help=3D'redirects qemu\'s stdout and stderr to the test ou= tput') p.add_argument('-gdb', action=3D'store_true', help=3D"start gdbserver with $GDB_OPTIONS options \ ('localhost:12345' if $GDB_OPTIONS is empty)") @@ -117,7 +119,7 @@ if __name__ =3D=3D '__main__': aiomode=3Dargs.aiomode, cachemode=3Dargs.cachemode, imgopts=3Dargs.imgopts, misalign=3Dargs.misalign, debug=3Dargs.debug, valgrind=3Dargs.valgrind, - gdb=3Dargs.gdb) + gdb=3Dargs.gdb, qprint=3Dargs.print) =20 testfinder =3D TestFinder(test_dir=3Denv.source_iotests) =20 diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 75f1e1711c..53a3916a91 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -80,6 +80,8 @@ if gdb_qemu_env: qemu_gdb =3D ['gdbserver'] + gdb_qemu_env.strip().split(' ') =20 +qemu_print =3D os.environ.get('PRINT_QEMU', False) + imgfmt =3D os.environ.get('IMGFMT', 'raw') imgproto =3D os.environ.get('IMGPROTO', 'file') output_dir =3D os.environ.get('OUTPUT_DIR', '.') @@ -614,6 +616,13 @@ def _post_shutdown(self) -> None: super()._post_shutdown() self.subprocess_check_valgrind(qemu_valgrind) =20 + def _pre_launch(self) -> None: + super()._pre_launch() + if qemu_print and self._qemu_log_file is not None: + # set QEMU binary output to stdout + self._qemu_log_file.close() + self._qemu_log_file =3D None + def add_object(self, opts): self._args.append('-object') self._args.append(opts) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 319d29cb0c..b79ce22fe9 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -74,7 +74,7 @@ class TestEnv(ContextManager['TestEnv']): 'AIOMODE', 'CACHEMODE', 'VALGRIND_QEMU', 'CACHEMODE_IS_DEFAULT', 'IMGFMT_GENERIC', 'IMGOPTSSYN= TAX', 'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTU= RB_', - 'GDB_OPTIONS'] + 'GDB_OPTIONS', 'PRINT_QEMU'] =20 def get_env(self) -> Dict[str, str]: env =3D {} @@ -166,7 +166,8 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode:= str, misalign: bool =3D False, debug: bool =3D False, valgrind: bool =3D False, - gdb: bool =3D False) -> None: + gdb: bool =3D False, + qprint: bool =3D False) -> None: self.imgfmt =3D imgfmt self.imgproto =3D imgproto self.aiomode =3D aiomode @@ -174,6 +175,9 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode:= str, self.misalign =3D misalign self.debug =3D debug =20 + if qprint: + self.print_qemu =3D 'y' + if gdb: self.gdb_options =3D os.environ.get('GDB_OPTIONS', DEF_GDB_OPT= IONS) if not self.gdb_options: @@ -283,6 +287,7 @@ def print_env(self) -> None: SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} GDB_OPTIONS -- {GDB_OPTIONS} VALGRIND_QEMU -- {VALGRIND_QEMU} +PRINT_QEMU_OUTPUT -- {PRINT_QEMU} """ =20 args =3D collections.defaultdict(str, self.get_env()) --=20 2.30.2