public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp
Date: Tue, 13 Feb 2024 09:44:20 +0000 (GMT)	[thread overview]
Message-ID: <20240213094420.87C3E385841D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4dad3c1e1c9e789addc0d196cef8e8ea22ddbeda

commit 4dad3c1e1c9e789addc0d196cef8e8ea22ddbeda
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Feb 13 10:44:25 2024 +0100

    [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp
    
    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.

Diff:
---
 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}
+    }
 }

                 reply	other threads:[~2024-02-13  9:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240213094420.87C3E385841D@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).