From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YNxfNkVvuGMnHxEAWB0awg (envelope-from ) for ; Fri, 06 Jan 2023 13:58:13 -0500 Received: by simark.ca (Postfix, from userid 112) id DB3331E222; Fri, 6 Jan 2023 13:58:13 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=yif2V3yF; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8F1D31E112 for ; Fri, 6 Jan 2023 13:58:13 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C53A1385703A for ; Fri, 6 Jan 2023 18:58:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C53A1385703A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673031492; bh=hCtxmAa3VfITbwFIlG2VBMlvMyzwjvdOD+W72jNiCSc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=yif2V3yFEjH8i09MKXBdAWxKhEa05rTG2u/WcVAEWDYni0Pfu2pYZhn11vQH53G4u DLysiVO0NlW/ieGU+WNGKUfC1zr5mTFABqnx0JFaE8OTVpCqMkL1ZBjCrhLWCYD77/ 5GyXGCGBq02HDECalaOjHo//kgI5+c1cKmuKFEME= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 225FB3858CDB for ; Fri, 6 Jan 2023 18:57:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 225FB3858CDB X-ASG-Debug-ID: 1673031450-0c856e762b4b7e90001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id swSdvAMN6W18NYBG (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Fri, 06 Jan 2023 13:57:30 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id E3595441B21; Fri, 6 Jan 2023 13:57:30 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 4/9] gdb/testsuite/dap: make dap_request_and_response not catch / issue test result Date: Fri, 6 Jan 2023 13:57:24 -0500 X-ASG-Orig-Subj: [PATCH 4/9] gdb/testsuite/dap: make dap_request_and_response not catch / issue test result Message-Id: <20230106185729.42372-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230106185729.42372-1-simon.marchi@efficios.com> References: <20230106185729.42372-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1673031450 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 2837 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.103363 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Following some of my changes, dap_request_and_response was failing and I didn't know why. I think it's better to make it not catch any exception, and just make it do a simple "send request, read response". If an exception is thrown while sending a request or reading a response, things are going really badly, it's not like we'll want to recover from that and continue the test. Change-Id: I27568d3547f753c3a74e3e5a730d38a8caef9356 --- gdb/testsuite/gdb.dap/basic-dap.exp | 2 +- gdb/testsuite/lib/dap-support.exp | 25 ++++++------------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp index c60989d2a6f..af55d19349f 100644 --- a/gdb/testsuite/gdb.dap/basic-dap.exp +++ b/gdb/testsuite/gdb.dap/basic-dap.exp @@ -123,7 +123,7 @@ set obj [dap_check_request_and_response "evaluate global in main" \ dap_match_values "global value in main" [lindex $obj 0] \ "body result" 25 -set obj [dap_request_and_response "evaluate non-existing variable" \ +set obj [dap_request_and_response \ evaluate {o expression [s nosuchvariable]}] set d [namespace eval ton::2dict [lindex $obj 0]] gdb_assert { [dict get $d success] == "false" } "result of invalid request" diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index 94a0d27c8a8..bc99f0182a7 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -201,29 +201,16 @@ proc _dap_read_response {cmd num} { } # A wrapper for _dap_send_request and _dap_read_response. This sends a -# request to gdb and returns the result. NAME is used to issue a pass -# or fail; on failure, this always returns an empty string. -proc dap_request_and_response {name command {obj {}}} { - set result {} - if {[catch { - set seq [_dap_send_request $command $obj] - set result [_dap_read_response $command $seq] - } text]} { - verbose "reason: $text" - fail $name - } else { - pass $name - } - return $result +# request to gdb and returns the response as a dict. +proc dap_request_and_response {command {obj {}}} { + set seq [_dap_send_request $command $obj] + return [_dap_read_response $command $seq] } # Like dap_request_and_response, but also checks that the response -# indicates success. +# indicates success. NAME is used to issue a test result. proc dap_check_request_and_response {name command {obj {}}} { - set result [dap_request_and_response $name $command $obj] - if {$result == ""} { - return "" - } + set result [dap_request_and_response $command $obj] set d [namespace eval ton::2dict [lindex $result 0]] if {[dict get $d success] != "true"} { verbose "request failure: $result" -- 2.38.1