From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id D6A86385843D; Sat, 29 Oct 2022 07:43:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6A86385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667029421; bh=/zmaSLMHTSs84cLICzhhgOr5yXwlrOZXlp2wDqEtdBU=; h=From:To:Subject:Date:From; b=NbDe/uY6Ei3t3GJDRGi5AbGILfEvyG4T+Lk9UYIErYFR+/JEx+vLydV7P3WfjeCAM sXZ8H6wOzB2+Xm/jCXjdXqrCcJ+rXtr9fqiwBHERYPq1HvWueaGIjxHDOFj/lfl5mH g3DrYMe90ebQWsjeMBaImiNbmjU8uF87fCALkRZE= 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 gdb.server/multi-ui-errors.exp with local-remote-host-notty X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 64ba0c58a79bdec307b722cc09aab724d34ba28b X-Git-Newrev: 8db6f1bd27086c9623e2b8eb8d01bc4c0a863ca7 Message-Id: <20221029074341.D6A86385843D@sourceware.org> Date: Sat, 29 Oct 2022 07:43:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D8db6f1bd2708= 6c9623e2b8eb8d01bc4c0a863ca7 commit 8db6f1bd27086c9623e2b8eb8d01bc4c0a863ca7 Author: Tom de Vries Date: Sat Oct 29 09:43:32 2022 +0200 [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp with local-remote-ho= st-notty =20 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 =3D 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) ... =20 In contrast, with local-remote-host (so, everything the same but editin= g off): ... (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI Executing on target: kill -9 31245 (timeout =3D 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 gdbse= rver dies ... =20 The test-case issues a kill, which results in a "Remote connection clos= ed" message and a prompt. =20 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 re= sult of the echo. =20 Fix this by consuming the "Remote connection closed" message and prompt. =20 Tested on x86_64-linux. Diff: --- 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/g= db.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. =20 +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"