From patchwork Sat Oct 29 07:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 59615 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CBE8385842A for ; Sat, 29 Oct 2022 07:44:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CBE8385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667029494; bh=RpNFe3+Jpr+PHf4xQXfgyr/Qrea+s2/TVyA/nU/AnVw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ZboOb5fNtkEmA+CmemAdYysfCYyorY+ne6JzO3t4QHm8wYjw1xxlv9ejtvg/kT6h8 QimVvAHkeAa0Orb/L66c2qdQNAX0hywQYdc7lgq7m7qm/X3d8b1J/rdR2nTrFGe6wT euVpJ63Q3tbFCxHkfHSdUTuZqiSjGJTl5c+FRdmU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id BFD513858D38 for ; Sat, 29 Oct 2022 07:43:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BFD513858D38 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EC9261FAA1 for ; Sat, 29 Oct 2022 07:43:57 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D95D213AAD for ; Sat, 29 Oct 2022 07:43:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +CLtM73ZXGO+VgAAMHmgww (envelope-from ) for ; Sat, 29 Oct 2022 07:43:57 +0000 To: gdb-patches@sourceware.org Subject: [pushed 1/3] [gdb/testsuite] Consume output asap in gdb.server/multi-ui-errors.exp Date: Sat, 29 Oct 2022 09:43:55 +0200 Message-Id: <20221029074357.12305-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221029074357.12305-1-tdevries@suse.de> References: <20221029074357.12305-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.server/multi-ui-errors.exp we see: ... (gdb) PASS: multi-ui-errors.exp: main UI, prompt after gdbserver dies continue^M Continuing.^M echo^M (gdb) PASS: multi-ui-errors.exp: extra UI, prompt after gdbserver dies ... The continue is issued earlier in the test-case, but the output has not been consumed, which makes it show up much later. Consume the continue output asap, to make it clear when the continue is issued: ... (gdb) PASS: gdb.server/multi-ui-errors.exp: connect to gdbserver continue^M Continuing.^M PASS: gdb.server/multi-ui-errors.exp: continue - extra UI ... Tested on x86_64-linux. --- gdb/testsuite/gdb.server/multi-ui-errors.exp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp index d3ddd0f2d08..8a1276fb272 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.exp +++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp @@ -75,7 +75,13 @@ with_spawn_id $extra_spawn_id { with_spawn_id $extra_spawn_id { gdb_test "target $gdbserver_protocol $gdbserver_gdbport" ".*" \ "connect to gdbserver" - send_gdb "continue\n" + + # Issue a continue and consume the response. Don't expect a prompt. + gdb_test_multiple "continue" "continue - extra UI" { + -re "\r\nContinuing\.\r\n" { + pass $gdb_test_name + } + } } # We're going to kill the gdbserver, but before we do, lets make sure From patchwork Sat Oct 29 07:43:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 59613 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D73E3857805 for ; Sat, 29 Oct 2022 07:44:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D73E3857805 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667029463; bh=B1dxhqMxTut7/MjIBFsPuygBF2tAbb/DZo/5Bwj3vJI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ZTh0IC3tzwbSfyXUBQ+LfYW5Wta+zrwg4ZBZ2BYNgfzxTW/VD60K6OdEusmRaUo8g BP/LwPa9WVCcqYc74u3exbzfK9A5kL4YdEjDPA23E2xUcEHvgjB6rH2dAQdIYTEhb/ ttkuuSqxy5YkqLAGFSyuCXERXWV4SmWCPtMYWOnk= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D3A413858C83 for ; Sat, 29 Oct 2022 07:43:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3A413858C83 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 12C7A1FAD5 for ; Sat, 29 Oct 2022 07:43:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F2A9013AA4 for ; Sat, 29 Oct 2022 07:43:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MF4KOr3ZXGO+VgAAMHmgww (envelope-from ) for ; Sat, 29 Oct 2022 07:43:57 +0000 To: gdb-patches@sourceware.org Subject: [pushed 2/3] [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp with local-remote-host-notty Date: Sat, 29 Oct 2022 09:43:56 +0200 Message-Id: <20221029074357.12305-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221029074357.12305-1-tdevries@suse.de> References: <20221029074357.12305-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.server/multi-ui-errors.exp and host board local-remote-host-notty, I run into: ... (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI Executing on target: kill -9 29666 (timeout = 300) builtin_spawn -ignore SIGHUP kill -9 29666^M echo^M Remote connection closed^M (gdb) (gdb) FAIL: gdb.server/multi-ui-errors.exp: \ main UI, prompt after gdbserver dies (timeout) ... In contrast, with local-remote-host (so, everything the same but editing off): ... (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI Executing on target: kill -9 31245 (timeout = 300) builtin_spawn -ignore SIGHUP kill -9 31245^M Remote connection closed^M (gdb) echo^M (gdb) PASS: gdb.server/multi-ui-errors.exp: main UI, prompt after gdbserver dies ... The test-case issues a kill, which results in a "Remote connection closed" message and a prompt. The problem is that the prompt is not consumed, so the subsequent echo may be issued before that prompt, which causes a mismatch when matching the result of the echo. Fix this by consuming the "Remote connection closed" message and prompt. Tested on x86_64-linux. --- gdb/testsuite/gdb.server/multi-ui-errors.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp index 8a1276fb272..45a2dabbd6c 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.exp +++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp @@ -111,6 +111,14 @@ remote_exec target "kill -9 $gdbserver_pid" # The point is that we should be able to interact with GDB from either # interpreter now. +with_spawn_id $gdb_main_spawn_id { + gdb_test_multiple "" "remote connection closed - main UI" { + -re -wrap "Remote connection closed" { + pass $gdb_test_name + } + } +} + with_spawn_id $gdb_main_spawn_id { gdb_test "echo" "" \ "main UI, prompt after gdbserver dies" From patchwork Sat Oct 29 07:43:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 59614 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1EA3F3857B9C for ; Sat, 29 Oct 2022 07:44:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EA3F3857B9C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667029471; bh=2p6lZvH3Xn6CytcIZVNEqApuj7gB3RoVM597NUnJP4w=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yrim3UpNsNKR29BmgwQ3kwRAooRSGdkWTgQ6DuGmcm4jAtEdRX2Xp9fvMw8rzn4Rw xTR8yyfk2C+QSMl70BmAIDcaRnLeqm5sUzHWGJ33l23gLDqZkSAUtykNOubp7NmhB5 arNHdkPZMGiPY75CJDByC9+IlbyrL20dGqYeAypo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id F41CC3858C52 for ; Sat, 29 Oct 2022 07:43:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F41CC3858C52 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2BBE922772 for ; Sat, 29 Oct 2022 07:43:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 178E513AA4 for ; Sat, 29 Oct 2022 07:43:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gImXBL7ZXGO+VgAAMHmgww (envelope-from ) for ; Sat, 29 Oct 2022 07:43:58 +0000 To: gdb-patches@sourceware.org Subject: [pushed 3/3] [gdb/testsuite] Use ssh -t in remote-*.exp Date: Sat, 29 Oct 2022 09:43:57 +0200 Message-Id: <20221029074357.12305-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221029074357.12305-1-tdevries@suse.de> References: <20221029074357.12305-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When running test-case gdb.server/multi-ui-errors.exp on target board remote-gdbserver-on-localhost.exp, I run into: ... (gdb) PASS: gdb.server/multi-ui-errors.exp: connect to gdbserver continue^M Continuing.^M PASS: gdb.server/multi-ui-errors.exp: continue - extra UI Remote debugging from host ::1, port 35466^M FAIL: gdb.server/multi-ui-errors.exp: ensure inferior is running ... The problem is that the target board uses ssh -T, which fails to guarantee that output from the inferior will be available. Fix this by copying proc ${board}_spawn from local-remote-host.exp, which ensures using ssh -t. [ It would be nice to define an ssh base board to get rid of the copies, but I'm not addressing that in this commit. ] Likewise for target board remote-stdio-gdbserver.exp. Tested on x86_64-linux. --- .../boards/remote-gdbserver-on-localhost.exp | 12 ++++++++++++ gdb/testsuite/boards/remote-stdio-gdbserver.exp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp index 27224d39d0b..dacbbfb6f28 100644 --- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp +++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp @@ -32,6 +32,18 @@ set_board_info protocol standard set_board_info username $env(USER) set_board_info hostname localhost +proc ${board}_spawn { board cmd } { + global board_info + + set remote [board_info $board hostname] + set username [board_info $board username] + set RSH [board_info $board rsh_prog] + + spawn $RSH -t -l $username $remote $cmd + set board_info($board,fileid) $spawn_id + return $spawn_id +} + # We will be using the standard GDB remote protocol set_board_info gdb_protocol "remote" diff --git a/gdb/testsuite/boards/remote-stdio-gdbserver.exp b/gdb/testsuite/boards/remote-stdio-gdbserver.exp index e1a2d0ed007..498526b7870 100644 --- a/gdb/testsuite/boards/remote-stdio-gdbserver.exp +++ b/gdb/testsuite/boards/remote-stdio-gdbserver.exp @@ -78,3 +78,15 @@ proc ${board}_file { dest op args } { } return [eval [list standard_file $dest $op] $args] } + +proc ${board}_spawn { board cmd } { + global board_info + + set remote [board_info $board hostname] + set username [board_info $board username] + set RSH [board_info $board rsh_prog] + + spawn $RSH -t -l $username $remote $cmd + set board_info($board,fileid) $spawn_id + return $spawn_id +}