* [pushed] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp
@ 2024-02-13 9:44 Tom de Vries
2024-02-13 14:50 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2024-02-13 9:44 UTC (permalink / raw)
To: gdb-patches
With test-case gdb.dap/sources.exp, I run into:
...
{"request_seq": 4, "type": "response", "command": "source", \
"success": false, "message": "notStopped", \
"seq": 11}FAIL: gdb.dap/sources.exp: get source success
ERROR: tcl error sourcing gdb.dap/sources.exp.
ERROR: key "body" not known in dictionary
...
The FAIL has been filed as PR dap/31374.
The ERROR happens because after the FAIL, dap_check_request_and_response
returns "", and the test-case doesn't check for that.
Fix this by checking for $obj != "" in the test-case.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dap/sources.exp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.dap/sources.exp b/gdb/testsuite/gdb.dap/sources.exp
index b60681160af..f601190d6f5 100644
--- a/gdb/testsuite/gdb.dap/sources.exp
+++ b/gdb/testsuite/gdb.dap/sources.exp
@@ -49,8 +49,10 @@ if {$path == ""} {
set obj [dap_check_request_and_response "get source" source \
[format {o source [o path [s %s]] \
sourceReference [i 0]} $path]]
- set text [dict get [lindex $obj 0] body content]
- gdb_assert {[string first "Distinguishing comment" $text] != -1}
+ if { $obj != "" } {
+ set text [dict get [lindex $obj 0] body content]
+ gdb_assert {[string first "Distinguishing comment" $text] != -1}
+ }
}
base-commit: 7e4208a3f5d60f43b4a8f02e583fa950b599cd00
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pushed] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp
2024-02-13 9:44 [pushed] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp Tom de Vries
@ 2024-02-13 14:50 ` Tom Tromey
2024-02-13 15:00 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-02-13 14:50 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Fix this by checking for $obj != "" in the test-case.
I think this obscures the real failure that you found in the next patch...
Tom> - set text [dict get [lindex $obj 0] body content]
Tom> - gdb_assert {[string first "Distinguishing comment" $text] != -1}
Tom> + if { $obj != "" } {
Tom> + set text [dict get [lindex $obj 0] body content]
Tom> + gdb_assert {[string first "Distinguishing comment" $text] != -1}
Tom> + }
... with this change in place, it seems like a bug in the code will just
silently pass.
The DAP tests aren't always super robust against Tcl errors, which is
sometimes annoying.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pushed] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp
2024-02-13 14:50 ` Tom Tromey
@ 2024-02-13 15:00 ` Tom de Vries
0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2024-02-13 15:00 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 2/13/24 15:50, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> Fix this by checking for $obj != "" in the test-case.
>
> I think this obscures the real failure that you found in the next patch...
>
> Tom> - set text [dict get [lindex $obj 0] body content]
> Tom> - gdb_assert {[string first "Distinguishing comment" $text] != -1}
> Tom> + if { $obj != "" } {
> Tom> + set text [dict get [lindex $obj 0] body content]
> Tom> + gdb_assert {[string first "Distinguishing comment" $text] != -1}
> Tom> + }
>
> ... with this change in place, it seems like a bug in the code will just
> silently pass.
>
I don't think so, the FAIL is there with or without this patch.
Thanks,
- Tom
> The DAP tests aren't always super robust against Tcl errors, which is
> sometimes annoying.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-13 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 9:44 [pushed] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp Tom de Vries
2024-02-13 14:50 ` Tom Tromey
2024-02-13 15:00 ` 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).