From patchwork Wed Apr 7 13:50:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463352 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DcbW+XZQ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmD56zmhz9sPf for ; Wed, 7 Apr 2021 23:57:09 +1000 (AEST) Received: from localhost ([::1]:42772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8g8-0002LK-13 for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:57:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zw-0003uL-QB for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zq-0005te-Lm for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803436; 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=kBydi4G2HMTWGs+miE3qhbLvy6VWo1EygufKXdW6AGY=; b=DcbW+XZQG0m4Q+YnPXyfNbfW0N+mO7iM0zQ0ZSVtCSdNulWgrqipASB/2FS9edZRkVYKKQ Cif6c5+vH6vs7xDHYwAn2MwO1RkpBIKEBFwhlllx82Ls4BO3X2H1Pr98m8x/UWD1o0+jgL Gwesc+Uu3A3neciNUPvD9IlQrQaC3wE= 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-417-FHlgrd-SPpS7H4wOhMCu7w-1; Wed, 07 Apr 2021 09:50:35 -0400 X-MC-Unique: FHlgrd-SPpS7H4wOhMCu7w-1 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 49F04802B5B; Wed, 7 Apr 2021 13:50:34 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9ACA21964B; Wed, 7 Apr 2021 13:50:27 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 01/11] python: qemu: add timer parameter for qmp.accept socket Date: Wed, 7 Apr 2021 15:50:11 +0200 Message-Id: <20210407135021.48330-2-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Extend the _post_launch function to include the timer as parameter instead of defaulting to 15 sec. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 4 ++-- python/qemu/qtest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 6e44bda337..c721e07d63 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -321,9 +321,9 @@ def _pre_launch(self) -> None: nickname=self._name ) - def _post_launch(self) -> None: + def _post_launch(self, timer) -> None: if self._qmp_connection: - self._qmp.accept() + self._qmp.accept(timer) def _post_shutdown(self) -> None: """ diff --git a/python/qemu/qtest.py b/python/qemu/qtest.py index 39a0cf62fe..0d01715086 100644 --- a/python/qemu/qtest.py +++ b/python/qemu/qtest.py @@ -138,9 +138,9 @@ def _pre_launch(self) -> None: super()._pre_launch() self._qtest = QEMUQtestProtocol(self._qtest_path, server=True) - def _post_launch(self) -> None: + def _post_launch(self, timer) -> None: assert self._qtest is not None - super()._post_launch() + super()._post_launch(timer) self._qtest.accept() def _post_shutdown(self) -> None: From patchwork Wed Apr 7 13:50:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SYfhLOKG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFm6P2LQWz9sWS for ; Wed, 7 Apr 2021 23:52:13 +1000 (AEST) Received: from localhost ([::1]:56150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8bL-0004ab-Ca for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zy-0003xD-9w for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zv-0005ur-K1 for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803439; 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=rZb60AHYAxc2t644nFRKZffZboFDS8lZKfZBIUYO0sA=; b=SYfhLOKGyQtmgiyQY+CG8NqGAIlR2FMUsjbj+S6Davmt7tm2UZtAw9/zrVLH4om4lJvgAb ey50b174BxWlUJTW1Av+w6d80V0XlJA6uQRedCUmTV/38WZ6awNILgHhobIo+YeyEKbO3q 9e8o/0bEU7AtIDz9iXYt3UMSRgAxuoI= 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-256-2E8Yv19uOOy1etJCwH9IjA-1; Wed, 07 Apr 2021 09:50:38 -0400 X-MC-Unique: 2E8Yv19uOOy1etJCwH9IjA-1 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 4AC93100806B; Wed, 7 Apr 2021 13:50:37 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id A96981964B; Wed, 7 Apr 2021 13:50:34 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 02/11] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine Date: Wed, 7 Apr 2021 15:50:12 +0200 Message-Id: <20210407135021.48330-3-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 2 +- python/qemu/qtest.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index c721e07d63..18d32ebe45 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -109,7 +109,7 @@ def __init__(self, self._binary = binary self._args = list(args) - self._wrapper = wrapper + self._wrapper = list(wrapper) self._name = name or "qemu-%d" % os.getpid() self._test_dir = test_dir diff --git a/python/qemu/qtest.py b/python/qemu/qtest.py index 0d01715086..4c90daf430 100644 --- a/python/qemu/qtest.py +++ b/python/qemu/qtest.py @@ -111,6 +111,7 @@ class QEMUQtestMachine(QEMUMachine): def __init__(self, binary: str, args: Sequence[str] = (), + wrapper: Sequence[str] = (), name: Optional[str] = None, test_dir: str = "/var/tmp", socket_scm_helper: Optional[str] = None, @@ -119,7 +120,8 @@ def __init__(self, name = "qemu-%d" % os.getpid() if sock_dir is None: sock_dir = test_dir - super().__init__(binary, args, name=name, test_dir=test_dir, + super().__init__(binary, args, wrapper=wrapper, name=name, + test_dir=test_dir, socket_scm_helper=socket_scm_helper, sock_dir=sock_dir) self._qtest: Optional[QEMUQtestProtocol] = None From patchwork Wed Apr 7 13:50:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Y7xpp8vk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmLk2KYTz9sPf for ; Thu, 8 Apr 2021 00:02:53 +1000 (AEST) Received: from localhost ([::1]:57796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8lf-0000Km-PF for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 10:02:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8a0-00041q-0H for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zw-0005vC-LQ for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803443; 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=5S5DhzLgPGbm54SWrZqD1VlfyYf6LCjxyu1q4hHByYg=; b=Y7xpp8vk+tr9CDAFNgHMdDu8UkBaq3mcBQRvWeFGCoQrS9EblXde9NOaBZpUvyTtSe9m7e LxALot1vqEFKOgDUqw/MNTabm4hX4riJJ1sP/3BYR2IkAzccBSX7LqtZfrRpF8rPJye9IF mROve0kThY/qYn+zrgt2LMZO4KHCVxs= 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-586-X5Uw1FkiNOaf9W3trLe09w-1; Wed, 07 Apr 2021 09:50:40 -0400 X-MC-Unique: X5Uw1FkiNOaf9W3trLe09w-1 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 16E6E802B5B; Wed, 7 Apr 2021 13:50:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id B87BE59464; Wed, 7 Apr 2021 13:50:37 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 03/11] qemu-iotests: add option to attach gdbserver Date: Wed, 7 Apr 2021 15:50:13 +0200 Message-Id: <20210407135021.48330-4-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=63.128.21.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add -gdb flag and GDB_QEMU environmental variable to python tests to attach a gdbserver to each qemu instance. if -gdb is not provided but $GDB_QEMU is set, ignore the environmental variable. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/check | 6 +++++- tests/qemu-iotests/iotests.py | 4 ++++ tests/qemu-iotests/testenv.py | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index d1c87ceaf1..6186495eee 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -33,6 +33,9 @@ def make_argparser() -> argparse.ArgumentParser: help='pretty print output for make check') p.add_argument('-d', dest='debug', action='store_true', help='debug') + p.add_argument('-gdb', action='store_true', + help="start gdbserver with $GDB_QEMU options. \ + Default is localhost:12345") p.add_argument('-misalign', action='store_true', help='misalign memory allocations') p.add_argument('--color', choices=['on', 'off', 'auto'], @@ -112,7 +115,8 @@ if __name__ == '__main__': env = TestEnv(imgfmt=args.imgfmt, imgproto=args.imgproto, aiomode=args.aiomode, cachemode=args.cachemode, imgopts=args.imgopts, misalign=args.misalign, - debug=args.debug, valgrind=args.valgrind) + debug=args.debug, valgrind=args.valgrind, + gdb=args.gdb) testfinder = TestFinder(test_dir=env.source_iotests) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 90d0b62523..05d0dc0751 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -75,6 +75,10 @@ qemu_prog = os.environ.get('QEMU_PROG', 'qemu') qemu_opts = os.environ.get('QEMU_OPTIONS', '').strip().split(' ') +qemu_gdb = [] +if os.environ.get('GDB_QEMU'): + qemu_gdb = ['gdbserver'] + os.environ.get('GDB_QEMU').strip().split(' ') + imgfmt = os.environ.get('IMGFMT', 'raw') imgproto = os.environ.get('IMGPROTO', 'file') output_dir = os.environ.get('OUTPUT_DIR', '.') diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 1fbec854c1..669eb6b925 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -72,7 +72,8 @@ class TestEnv(ContextManager['TestEnv']): 'QEMU_NBD_OPTIONS', 'IMGOPTS', 'IMGFMT', 'IMGPROTO', 'AIOMODE', 'CACHEMODE', 'VALGRIND_QEMU', 'CACHEMODE_IS_DEFAULT', 'IMGFMT_GENERIC', 'IMGOPTSSYNTAX', - 'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTURB_'] + 'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTURB_', + 'GDB_QEMU'] def get_env(self) -> Dict[str, str]: env = {} @@ -163,7 +164,8 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode: str, imgopts: Optional[str] = None, misalign: bool = False, debug: bool = False, - valgrind: bool = False) -> None: + valgrind: bool = False, + gdb: bool = False) -> None: self.imgfmt = imgfmt self.imgproto = imgproto self.aiomode = aiomode @@ -171,6 +173,14 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode: str, self.misalign = misalign self.debug = debug + self.gdb_qemu = os.getenv('GDB_QEMU') + + if gdb and not self.gdb_qemu: + self.gdb_qemu = 'localhost:12345' + elif self.gdb_qemu and not gdb: + del self.gdb_qemu + del os.environ['GDB_QEMU'] + if valgrind: self.valgrind_qemu = 'y' @@ -268,7 +278,9 @@ def print_env(self) -> None: PLATFORM -- {platform} TEST_DIR -- {TEST_DIR} SOCK_DIR -- {SOCK_DIR} -SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER}""" +SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} +GDB_QEMU -- "{GDB_QEMU}" +""" args = collections.defaultdict(str, self.get_env()) From patchwork Wed Apr 7 13:50:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aMBdnk9b; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFm6L5PsDz9sX1 for ; Wed, 7 Apr 2021 23:52:10 +1000 (AEST) Received: from localhost ([::1]:55778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8bI-0004QE-O6 for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:52:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8a0-00042U-7N for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8Zy-0005xM-3N for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803445; 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=2c9PWoZBwanCg4kf5DFuJ5LneYnpo2h+kLaMIS52jQ8=; b=aMBdnk9bzbvXMP0iFsZ8JbEmz6YCwC5l5Xx8ma3cnl7CKLKCtKkJWRrzOuBREf0kc66G/k 2apAkf5FhNrlUpr9MHMl9mchw3F4otdjHNpHGl760NXm61k2vXLmheVjjIrPEGXyoxlqi+ czPoBmEzVrYu0GCkdm8oNwFjPae5190= 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-399-3XCI6sjGN86o7kKuIR4OJA-1; Wed, 07 Apr 2021 09:50:43 -0400 X-MC-Unique: 3XCI6sjGN86o7kKuIR4OJA-1 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 B8EEC6D255; Wed, 7 Apr 2021 13:50:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72B5959443; Wed, 7 Apr 2021 13:50:40 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 04/11] qemu-iotests: delay QMP socket timers Date: Wed, 7 Apr 2021 15:50:14 +0200 Message-Id: <20210407135021.48330-5-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Attaching a gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 4 +++- tests/qemu-iotests/iotests.py | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 18d32ebe45..284b73385f 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -408,7 +408,9 @@ def _launch(self) -> None: stderr=subprocess.STDOUT, shell=False, close_fds=False) - self._post_launch() + + timer = None if 'gdbserver' in self._wrapper else 15.0 + self._post_launch(timer) def _early_cleanup(self) -> None: """ diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 05d0dc0751..17f07710db 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -686,7 +686,10 @@ def qmp_to_opts(self, obj): def get_qmp_events_filtered(self, wait=60.0): result = [] - for ev in self.get_qmp_events(wait=wait): + qmp_wait = wait + if qemu_gdb: + qmp_wait = 0.0 + for ev in self.get_qmp_events(wait=qmp_wait): result.append(filter_qmp_event(ev)) return result @@ -987,13 +990,17 @@ def cancel_and_wait(self, drive='drive0', force=False, result = self.vm.qmp('block-job-cancel', device=drive, force=force) self.assert_qmp(result, 'return', {}) + qmp_wait = wait + if qemu_gdb: + qmp_wait = 0.0 + if resume: self.vm.resume_drive(drive) cancelled = False result = None while not cancelled: - for event in self.vm.get_qmp_events(wait=wait): + for event in self.vm.get_qmp_events(wait=qmp_wait): if event['event'] == 'BLOCK_JOB_COMPLETED' or \ event['event'] == 'BLOCK_JOB_CANCELLED': self.assert_qmp(event, 'data/device', drive) @@ -1009,8 +1016,11 @@ def cancel_and_wait(self, drive='drive0', force=False, def wait_until_completed(self, drive='drive0', check_offset=True, wait=60.0, error=None): '''Wait for a block job to finish, returning the event''' + qmp_wait = wait + if qemu_gdb: + qmp_wait = 0.0 while True: - for event in self.vm.get_qmp_events(wait=wait): + for event in self.vm.get_qmp_events(wait=qmp_wait): if event['event'] == 'BLOCK_JOB_COMPLETED': self.assert_qmp(event, 'data/device', drive) if error is None: @@ -1054,7 +1064,10 @@ def complete_and_wait(self, drive='drive0', wait_ready=True, self.assertTrue(event['data']['type'] in ['mirror', 'commit']) def pause_wait(self, job_id='job0'): - with Timeout(3, "Timeout waiting for job to pause"): + def_timeout = 3 + if qemu_gdb: + def_timeout = 3000 + with Timeout(def_timeout, "Timeout waiting for job to pause"): while True: result = self.vm.qmp('query-block-jobs') found = False From patchwork Wed Apr 7 13:50:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E0tPYF5/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmQc6wJqz9sPf for ; Thu, 8 Apr 2021 00:06:16 +1000 (AEST) Received: from localhost ([::1]:35802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8ox-000319-1s for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 10:06:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8a2-00048P-Og for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8a1-0005yw-1R for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:50:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803448; 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=d5oa5e6sHp1WBNsO402wgqR6Z78G7dKLLzhnlUJ0IPY=; b=E0tPYF5/uS6UpjJ9aGhYWGlB2T2e8aFvZEcsDbNP4syaaQRmuUQZF/kljs23FfywW1db0c nAWv/quK1OFVuCwhwW5vJdH3yleRkkwOhNGZhVbbVdGNcKaODHXbRwpfkoyaZLZ3FlWPBg rjK+iWkjCqFKRZstwEfXRatr8dfJiF8= 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-442-H8VuaQwJNWaBpQOIkemnDg-1; Wed, 07 Apr 2021 09:50:46 -0400 X-MC-Unique: H8VuaQwJNWaBpQOIkemnDg-1 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 80AD81883530; Wed, 7 Apr 2021 13:50:45 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20DF319C81; Wed, 7 Apr 2021 13:50:42 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 05/11] qemu_iotests: insert gdbserver command line as wrapper for qemu binary Date: Wed, 7 Apr 2021 15:50:15 +0200 Message-Id: <20210407135021.48330-6-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 17f07710db..8f6bb20af5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -579,7 +579,8 @@ class VM(qtest.QEMUQtestMachine): def __init__(self, path_suffix=''): name = "qemu%s-%d" % (path_suffix, os.getpid()) - super().__init__(qemu_prog, qemu_opts, name=name, + super().__init__(qemu_prog, qemu_opts, wrapper=qemu_gdb, + name=name, test_dir=test_dir, socket_scm_helper=socket_scm_helper, sock_dir=sock_dir) From patchwork Wed Apr 7 13:50:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463350 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R5GattIn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFm9r6MTZz9sPf for ; Wed, 7 Apr 2021 23:55:12 +1000 (AEST) Received: from localhost ([::1]:37934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8eE-0000Mz-WB for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aC-0004F7-QJ for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8a3-000618-IC for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803450; 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=d62TMt5YDr4JQhQ2/G1Iwa/04QA/k+hmEugujLvxxvY=; b=R5GattIndcNbREr+zAltEqU3It8bDSKIVVLiRtP3f1I3mA21AigbgO1cn1xDUEpPxOi+Lt BD+vnZ4g1QaKCDecPqGL3COd8eMR3yDhRHoyTikim+LYCnWaFwcZhMCzf1q4UvhUB8wR+5 ayiFqP9qPClDCgRzTi71FpZgX3m5JK0= 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-491-oFHqha7nNTiG9kAvZr7imw-1; Wed, 07 Apr 2021 09:50:49 -0400 X-MC-Unique: oFHqha7nNTiG9kAvZr7imw-1 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 6695E107ACCA; Wed, 7 Apr 2021 13:50:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id F117019CB4; Wed, 7 Apr 2021 13:50:45 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 06/11] qemu-iotests: add gdbserver option to script tests too Date: Wed, 7 Apr 2021 15:50:16 +0200 Message-Id: <20210407135021.48330-7-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/common.rc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 65cdba5723..53a3310fee 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -166,8 +166,14 @@ _qemu_wrapper() if [ -n "${QEMU_NEED_PID}" ]; then echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" fi + + GDB="${QEMU_PROG}" + if [ ! -z ${GDB_QEMU} ]; then + GDB="gdbserver ${GDB_QEMU} ${GDB}" + fi + VALGRIND_QEMU="${VALGRIND_QEMU_VM}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ - "$QEMU_PROG" $QEMU_OPTIONS "$@" + $GDB $QEMU_OPTIONS "$@" ) RETVAL=$? _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL From patchwork Wed Apr 7 13:50:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463358 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ca2NeLQB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmS84Jjyz9sPf for ; Thu, 8 Apr 2021 00:07:35 +1000 (AEST) Received: from localhost ([::1]:39460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8qC-0004dH-LF for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 10:07:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aH-0004Id-1i for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aC-00062o-EI for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803453; 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=a9T7LOfjIs6cHUmga+kF7UG5mDoM0SUJOfRYb+rRwTU=; b=ca2NeLQBgS6iK2wG1D+m8dXO8/r+v2RVWgdlGjzcr/K2vAUxPtpVD89P2PuX9+zrFxiq4+ 6vbxmQZE/41kLSSXdYlAEmQC0MGroGGu8F9Hp6mjm8EzP4VqoFylHlK4Y9LUlHyXOzl7fv TYiEX9jJg/vOZFgmh8VNoCO3itX8X84= 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-585-pP0lf_bDOAWvVakS1fmF1w-1; Wed, 07 Apr 2021 09:50:52 -0400 X-MC-Unique: pP0lf_bDOAWvVakS1fmF1w-1 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 22F88107ACF3; Wed, 7 Apr 2021 13:50:51 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD3511964B; Wed, 7 Apr 2021 13:50:48 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 07/11] qemu_iotests: extend the check script to support valgrind for python tests Date: Wed, 7 Apr 2021 15:50:17 +0200 Message-Id: <20210407135021.48330-8-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently, the check script only parses the option and sets the VALGRIND_QEMU environmental variable to "y". Add another iotests python variable that prepares the command line, identical to the one provided in the test scripts. Because the python script does not know in advance the valgrind PID to assign to the log file name, use the "%p" flag in valgrind log file name that automatically puts the process PID at runtime. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 11 +++++++++++ tests/qemu-iotests/testenv.py | 1 + 2 files changed, 12 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 8f6bb20af5..7c28f0cb74 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -96,6 +96,17 @@ sys.stderr.write('Please run this test via the "check" script\n') sys.exit(os.EX_USAGE) +qemu_valgrind = [] +if os.environ.get('VALGRIND_QEMU') == "y" and \ + os.environ.get('NO_VALGRIND') != "y": + valgrind_logfile = "--log-file=" + test_dir.strip() + # %p allows to put the valgrind process PID, since + # we don't know it a priori (subprocess.Peopen is + # not yet invoked) + valgrind_logfile += "/%p.valgrind" + + qemu_valgrind = ['valgrind', valgrind_logfile, '--error-exitcode=99'] + socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper') luks_default_secret_object = 'secret,id=keysec0,data=' + \ diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 669eb6b925..86798bf752 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -280,6 +280,7 @@ def print_env(self) -> None: SOCK_DIR -- {SOCK_DIR} SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} GDB_QEMU -- "{GDB_QEMU}" +VALGRIND_QEMU -- "{VALGRIND_QEMU}" """ args = collections.defaultdict(str, self.get_env()) From patchwork Wed Apr 7 13:50:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hpzZCS40; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmKB2Wggz9sPf for ; Thu, 8 Apr 2021 00:01:34 +1000 (AEST) Received: from localhost ([::1]:54156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8kO-00078u-Cj for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 10:01:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aR-0004Jx-Cv for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aC-00063Z-FI for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803457; 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=HahSciXYiof22qQ/TBDonNH7Bk4OfSRFAavMNfm1WSE=; b=hpzZCS40OFEfz9T8SpJb+4BExsyiXIGjVUfxRvYrlEcIM6yRZ9S8oguU4jkpbH4O7yP1xR t7VAXmyOjrETguH3XP6aWPE+TAUBkHUUz0mH4OQTNhAYSjnbAEah1ROG7cLvpbAvmF3Fho fl1iUVTuV7aEiUtV1A0QTHnl92Lo0vI= 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-181-grAiltDrPTS4EzdpqS79eQ-1; Wed, 07 Apr 2021 09:50:54 -0400 X-MC-Unique: grAiltDrPTS4EzdpqS79eQ-1 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 D15051883520; Wed, 7 Apr 2021 13:50:53 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87DE059443; Wed, 7 Apr 2021 13:50:51 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 08/11] qemu_iotests: extent QMP socket timeout when using valgrind Date: Wed, 7 Apr 2021 15:50:18 +0200 Message-Id: <20210407135021.48330-9-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout expires too soon. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 4 +++- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 284b73385f..4b6eb39856 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -409,7 +409,9 @@ def _launch(self) -> None: shell=False, close_fds=False) - timer = None if 'gdbserver' in self._wrapper else 15.0 + delay_timer = 'gdbserver' in self._wrapper + delay_timer |= 'valgrind' in self._wrapper + timer = None if delay_timer else 15.0 self._post_launch(timer) def _early_cleanup(self) -> None: diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7c28f0cb74..56733954b2 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -699,7 +699,7 @@ def qmp_to_opts(self, obj): def get_qmp_events_filtered(self, wait=60.0): result = [] qmp_wait = wait - if qemu_gdb: + if qemu_gdb or qemu_valgrind: qmp_wait = 0.0 for ev in self.get_qmp_events(wait=qmp_wait): result.append(filter_qmp_event(ev)) @@ -1003,7 +1003,7 @@ def cancel_and_wait(self, drive='drive0', force=False, self.assert_qmp(result, 'return', {}) qmp_wait = wait - if qemu_gdb: + if qemu_gdb or qemu_valgrind: qmp_wait = 0.0 if resume: @@ -1029,7 +1029,7 @@ def wait_until_completed(self, drive='drive0', check_offset=True, wait=60.0, error=None): '''Wait for a block job to finish, returning the event''' qmp_wait = wait - if qemu_gdb: + if qemu_gdb or qemu_valgrind: qmp_wait = 0.0 while True: for event in self.vm.get_qmp_events(wait=qmp_wait): @@ -1077,7 +1077,7 @@ def complete_and_wait(self, drive='drive0', wait_ready=True, def pause_wait(self, job_id='job0'): def_timeout = 3 - if qemu_gdb: + if qemu_gdb or qemu_valgrind: def_timeout = 3000 with Timeout(def_timeout, "Timeout waiting for job to pause"): while True: From patchwork Wed Apr 7 13:50:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=U3/ehtZO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmVY535cz9sPf for ; Thu, 8 Apr 2021 00:09:41 +1000 (AEST) Received: from localhost ([::1]:42178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8sD-0005oV-BX for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 10:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aa-0004QU-Vh for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aC-000655-GA for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803459; 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=uxqLC6J1dFzu0Fdk8XGoctTfOUij5tQwR5NAj6F5ld0=; b=U3/ehtZOIqV4AdJqZ7HyoY7TlW9KRGPYER1YNqRh08VkaAP4910YorqxOn+TFs4FMvUKUL ws2TMNUYiCosaj9uBX5JtAazKyP2GHvmIGA74tG1YQE5gOWPuB5p9DzDCGie9qTjc/uQ6a EUMy5Vl0v3DpSCafF+xsb7YPuohpEOw= 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-36-VCK7H7fKO2aY3WKyoOyFcg-1; Wed, 07 Apr 2021 09:50:57 -0400 X-MC-Unique: VCK7H7fKO2aY3WKyoOyFcg-1 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 012E8801814; Wed, 7 Apr 2021 13:50:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34694690F1; Wed, 7 Apr 2021 13:50:54 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 09/11] qemu_iotests: allow valgrint to print/delete the generated log file Date: Wed, 7 Apr 2021 15:50:19 +0200 Message-Id: <20210407135021.48330-10-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When using valgrind on the test scripts, it generates a log file in $TEST_DIR that is either print (if valgrind finds problems) or otherwise deleted. Provide the same exact behavior when using -valgrind on the python tests. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 56733954b2..b6166b6f7b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -597,6 +597,26 @@ def __init__(self, path_suffix=''): sock_dir=sock_dir) self._num_drives = 0 + def subprocess_check_valgrind(self, valgrind) -> None: + + if not valgrind: + return + + valgrind_filename = test_dir + "/" + str(self._popen.pid) + ".valgrind" + + if self.exitcode() == 99: + with open(valgrind_filename) as f: + content = f.readlines() + for line in content: + print(line, end ="") + print("") + else: + os.remove(valgrind_filename) + + def _post_shutdown(self) -> None: + super()._post_shutdown() + self.subprocess_check_valgrind(qemu_valgrind) + def add_object(self, opts): self._args.append('-object') self._args.append(opts) From patchwork Wed Apr 7 13:50:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QrpdXeuQ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFmFP11hZz9sPf for ; Wed, 7 Apr 2021 23:58:17 +1000 (AEST) Received: from localhost ([::1]:46810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8hD-00045S-7A for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:58:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aR-0004Jw-Bw for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aL-00068W-G3 for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803464; 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=Dr/Edrw3t7ZX6Ov/GKXZk/NBJ/+rVL5wqc9yNJeU/HI=; b=QrpdXeuQvRLFKTWE05sgtuazSst99pivxDFML+NpqMjvug7aZrqCaphLCgJGLdnr+uatCP cXk1EapIEjBuA4rQya12LBuAMOukdWFBWuq1Bv48nWS/UezH4Hm/ELvPOrdTecahOZn4/U mPJzZ1MeuLjXfcFvz44NBgRHRbGxHrw= 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-169-V0iBgL0DP0OhAzUfV5KA2g-1; Wed, 07 Apr 2021 09:51:00 -0400 X-MC-Unique: V0iBgL0DP0OhAzUfV5KA2g-1 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 D33406D249; Wed, 7 Apr 2021 13:50:59 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C1AE19CB4; Wed, 7 Apr 2021 13:50:57 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 10/11] qemu_iotests: insert valgrind command line as wrapper for qemu binary Date: Wed, 7 Apr 2021 15:50:20 +0200 Message-Id: <20210407135021.48330-11-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The priority will be given to gdb command line, meaning if -gdb and -valgrind parameters are given, only gdb will be wrapped around the qemu binary. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index b6166b6f7b..b23bfdfdff 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -590,7 +590,8 @@ class VM(qtest.QEMUQtestMachine): def __init__(self, path_suffix=''): name = "qemu%s-%d" % (path_suffix, os.getpid()) - super().__init__(qemu_prog, qemu_opts, wrapper=qemu_gdb, + wrapper = qemu_gdb if qemu_gdb else qemu_valgrind + super().__init__(qemu_prog, qemu_opts, wrapper=wrapper, name=name, test_dir=test_dir, socket_scm_helper=socket_scm_helper, From patchwork Wed Apr 7 13:50:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 1463348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T2Q86ITF; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFm7v5pWLz9sSC for ; Wed, 7 Apr 2021 23:53:31 +1000 (AEST) Received: from localhost ([::1]:60056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8cb-0006D9-RU for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2021 09:53:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aa-0004QQ-Vb for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55350) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8aL-0006BO-HY for qemu-devel@nongnu.org; Wed, 07 Apr 2021 09:51:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617803468; 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=CFLD9XLnlHBVfcqnc6zU/UvOnyMs2jmm0RJGLWbvG68=; b=T2Q86ITFYOhNGQSAeddLgT1X4xJ1z1AbKzXhX34rBI4vL9BPzvBRJVWUfUuuUS8gMz27hd jUn80tg2D2xZNDIdfD24W0M63hYZkly+3yYfvu4VliB40DZ54nDpbkLTfdKpMm1VuKqqM0 FbOqjbJwctaMKTd2oiJhRSr2hS0PaYk= 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-545-f-Kzx1QCMPmB1M5awGgKYQ-1; Wed, 07 Apr 2021 09:51:06 -0400 X-MC-Unique: f-Kzx1QCMPmB1M5awGgKYQ-1 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 9D1CD107ACED; Wed, 7 Apr 2021 13:51:05 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-163.ams2.redhat.com [10.36.115.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EC6719CB4; Wed, 7 Apr 2021 13:51:00 +0000 (UTC) From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [RFC PATCH v2 11/11] qemu_iotests: add option to show qemu binary logs on stdout Date: Wed, 7 Apr 2021 15:50:21 +0200 Message-Id: <20210407135021.48330-12-eesposit@redhat.com> In-Reply-To: <20210407135021.48330-1-eesposit@redhat.com> References: <20210407135021.48330-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Using the flag -p, allow the qemu binary to print to stdout. This is helpful especially for print-debugging. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/check | 3 ++- tests/qemu-iotests/iotests.py | 9 +++++++++ tests/qemu-iotests/testenv.py | 9 +++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 6186495eee..6c469c14ff 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -33,6 +33,7 @@ def make_argparser() -> argparse.ArgumentParser: help='pretty print output for make check') p.add_argument('-d', dest='debug', action='store_true', help='debug') + p.add_argument('-p', dest='print', action='store_true', help='enable prints') p.add_argument('-gdb', action='store_true', help="start gdbserver with $GDB_QEMU options. \ Default is localhost:12345") @@ -116,7 +117,7 @@ if __name__ == '__main__': aiomode=args.aiomode, cachemode=args.cachemode, imgopts=args.imgopts, misalign=args.misalign, debug=args.debug, valgrind=args.valgrind, - gdb=args.gdb) + gdb=args.gdb, qprint=args.print) testfinder = TestFinder(test_dir=env.source_iotests) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index b23bfdfdff..bb29074b63 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -79,6 +79,8 @@ if os.environ.get('GDB_QEMU'): qemu_gdb = ['gdbserver'] + os.environ.get('GDB_QEMU').strip().split(' ') +qemu_print = os.environ.get('PRINT_QEMU', False) + imgfmt = os.environ.get('IMGFMT', 'raw') imgproto = os.environ.get('IMGPROTO', 'file') output_dir = os.environ.get('OUTPUT_DIR', '.') @@ -618,6 +620,13 @@ def _post_shutdown(self) -> None: super()._post_shutdown() self.subprocess_check_valgrind(qemu_valgrind) + def _pre_launch(self) -> None: + super()._pre_launch() + if qemu_print and self._qemu_log_file != None: + # set QEMU binary output to stdout + self._qemu_log_file.close() + self._qemu_log_file = 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 86798bf752..9192d7154b 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -73,7 +73,7 @@ class TestEnv(ContextManager['TestEnv']): 'AIOMODE', 'CACHEMODE', 'VALGRIND_QEMU', 'CACHEMODE_IS_DEFAULT', 'IMGFMT_GENERIC', 'IMGOPTSSYNTAX', 'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTURB_', - 'GDB_QEMU'] + 'GDB_QEMU', 'PRINT_QEMU'] def get_env(self) -> Dict[str, str]: env = {} @@ -165,7 +165,8 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode: str, misalign: bool = False, debug: bool = False, valgrind: bool = False, - gdb: bool = False) -> None: + gdb: bool = False, + qprint: bool = False) -> None: self.imgfmt = imgfmt self.imgproto = imgproto self.aiomode = aiomode @@ -173,6 +174,9 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode: str, self.misalign = misalign self.debug = debug + if qprint: + self.print_qemu = 'y' + self.gdb_qemu = os.getenv('GDB_QEMU') if gdb and not self.gdb_qemu: @@ -281,6 +285,7 @@ def print_env(self) -> None: SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} GDB_QEMU -- "{GDB_QEMU}" VALGRIND_QEMU -- "{VALGRIND_QEMU}" +PRINT_QEMU -- "{PRINT_QEMU}" """ args = collections.defaultdict(str, self.get_env())