From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 87C3E385841D; Tue, 13 Feb 2024 09:44:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87C3E385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707817460; bh=UASElYHt6mvUajlbNtZcPWMV0S/X6pi8yAHB19FhV7A=; h=From:To:Subject:Date:From; b=hvnOnfr54jqCTKlxdLhM7KCNKy5FRNJ4uRevLJIxdlx454cV7ZXlaRWFsD8tIDhTW bkVfXCMg8SrZUvxyRG4rmWuMCHf5iLesoXWqUB1zn2J1xsqgUkNdiuRyhImnEaZdHM ZnXpP0ma8/vZnb7+qKNkSy0FI1N9plxhxjAPpYdM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 7e4208a3f5d60f43b4a8f02e583fa950b599cd00 X-Git-Newrev: 4dad3c1e1c9e789addc0d196cef8e8ea22ddbeda Message-Id: <20240213094420.87C3E385841D@sourceware.org> Date: Tue, 13 Feb 2024 09:44:20 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4dad3c1e1c9e= 789addc0d196cef8e8ea22ddbeda commit 4dad3c1e1c9e789addc0d196cef8e8ea22ddbeda Author: Tom de Vries Date: Tue Feb 13 10:44:25 2024 +0100 [gdb/testsuite] Fix tcl error in gdb.dap/sources.exp =20 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 ... =20 The FAIL has been filed as PR dap/31374. =20 The ERROR happens because after the FAIL, dap_check_request_and_response returns "", and the test-case doesn't check for that. =20 Fix this by checking for $obj !=3D "" in the test-case. =20 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/sour= ces.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 =3D=3D ""} { 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] !=3D -1} + if { $obj !=3D "" } { + set text [dict get [lindex $obj 0] body content] + gdb_assert {[string first "Distinguishing comment" $text] !=3D -1} + } }