From patchwork Mon Nov 18 20:41:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 844118 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp827962wrx; Mon, 18 Nov 2024 12:42:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVxLzZJm+sDkuXkvzrnLArcABsMwzTn0Q3DyVhSk7boPXBxUKUka4bhOIfgw0BXNn0wdjUy/A==@linaro.org X-Google-Smtp-Source: AGHT+IGSG+d6yMP6Q9+UA/hkk4TAWy8rqJvGo4/wwzoaj06xu3HvcXSugByusaiMDNKwZneakTys X-Received: by 2002:a05:622a:5498:b0:463:169d:5438 with SMTP id d75a77b69052e-46363e285f6mr177543081cf.25.1731962551065; Mon, 18 Nov 2024 12:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731962551; cv=none; d=google.com; s=arc-20240605; b=hPkCqbtoiNdaDUbLGt7j4OoFMck4aN6NfPD1P5s6rXCmZda4oFlPsiNFmu86zPM79o SctfJlxT0voGw/JRNcrT80xNmVZjvZ0DhgdFF24I+ds/pgC3TR9B9xKd0SXwJxmUguYM 3T6skowK4AjYfaK0+xcJeJBQyzwfbh5jJCYLwsAakiA4ekd/OaKo4XrBB79sXwrWrUsX GDh8B9Oe0/cKujkDX3EaLpmgRkxYVyOIq6oD993zTidWnktJb5lGWT3qc6/oy30QrGh/ 3OwiTBUBRa0Q4al6ZneCQG+f6ZtfudjHgGSpY/oyEeStB9pq9I9nwEzrwAsdZ4Wp/fTW 8fOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; fh=eKYvAaytWQFuF43IJXIvZxUhuxPgzrb9UuL8TfipZbw=; b=Dae2geGOvl0dlSLAws3UVh/zG7D0ud4im+S/3TwqafTyOZeUnhbFI90hn4cLxE/NIi G4J7TqDu2T2TWoFeF5W/xAEfxwKQcMmRKirX4KlxRbZE3QtmDHjHRnO1jdxU8WvUx1IE NlGkxo38RmqYcCyf4A2RuSXU5As3POhnijxEKGoiPIkqtt6G2f9KBdNIg2nBErd8DOkp ehba4ewXqHHCPez+edyn8ohlLeEMJk9eXX+p5lctwVJ3b+Wzv7roWUXvuB2UpE5TwQUY OjhH9DvkQq7XuRTKI4SosMsWztmbLwEJ77vJcZCnoSvktB94hu1jElVGfgcvFpqlLd4i lMQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=acvYzKnb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46392c1a2c9si5850711cf.294.2024.11.18.12.42.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 12:42:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=acvYzKnb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8Ys-0001U9-62; Mon, 18 Nov 2024 15:41:30 -0500 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 1tD8Yq-0001Tq-F1 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8Yo-0002NO-Hi for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5cfcb7183deso2202391a12.0 for ; Mon, 18 Nov 2024 12:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731962484; x=1732567284; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; b=acvYzKnbD+BXmYCUeI1WBKGIMbq0Bwzf7Yc3d8JtV1raLgYx97VNXeOpWj6JiJaYeH C7b/dcbuYBGfOtfgPFTV+WrRpvA6CCBBzKgpABzUYIj8t7RhQZISRmrHtAL7lGmT72JS bYa0bWvBBSsKMUK7C+K8D9DxDLfOVWkq9sT5pzdzc0oqDnFVcuMuUuSD+k+xT648TB2k gBzVA1HRx+bqVYDmPu5e5grGaC2NYRXn/OTo/mh4P6M7guc2X12fJO/E5LhpzUfOcFFW pO7ldWovVvyriHR3MexccP91y2ZLDfqFeJQ90LKlUDRur/N67vMqpj3kP/byHfr5LN9x +WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731962484; x=1732567284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; b=UR86IOkPYbggMCVLPkwEZCXKvmrSop6QJ3AVbD1zMUkmsPUaxTCs4bz6grrQFNucTg GIo/7SDwKkcK/U8S7RCHUGVqqgBCIyv5nWxCkOjjXYood2Qe6mRk1LvVXNhLNCElxRjH InH57YTvey8dCojyANedNQDyLUFQe5x/EGek4g6vud9t5wTPhZIlv9ysk+9/3dIt2JjK 5GPHJRguoDuI1Bx+KG3WW/ZVrYpbfnFwxx14oE4GA7NFA+wU0er09iw1lKpRXuSMPfVa VDK01L1pWFg7P4idexJV9QMQRoV39BWBxZLP/GNIHABbSkL89UnQH7jOMizFwuQjSCoZ DM5g== X-Gm-Message-State: AOJu0Yxi8mLAXXplyJ0f8Nh2R7BfDH8b6kCM975Ry5+elWuNJojfMFPP i4kd/FrjQ4sDeop0raXktVj7R9lfqvxgtIlNfubIYi16/uMAgyffAtKHuhaDbeo= X-Received: by 2002:a17:906:4fcb:b0:a9e:eee8:4947 with SMTP id a640c23a62f3a-aa4c7e256fbmr67195166b.9.1731962484533; Mon, 18 Nov 2024 12:41:24 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df56b1esm574306066b.71.2024.11.18.12.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 12:41:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 37DDB5F8E9; Mon, 18 Nov 2024 20:41:23 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Gustavo Romero , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 1/4] tests/tcg: Stop using exit() in the gdbstub testcases Date: Mon, 18 Nov 2024 20:41:20 +0000 Message-Id: <20241118204123.3083310-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118204123.3083310-1-alex.bennee@linaro.org> References: <20241118204123.3083310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich 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é Signed-off-by: Ilya Leoshkevich Message-Id: <20241022113939.19989-1-iii@linux.ibm.com> Signed-off-by: Alex Bennée diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdbstub.py index a715c0e3f5..4f08089e6a 100644 --- a/tests/guest-debug/test_gdbstub.py +++ b/tests/guest-debug/test_gdbstub.py @@ -10,10 +10,16 @@ fail_count = 0 + +def gdb_exit(status): + gdb.execute(f"exit {status}") + + class arg_parser(argparse.ArgumentParser): def exit(self, status=None, message=""): print("Wrong GDB script test argument! " + message) - gdb.execute("exit 1") + gdb_exit(1) + def report(cond, msg): """Report success/fail of a test""" @@ -38,11 +44,11 @@ def main(test, expected_arch=None): "connected to {}".format(expected_arch)) except (gdb.error, AttributeError): print("SKIP: not connected") - exit(0) + gdb_exit(0) if gdb.parse_and_eval("$pc") == 0: print("SKIP: PC not set") - exit(0) + gdb_exit(0) try: test() @@ -62,4 +68,4 @@ def main(test, expected_arch=None): pass 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 90a45b5140..2d5654d154 100644 --- a/tests/tcg/multiarch/gdbstub/interrupt.py +++ b/tests/tcg/multiarch/gdbstub/interrupt.py @@ -8,7 +8,7 @@ # import gdb -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report def check_interrupt(thread): @@ -49,7 +49,7 @@ def run_test(): """ if len(gdb.selected_inferior().threads()) == 1: print("SKIP: set to run on a single thread") - exit(0) + gdb_exit(0) 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 7e264589cb..51082a30e4 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 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 = 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 0f687f3284..6eb6ebf7b1 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 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 = gdb.execute("info proc mappings", False, True) report(isinstance(mappings, str), "Fetched the mappings from the inferior") # Broken with host page size > guest page size