From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 90C51382DE2E; Thu, 27 Oct 2022 14:53:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90C51382DE2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666882428; bh=wEnQ9wWftikR2y0+e6KuOWPjh+70B+s6Jzupbw3V0gk=; h=From:To:Subject:Date:From; b=sBOUt60SzQPjwcKHFAvslpn7mUDmtbF8AHN9QAVpX5ujJ6JGSIKB1GFZC80Ve9iXz WOf8WoamL4Q8TyAzxM6A8BxjCduk88JqSWf+uhVsP8eaDT8o1oBRqreWm/W631BdAP jwSx0l76HKEVQrCAkz61XpAQkzyP/CmxxT7L0kFU= 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 silent timeouts in gdb.mi/mi-exec-run.exp with remote host X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: b253899c901fed0ff56b2746945ffc824e412b81 X-Git-Newrev: 6b839dd3deea4de278ebd862edb9c91d335d63e2 Message-Id: <20221027145348.90C51382DE2E@sourceware.org> Date: Thu, 27 Oct 2022 14:53:48 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6b839dd3deea= 4de278ebd862edb9c91d335d63e2 commit 6b839dd3deea4de278ebd862edb9c91d335d63e2 Author: Tom de Vries Date: Thu Oct 27 16:53:12 2022 +0200 [gdb/testsuite] Fix silent timeouts in gdb.mi/mi-exec-run.exp with remo= te host =20 I noticed that running test-case gdb.mi/mi-exec-run.exp with host board local-remote-host.exp takes about 44 seconds. =20 I found two silent timeouts responsible for this. =20 The first is in mi_gdb_exit, where we have: ... if { [is_remote host] && [board_info host exists fileid] } { send_gdb "999-gdb-exit\n" gdb_expect 10 { -re "y or n" { send_gdb "y\n" exp_continue } -re "Undefined command.*$gdb_prompt $" { send_gdb "quit\n" exp_continue } -re "DOSEXIT code" { } } } ... so in gdb.log we see: ... 999-gdb-exit^M 999^exit^M =3Dthread-exited,id=3D"1",group-id=3D"i1"^M =3Dthread-group-exited,id=3D"i1"^M ... after which expect just waits for the timeout. =20 Fix this by adding a gdb_expect clause to parse the exit: ... -re "\r\n999\\^exit\r\n" { } ... =20 Note that we're not parsing the thread-exited/thread-group-exited messa= ges, because they may not be present: ... $ gdb -i=3Dmi =3Dthread-group-added,id=3D"i1" (gdb) 999-gdb-exit 999^exit $ ... =20 After fixing that, we have: ... (gdb) ^M saw mi error PASS: gdb.mi/mi-exec-run.exp: inferior-tty=3Dseparate: mi=3Dseparate: \ force-fail=3D1: run failure detected quit^M &"quit\n"^M ... =20 What seems to be happening is that default_gdb_exit sends a cli interpr= eter quit command to an mi interpreter, after which again expect just waits = for the timeout. =20 Fix this by adding mi_gdb_exit to the end of the test-case, as in many = other gdb.mi/*.exp test-cases. =20 After these two fixes, the test-case takes about 4 seconds. =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/gdb.mi/mi-exec-run.exp | 2 ++ gdb/testsuite/lib/mi-support.exp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi= -exec-run.exp index 3b373b2c84d..01f52e22578 100644 --- a/gdb/testsuite/gdb.mi/mi-exec-run.exp +++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp @@ -180,3 +180,5 @@ foreach_with_prefix inferior-tty {"main" "separate"} { } } } + +mi_gdb_exit diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index e537d3b546b..b11457693be 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -83,7 +83,7 @@ proc mi_uncatched_gdb_exit {} { exp_continue } -re "DOSEXIT code" { } - default { } + -re "\r\n999\\^exit\r\n" { } } }