qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Gustavo Romero" <gustavo.romero@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 5/5] tests: Gently exit from GDB when tests complete
Date: Fri, 17 May 2024 17:02:27 +0200	[thread overview]
Message-ID: <20240517150227.32205-6-philmd@linaro.org> (raw)
In-Reply-To: <20240517150227.32205-1-philmd@linaro.org>

From: Gustavo Romero <gustavo.romero@linaro.org>

GDB commit a207f6b3a38 ('Rewrite "python" command exception handling')
changed how exit() called from Python scripts loaded by GDB behave,
turning it into an exception instead of a generic error code that is
returned. This change caused several QEMU tests to crash with the
following exception:

Python Exception <class 'SystemExit'>: 0
Error occurred in Python: 0

This happens because in tests/guest-debug/test_gdbstub.py exit is
called after the tests have completed.

This commit fixes it by politely asking GDB to exit via gdb.execute,
passing the proper fail_count to be reported to 'make', instead of
abruptly calling exit() from the Python script.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240515173132.2462201-4-gustavo.romero@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/guest-debug/test_gdbstub.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdbstub.py
index 7f71d34da1..46fbf98f0c 100644
--- a/tests/guest-debug/test_gdbstub.py
+++ b/tests/guest-debug/test_gdbstub.py
@@ -57,4 +57,4 @@ def main(test, expected_arch=None):
         pass
 
     print("All tests complete: {} failures".format(fail_count))
-    exit(fail_count)
+    gdb.execute(f"exit {fail_count}")
-- 
2.41.0



  parent reply	other threads:[~2024-05-17 15:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 15:02 [PULL 0/5] Misc HW patches & fixes for 2024-05-17 Philippe Mathieu-Daudé
2024-05-17 15:02 ` [PULL 1/5] ui/console: Only declare variable fence_fd when CONFIG_GBM is defined Philippe Mathieu-Daudé
2024-05-17 16:56   ` Kim, Dongwon
2024-05-17 15:02 ` [PULL 2/5] hw/pflash: fix block write start Philippe Mathieu-Daudé
2024-05-17 15:02 ` [PULL 3/5] hw/core: allow parameter=1 for SMP topology on any machine Philippe Mathieu-Daudé
2024-07-03  8:21   ` Daniel P. Berrangé
2024-07-03  8:39     ` Michael Tokarev
2024-05-17 15:02 ` [PULL 4/5] tests: add testing of parameter=1 for SMP topology Philippe Mathieu-Daudé
2024-05-17 15:02 ` Philippe Mathieu-Daudé [this message]
2024-05-18 13:26 ` [PULL 0/5] Misc HW patches & fixes for 2024-05-17 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240517150227.32205-6-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=gustavo.romero@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).