From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 27858388B6B7 for ; Thu, 27 Oct 2022 14:54:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 27858388B6B7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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 BED761F8E5 for ; Thu, 27 Oct 2022 14:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666882450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q44dFScsawC37PfajtDnrwqRvz3PWaMbuvi5YZbbJ9M=; b=zcmNfBdkOCf+ml7jsMPvKdQskcKWwtdfB7Md8kmqUq3A15TpBMcOIH3WLiHOWHe2gIyOL/ 7AbED7EDuaLiD0BHEOqVU/akB6Jg2arm377je8cHiPUNSgmzipYnfnUpIk91kNzGPxJhoq 2JwG8+HrgaZ/DXS+9bM86v8Gnx997tA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666882450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q44dFScsawC37PfajtDnrwqRvz3PWaMbuvi5YZbbJ9M=; b=m6Alp1JSWujfR3WMk6GG+DTjavpCsUHhrIDbYwFHrByvF8hTGyP3oydqYToCIhWsyIW++8 hWmP+QI/DcFgSBBw== 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 ACC0713A5C for ; Thu, 27 Oct 2022 14:54:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mA41KZKbWmPTHwAAMHmgww (envelope-from ) for ; Thu, 27 Oct 2022 14:54:10 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 2/3] [gdb/testsuite] Fix silent timeouts in gdb.mi/mi-exec-run.exp with remote host Date: Thu, 27 Oct 2022 16:54:09 +0200 Message-Id: <20221027145410.22466-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221027145410.22466-1-tdevries@suse.de> References: <20221027145410.22466-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,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 List-Id: I noticed that running test-case gdb.mi/mi-exec-run.exp with host board local-remote-host.exp takes about 44 seconds. I found two silent timeouts responsible for this. 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 =thread-exited,id="1",group-id="i1"^M =thread-group-exited,id="i1"^M ... after which expect just waits for the timeout. Fix this by adding a gdb_expect clause to parse the exit: ... -re "\r\n999\\^exit\r\n" { } ... Note that we're not parsing the thread-exited/thread-group-exited messages, because they may not be present: ... $ gdb -i=mi =thread-group-added,id="i1" (gdb) 999-gdb-exit 999^exit $ ... After fixing that, we have: ... (gdb) ^M saw mi error PASS: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: \ force-fail=1: run failure detected quit^M &"quit\n"^M ... What seems to be happening is that default_gdb_exit sends a cli interpreter quit command to an mi interpreter, after which again expect just waits for the timeout. Fix this by adding mi_gdb_exit to the end of the test-case, as in many other gdb.mi/*.exp test-cases. After these two fixes, the test-case takes about 4 seconds. Tested on x86_64-linux. --- 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-support.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" { } } } -- 2.35.3