public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb] Fix python selftest with python 3.11
@ 2022-07-21 11:13 Tom de Vries
  2022-07-21 11:42 ` Mark Wielaard
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2022-07-21 11:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kevin Buettner, Mark Wielaard

Hi,

With python 3.11 I noticed:
...
$ gdb -q -batch -ex "maint selftest python"
Running selftest python.
Self test failed: self-test failed at gdb/python/python.c:2246
Ran 1 unit tests, 1 failed
...

In more detail:
...
(gdb) p output
$5 = "Traceback (most recent call last):\n  File \"<string>\", line 0, \
  in <module>\nKeyboardInterrupt\n"
(gdb) p ref_output
$6 = "Traceback (most recent call last):\n  File \"<string>\", line 1, \
  in <module>\nKeyboardInterrupt\n"
...

Fix this by also allowing line number 0.

Tested on x86_64-linux.

This should hopefully fix buildbot builder gdb-rawhide-x86_64.

Any comments?

Thanks,
- Tom

[gdb] Fix python selftest with python 3.11

---
 gdb/python/python.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 8fa935c8286..365859a2e4e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2240,10 +2240,13 @@ test_python ()
 	SELF_CHECK (*e.message == "Error while executing Python code.");
       }
     SELF_CHECK (saw_exception);
-    std::string ref_output("Traceback (most recent call last):\n"
-			   "  File \"<string>\", line 1, in <module>\n"
-			   "KeyboardInterrupt\n");
-    SELF_CHECK (output == ref_output);
+    std::string ref_output_0("Traceback (most recent call last):\n"
+			     "  File \"<string>\", line 0, in <module>\n"
+			     "KeyboardInterrupt\n");
+    std::string ref_output_1("Traceback (most recent call last):\n"
+			     "  File \"<string>\", line 1, in <module>\n"
+			     "KeyboardInterrupt\n");
+    SELF_CHECK (output == ref_output_0 || output == ref_output_1);
   }
 
 #undef CMD

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb] Fix python selftest with python 3.11
  2022-07-21 11:13 [PATCH][gdb] Fix python selftest with python 3.11 Tom de Vries
@ 2022-07-21 11:42 ` Mark Wielaard
  2022-07-21 12:06   ` Tom de Vries
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2022-07-21 11:42 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Kevin Buettner

Hi Tom,

On Thu, Jul 21, 2022 at 01:13:17PM +0200, Tom de Vries wrote:
> Fix this by also allowing line number 0.
> 
> Tested on x86_64-linux.
> 
> This should hopefully fix buildbot builder gdb-rawhide-x86_64.
> 
> Any comments?

It seems the line number is really irrelevant here for where exactly
the KeyboardInterrupt took place. So the patch looks good to me.

Note that there is a gdb-try-rawhide-x86_64 builder, so you can also
test by pushing this to a git users/vries/try-xxx branch.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb] Fix python selftest with python 3.11
  2022-07-21 11:42 ` Mark Wielaard
@ 2022-07-21 12:06   ` Tom de Vries
  2022-07-21 12:36     ` Mark Wielaard
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2022-07-21 12:06 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: gdb-patches, Kevin Buettner

On 7/21/22 13:42, Mark Wielaard wrote:
> Hi Tom,
> 
> On Thu, Jul 21, 2022 at 01:13:17PM +0200, Tom de Vries wrote:
>> Fix this by also allowing line number 0.
>>
>> Tested on x86_64-linux.
>>
>> This should hopefully fix buildbot builder gdb-rawhide-x86_64.
>>
>> Any comments?
> 
> It seems the line number is really irrelevant here for where exactly
> the KeyboardInterrupt took place. So the patch looks good to me.
> 

Thanks for the review.

> Note that there is a gdb-try-rawhide-x86_64 builder, so you can also
> test by pushing this to a git users/vries/try-xxx branch.

I've tried that, and it went fine, so I've pushed this (after fixing a 
trivial formatting issue, not reposting).

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb] Fix python selftest with python 3.11
  2022-07-21 12:06   ` Tom de Vries
@ 2022-07-21 12:36     ` Mark Wielaard
  2022-07-21 12:55       ` Tom de Vries
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2022-07-21 12:36 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Kevin Buettner

Hi Tom,

On Thu, Jul 21, 2022 at 02:06:09PM +0200, Tom de Vries wrote:
> > It seems the line number is really irrelevant here for where exactly
> > the KeyboardInterrupt took place. So the patch looks good to me.
> > 
> 
> Thanks for the review.
> 
> > Note that there is a gdb-try-rawhide-x86_64 builder, so you can also
> > test by pushing this to a git users/vries/try-xxx branch.
> 
> I've tried that, and it went fine, so I've pushed this (after fixing a
> trivial formatting issue, not reposting).

I am afraid the trivial formatting fix accidentially introduced an
extra space before KeyboardInterrupt:

" KeyboardInterrupt\n" should be "KeyboardInterrupt\n"

Cheers,

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb] Fix python selftest with python 3.11
  2022-07-21 12:36     ` Mark Wielaard
@ 2022-07-21 12:55       ` Tom de Vries
  0 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2022-07-21 12:55 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: gdb-patches, Kevin Buettner

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

On 7/21/22 14:36, Mark Wielaard wrote:
> Hi Tom,
> 
> On Thu, Jul 21, 2022 at 02:06:09PM +0200, Tom de Vries wrote:
>>> It seems the line number is really irrelevant here for where exactly
>>> the KeyboardInterrupt took place. So the patch looks good to me.
>>>
>>
>> Thanks for the review.
>>
>>> Note that there is a gdb-try-rawhide-x86_64 builder, so you can also
>>> test by pushing this to a git users/vries/try-xxx branch.
>>
>> I've tried that, and it went fine, so I've pushed this (after fixing a
>> trivial formatting issue, not reposting).
> 
> I am afraid the trivial formatting fix accidentially introduced an
> extra space before KeyboardInterrupt:
> 
> " KeyboardInterrupt\n" should be "KeyboardInterrupt\n"
> 

Thanks for noticing that.

Fixed by this commit (also tested using the try-buildbot, and this time, 
committed what I actually tested).

Committed.

Thanks,
- Tom

[-- Attachment #2: 0001-gdb-python-Fix-typo-in-test_python.patch --]
[-- Type: text/x-patch, Size: 803 bytes --]

[gdb/python] Fix typo in test_python

Fix typo in ref_output_0 variable in test_python.

Tested by running the selftest on x86_64-linux with python 3.11.

---
 gdb/python/python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index c0312413a73..c7d4157b70c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2242,7 +2242,7 @@ test_python ()
     SELF_CHECK (saw_exception);
     std::string ref_output_0 ("Traceback (most recent call last):\n"
 			      "  File \"<string>\", line 0, in <module>\n"
-			      " KeyboardInterrupt\n");
+			      "KeyboardInterrupt\n");
     std::string ref_output_1 ("Traceback (most recent call last):\n"
 			      "  File \"<string>\", line 1, in <module>\n"
 			      "KeyboardInterrupt\n");

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-21 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 11:13 [PATCH][gdb] Fix python selftest with python 3.11 Tom de Vries
2022-07-21 11:42 ` Mark Wielaard
2022-07-21 12:06   ` Tom de Vries
2022-07-21 12:36     ` Mark Wielaard
2022-07-21 12:55       ` Tom de Vries

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 read-only IMAP folder(s) and NNTP newsgroup(s).