From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/testsuite] Fix gdb.python/py-mi-cmd.exp
Date: Tue, 4 Aug 2026 17:31:50 +0200 [thread overview]
Message-ID: <20260804153150.1389153-1-tdevries@suse.de> (raw)
On Fedora Rawhide aarch64-linux (using Python 3.15.0b4), with test-case
gdb.python/py-mi-cmd.exp I ran into:
...
Expecting: ^(-pycmd bk3[^M
]+)?(&"TypeError.*: __repr__ returned non-string \(type BadKey\).."^M
\^error,msg="Error occurred in Python: __repr__ returned non-string \(type BadKey\)"[^M
]+[(]gdb[)] ^M
[ ]*)
-pycmd bk3^M
&"TypeError: ReallyBadKey.__repr__() must return a str, not BadKey\n"^M
^error,msg="Error occurred in Python: ReallyBadKey.__repr__() must return a str, not BadKey"^M
(gdb) ^M
FAIL: $exp: -pycmd bk3 (unexpected output)
...
Fix this by updating the regexp.
Tested with aarch64-linux (Python 3.15.0b4) and x86_64-linux (Python 3.13.14).
---
gdb/testsuite/gdb.python/py-mi-cmd.exp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp b/gdb/testsuite/gdb.python/py-mi-cmd.exp
index b66a73c331f..3c57a7ae322 100644
--- a/gdb/testsuite/gdb.python/py-mi-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp
@@ -68,10 +68,19 @@ mi_gdb_test "-pycmd bk2" \
"\\^error,msg=\"Error occurred in Python: non-string object used as key: 1\"" \
"-pycmd bk2"
+set re_msg \
+ [string cat \
+ "(" \
+ [string_to_regexp {__repr__ returned non-string (type BadKey)}] \
+ "|" \
+ [string_to_regexp \
+ {ReallyBadKey.__repr__() must return a str, not BadKey}] \
+ ")"]
mi_gdb_test "-pycmd bk3" \
- [multi_line \
- "&\"TypeError.*: __repr__ returned non-string \\(type BadKey\\)..\"" \
- "\\^error,msg=\"Error occurred in Python: __repr__ returned non-string \\(type BadKey\\)\""] \
+ [subst_vars \
+ [multi_line \
+ {&"TypeError.*: $re_msg\\n"} \
+ {\^error,msg="Error occurred in Python: $re_msg"}]] \
"-pycmd bk3"
mi_gdb_test "-pycmd tpl" \
base-commit: 471130b39c03623ec6d78ece377ff4da3f6bfe7b
--
2.51.0
next reply other threads:[~2026-08-04 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 15:31 Tom de Vries [this message]
2026-08-12 20:16 ` Tom Tromey
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=20260804153150.1389153-1-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.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