From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 085783858C50; Wed, 23 Mar 2022 14:47:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 085783858C50 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: faf5e6ace8c6f82e11ad40393f531123515ce3e6 X-Git-Newrev: b24ae11cd432684feb5ed73f215a36ac89023085 Message-Id: <20220323144756.085783858C50@sourceware.org> Date: Wed, 23 Mar 2022 14:47:56 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2022 14:47:56 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db24ae11cd432= 684feb5ed73f215a36ac89023085 commit b24ae11cd432684feb5ed73f215a36ac89023085 Author: Andrew Burgess Date: Tue Mar 22 10:23:26 2022 +0000 gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp =20 The gdb.mi/mi-multi-commands.exp test was added in commit: =20 commit d08cbc5d3203118da5583296e49273cf82378042 Date: Wed Dec 22 12:57:44 2021 +0000 =20 gdb: unbuffer all input streams when not using readline =20 And then tweaked in commit: =20 commit 144459531dd68a1287905079aaa131b777a8cc82 Date: Mon Feb 7 20:35:58 2022 +0000 =20 gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp = test =20 The second of these commits was intended to address periodic test failures that I was seeing, and this change did fix some problems, but, unfortunately, introduced other issues. =20 The problem is that the test relies on sending two commands to GDB in a single write. As the characters that make these two commands arrive they are echoed to GDB's console. However, there is a race between how quickly the characters are echoed and how quickly GDB decides to act on the incoming commands. =20 Usually, both commands are echoed in full before GDB acts on the first command, but sometimes this is not the case, and GDB can execute the first command before both commands are fully echoed to the console. In this case, the output of the first command will be mixed in with the echoing of the second command. =20 This mixing of the command echoing and the first command output is what was causing failures in the original version of the test. =20 The second commit relaxed the expected output pattern a little, but was still susceptible to failures, so this commit further relaxes the pattern. =20 Now, we look for the first command output with no regard to what is before, or after the command. Then we look for the first mi prompt to indicate that the first command has completed. =20 I believe that this change should make the test more stable than it was before. Diff: --- gdb/testsuite/gdb.mi/mi-multi-commands.exp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb= .mi/mi-multi-commands.exp index 12b1b482f9a..d00e0aaea8b 100644 --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp @@ -100,9 +100,12 @@ proc run_test { args } { set seen_second_message false =20 gdb_test_multiple "" "look for first command output, command length $i" -= prompt "$mi_gdb_prompt" { - -re "\\^done,value=3D\"\\\\\"FIRST COMMAND\\\\\"\"\r\n" { - pass $gdb_test_name + -re "\\^done,value=3D\"\\\\\"FIRST COMMAND\\\\\"\"" { set seen_first_message true + exp_continue + } + -re "\r\n$mi_gdb_prompt" { + gdb_assert $seen_first_message $gdb_test_name } }