From nobody Tue Oct 22 22:32:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1729597265; cv=none; d=zohomail.com; s=zohoarc; b=egzRd+Mc8TLYr5pfFqWUAukz49C55YgGWWivbVjCvKM9qU9vcZy6I/EcnDS5y266qpGBOFovxMxxpblLUNO+5sPDuGEZAllGoXUiGyOg9AitIZr3J4vKIcK4kYgiwcs0uORPgBt5aq6iysrSDAoVyGu6lwGDl4pu03PB9a1wWmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729597265; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DrJYM7OmrEChNecpP4cBzc7hafsikJHo6jqqXcsVJhA=; b=AfOGi90JZ/KDKn29md8xWCN8PQNKZ0Sb/bX1k0P9rI/2X5H2dAcQVyGPX1/7rgJdr7/0nDkacZuHaEdAeFh1ojDrtdkDgWh5rCphHwBUJAnHDs93vTtI8amMjV+67q9ER0Deu7SyjlQqqNxaqQ+AHtldondVcu0RUzOOnI2KXFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729597265859535.6344283473442; Tue, 22 Oct 2024 04:41:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3DFA-0005LI-Uy; Tue, 22 Oct 2024 07:40:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3DEw-0005Km-Sj for qemu-devel@nongnu.org; Tue, 22 Oct 2024 07:39:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3DEu-00014R-2O for qemu-devel@nongnu.org; Tue, 22 Oct 2024 07:39:54 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49M2HEA1018378; Tue, 22 Oct 2024 11:39:48 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5gcpack-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 11:39:48 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49M82Fd4026471; Tue, 22 Oct 2024 11:39:47 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 42cq3sb6m0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 11:39:47 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49MBdeqn50987510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2024 11:39:40 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94BE520043; Tue, 22 Oct 2024 11:39:40 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BECA20040; Tue, 22 Oct 2024 11:39:40 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.26.72]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 22 Oct 2024 11:39:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pp1; bh=DrJYM7OmrEChNecpP4cBzc7hafsi kJHo6jqqXcsVJhA=; b=aqv1rTPis+i5uroI5DeTdM24prPWnYDI3ZDTNAz9gmDq GYmK1HjZqlcnDUizIrxAA0BIqH45kyx78r3Y1J7uXv+YkRlBo1IJ2O8clxtXJxlR 4CrAZrktTagRUm7rYLWxkvKNwasoUrTcKH4G/b32Cih3AQROxHI10rm2Lh5IV/u6 Wr+iLnnWd+vqYBNP5i71yIlyM03HkbTEoLrENqzqtgW2LN+Zt3zmhx9QIyiUTdAS 8IXvth7Yjm0KpaTtpztmWrr8mF1+nULl97ruZWWL0I6nKqZK8Sje22SdVct4pw6F Rl7MaGEajeRIy96SThb0Hm3QK+Y2J/AffrhAFhQEEQ== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: Peter Maydell , qemu-devel@nongnu.org, Gustavo Romero , Ilya Leoshkevich Subject: [PATCH v2] tests/tcg: Stop using exit() in the gdbstub testcases Date: Tue, 22 Oct 2024 13:37:11 +0200 Message-ID: <20241022113939.19989-1-iii@linux.ibm.com> X-Mailer: git-send-email 2.47.0 Content-Type: text/plain; charset="utf-8" X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 6WViykz38n35A2yWy4hBzN1FxVOjnb5R X-Proofpoint-ORIG-GUID: 6WViykz38n35A2yWy4hBzN1FxVOjnb5R Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 spamscore=0 phishscore=0 adultscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410220074 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=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1729597266679116600 GDB 15 does not like exit() anymore: (gdb) python exit(0) Python Exception : 0 Error occurred in Python: 0 Use the GDB's own exit command, like it's already done in a couple places, everywhere. This is the same fix as commit 93a3048dcf45 ("tests: Gently exit from GDB when tests complete"), but applied to more places. Acked-by: Gustavo Romero Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Ilya Leoshkevich --- v1: https://lore.kernel.org/qemu-devel/20241021150153.487057-1-iii@linux.ib= m.com/ v1 -> v2: Mention 93a3048dcf45 (Peter, Gustavo, Philippe). Collect A-b and R-b. tests/guest-debug/test_gdbstub.py | 14 ++++++++++---- tests/tcg/multiarch/gdbstub/interrupt.py | 4 ++-- tests/tcg/multiarch/gdbstub/prot-none.py | 4 ++-- tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdb= stub.py index a715c0e3f5e..4f08089e6a9 100644 --- a/tests/guest-debug/test_gdbstub.py +++ b/tests/guest-debug/test_gdbstub.py @@ -10,10 +10,16 @@ =20 fail_count =3D 0 =20 + +def gdb_exit(status): + gdb.execute(f"exit {status}") + + class arg_parser(argparse.ArgumentParser): def exit(self, status=3DNone, message=3D""): print("Wrong GDB script test argument! " + message) - gdb.execute("exit 1") + gdb_exit(1) + =20 def report(cond, msg): """Report success/fail of a test""" @@ -38,11 +44,11 @@ def main(test, expected_arch=3DNone): "connected to {}".format(expected_arch)) except (gdb.error, AttributeError): print("SKIP: not connected") - exit(0) + gdb_exit(0) =20 if gdb.parse_and_eval("$pc") =3D=3D 0: print("SKIP: PC not set") - exit(0) + gdb_exit(0) =20 try: test() @@ -62,4 +68,4 @@ def main(test, expected_arch=3DNone): pass =20 print("All tests complete: {} failures".format(fail_count)) - gdb.execute(f"exit {fail_count}") + gdb_exit(fail_count) diff --git a/tests/tcg/multiarch/gdbstub/interrupt.py b/tests/tcg/multiarch= /gdbstub/interrupt.py index 90a45b5140a..2d5654d1540 100644 --- a/tests/tcg/multiarch/gdbstub/interrupt.py +++ b/tests/tcg/multiarch/gdbstub/interrupt.py @@ -8,7 +8,7 @@ # =20 import gdb -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def check_interrupt(thread): @@ -49,7 +49,7 @@ def run_test(): """ if len(gdb.selected_inferior().threads()) =3D=3D 1: print("SKIP: set to run on a single thread") - exit(0) + gdb_exit(0) =20 gdb.execute("set scheduler-locking on") for thread in gdb.selected_inferior().threads(): diff --git a/tests/tcg/multiarch/gdbstub/prot-none.py b/tests/tcg/multiarch= /gdbstub/prot-none.py index 7e264589cb8..51082a30e40 100644 --- a/tests/tcg/multiarch/gdbstub/prot-none.py +++ b/tests/tcg/multiarch/gdbstub/prot-none.py @@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-2.0-or-later """ import ctypes -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def probe_proc_self_mem(): @@ -22,7 +22,7 @@ def run_test(): """Run through the tests one by one""" if not probe_proc_self_mem(): print("SKIP: /proc/self/mem is not usable") - exit(0) + gdb_exit(0) gdb.Breakpoint("break_here") gdb.execute("continue") val =3D gdb.parse_and_eval("*(char[2] *)q").string() diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/= multiarch/gdbstub/test-proc-mappings.py index 0f687f3284a..6eb6ebf7b17 100644 --- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py @@ -3,7 +3,7 @@ This runs as a sourced script (via -x, via run-test.py).""" from __future__ import print_function import gdb -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def run_test(): @@ -12,7 +12,7 @@ def run_test(): # m68k GDB supports only GDB_OSABI_SVR4, but GDB_OSABI_LINUX is # required for the info proc support (see set_gdbarch_info_proc()). print("SKIP: m68k GDB does not support GDB_OSABI_LINUX") - exit(0) + gdb_exit(0) mappings =3D gdb.execute("info proc mappings", False, True) report(isinstance(mappings, str), "Fetched the mappings from the infer= ior") # Broken with host page size > guest page size --=20 2.47.0