From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 0A7373858D1E for ; Tue, 29 Nov 2022 16:21:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A7373858D1E 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 053B91F749; Tue, 29 Nov 2022 16:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669738888; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l81LNLo/lI7ZDMUSgzyLg9H1aBQlNLENmcz7OEvTMcc=; b=mIg065fwoECt7XwUyix3NeYKhSMT+HgfIYuOFXDOoLfW0VTy9BuNkn8iEsxERQEfRlmt27 /Ln4AA7UejABatWb3+/bzs1/M3SJj6en2C2Y4/yAkuOj2eWv/GB2m1uv98Rg3660XOT7lB HYWVREqcoaZlOd3vRCS+NK5xY1xt5Pc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669738888; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l81LNLo/lI7ZDMUSgzyLg9H1aBQlNLENmcz7OEvTMcc=; b=DkyxmFLBEKjzlwGUhSvt+6AHjCjCI0W2iHRLzT5vsTdPlNb7emfx0vyr62DuJvs+OuXOeD HC3Ca/2ci2xTNUDg== 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 D537613428; Tue, 29 Nov 2022 16:21:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 03s1MocxhmPeEQAAMHmgww (envelope-from ); Tue, 29 Nov 2022 16:21:27 +0000 Message-ID: <31f19abf-7924-48da-e4ac-49f5c12ccccb@suse.de> Date: Tue, 29 Nov 2022 17:21:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: =?UTF-8?Q?Re=3a_=5bPATCH_1/2=5d_gdb/testsuite=3a_make_gdb=5ftest=5f?= =?UTF-8?Q?multiple_return_immediately_if=c2=a0send=5fgdb_fails?= Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org Cc: Simon Marchi References: <20221122155546.599061-1-simon.marchi@efficios.com> From: Tom de Vries In-Reply-To: <20221122155546.599061-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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: On 11/22/22 16:55, Simon Marchi via Gdb-patches wrote: > From: Simon Marchi > > In the failure seen by Philippe here: > > https://inbox.sourceware.org/gdb-patches/20221120173024.3647464-1-philippe.waroquiers@skynet.be/ > > ... the testsuite only outputs PASSes, and an ERROR, resulting from an > uncaught exception. This is a bit sneaky, because ERRORs are not > reported in the test summary. In certain circumstances, it can be easy > to miss. > > Normally, gdb_test_multiple outputs an UNRESOLVED when GDB crashes. But > this is only if it manages to send the command, and it's that command > that crashes GDB. Here, the ERROR is due to the fact that GDB had > already crashed by the time we entered gdb_test_multiple and tried to > send a command. GDB was crashed by the previous "file" command, sent by > gdb_unload. Because gdb_unload uses bare expect, it didn't record a > test failure when crashing GDB (this will be addressed separately). > > In this patch, I propose to make gdb_test_multiple call unresolved > directly and return -1 send_gdb fails. This way, if GDB is already > crashed by the time we enter gdb_test_multiple, it will leave a trace in > the test results in the form of an UNRESOLVED. It will also spare us of spare us of the -> spare us the ? > the not-so-useful-in-my-opinion TCL backtrace. > Agreed. > Before, it looks like: > > ERROR: Couldn't send python print(objfile.filename) to GDB. > ERROR: : spawn id exp9 not open > while executing > "expect { > -i exp9 -timeout 10 > -re ".*A problem internal to GDB has been detected" { > fail "$message (GDB internal error)" > gdb_internal_error..." > ("uplevel" body line 1) > invoked from within > "uplevel $body" NONE : spawn id exp9 not open > > And after: > > Couldn't send python print(objfile.filename) to GDB. > UNRESOLVED: gdb.python/py-objfile.exp: objfile.filename after objfile is unloaded > LGTM, thanks for doing this. Thanks, - Tom > Change-Id: I72af8dc0d687826fc3f76911c27a9e5f91b677ba > --- > gdb/testsuite/lib/gdb.exp | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 7d05fbe557bb..fcd54c88f251 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -1161,7 +1161,9 @@ proc gdb_test_multiple { command message args } { > if { $foo < [expr $len - 1] } { > set str [string range "$string" 0 $foo] > if { [send_gdb "$str"] != "" } { > - perror "Couldn't send $command to GDB." > + verbose -log "Couldn't send $command to GDB." > + unresolved $message > + return -1 > } > # since we're checking if each line of the multi-line > # command are 'accepted' by GDB here, > @@ -1180,7 +1182,9 @@ proc gdb_test_multiple { command message args } { > } > if { "$string" != "" } { > if { [send_gdb "$string"] != "" } { > - perror "Couldn't send $command to GDB." > + verbose -log "Couldn't send $command to GDB." > + unresolved $message > + return -1 > } > } > }