From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 508963858418 for ; Fri, 4 Nov 2022 16:10:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 508963858418 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.42.100] (modemcable092.73-163-184.mc.videotron.ca [184.163.73.92]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9F6351E0D3; Fri, 4 Nov 2022 12:10:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1667578217; bh=ZrVW7LloY1EB5ISEovwiQxZiqFQt3JAJRbcrM0jnC5s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=NLB5Vt4N6VpeD5p/4+6RxEcyIDmqOjGr+N4dmUvwKUWeHOhfPQYeKttjC6PJpadpd iXMEL0T//FfkH0+U00azaZAGUhOc/ze3Rx/a8AUuWOM3isdEkKTIUA9n30cUpRBT4/ FAzHJ9AuI4OsT8f54pNTZJ/1Zg627CrnxL4VECd4= Message-ID: <6dab4cb2-c1d5-35d3-a295-9c8a5b4927d8@simark.ca> Date: Fri, 4 Nov 2022 12:10:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach Content-Language: fr To: Lancelot SIX , gdb-patches@sourceware.org Cc: lsix@lancelotsix.com References: <20221104155703.756252-1-lancelot.six@amd.com> From: Simon Marchi In-Reply-To: <20221104155703.756252-1-lancelot.six@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,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/4/22 11:57, Lancelot SIX via Gdb-patches wrote: > One test name in gdb.base/dlmopen.exp changes from run to run > since it includes a process id: > > PASS: gdb.base/dlmopen.exp: attach 3442682 > > This is not convenient do diff gdb.sum files to compare test runs. > > Fix by using gdb_attach helper function to handle attaching to the > process as it produce a constant test name. > > While at it also check gdb_attach's return value to only run the > rest of the test if the attach was successful. > --- > gdb/testsuite/gdb.base/dlmopen.exp | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp > index a80db75f9ac..9a2c9d78636 100644 > --- a/gdb/testsuite/gdb.base/dlmopen.exp > +++ b/gdb/testsuite/gdb.base/dlmopen.exp > @@ -159,16 +159,16 @@ set test_spawn_id [spawn_wait_for_attach $binfile] > set testpid [spawn_id_get_pid $test_spawn_id] > > # Attach. > -gdb_test "attach $testpid" "Attaching to program.*, process $testpid.*" > +if { [gdb_attach $testpid] } { > + with_test_prefix "attach" { > + # Remove the pause. We no longer need it. > + gdb_test "print wait_for_gdb = 0" "\\\$1 = 0" I would prefer doing an early return: if { ![gdb_attach $testpid] } { return } ... just because it keeps the following code at the original column. But regardless: Approved-By: Simon Marchi Simon