public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
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	[thread overview]
Message-ID: <20221029074357.12305-3-tdevries@suse.de> (raw)
In-Reply-To: <20221029074357.12305-1-tdevries@suse.de>

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"
-- 
2.35.3


  parent reply	other threads:[~2022-10-29  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29  7:43 [pushed 0/3] [gdb/testsuite] Various fixes for gdb.server/multi-ui-errors.exp Tom de Vries
2022-10-29  7:43 ` [pushed 1/3] [gdb/testsuite] Consume output asap in gdb.server/multi-ui-errors.exp Tom de Vries
2022-10-29  7:43 ` Tom de Vries [this message]
2022-10-29  7:43 ` [pushed 3/3] [gdb/testsuite] Use ssh -t in remote-*.exp Tom de Vries

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=20221029074357.12305-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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).