From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YBe1Bwf1TGFCIwAAWB0awg (envelope-from ) for ; Thu, 23 Sep 2021 17:43:35 -0400 Received: by simark.ca (Postfix, from userid 112) id 0CDAE1EE25; Thu, 23 Sep 2021 17:43:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5E8DE1EE14 for ; Thu, 23 Sep 2021 17:43:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD2883857C4A for ; Thu, 23 Sep 2021 21:43:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD2883857C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632433413; bh=BaGsTQIJpYZp3j1iu4vQf/Qlavw0vxLQYOaPV6BaJDw=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rao7XyxxCVQPT1jQnjWR32ldJ945983gLvf7H685lrdbaPzOlOw9XAsaCK9Orm7OO uQ6MzQWTTztJymqOlFedv4Lv1RCRg+H9hjf/j6lzKS1iB6IEr5NiD7AU2sGRCnbi/v zvodJJJDlPMIVnDdFaRIkUBhuhv5eN+0tlS/dCG4= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 741783858D34 for ; Thu, 23 Sep 2021 21:43:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 741783858D34 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-out1.suse.de (Postfix) with ESMTPS id AF3F5223F3; Thu, 23 Sep 2021 21:43:14 +0000 (UTC) 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 93CB813EAD; Thu, 23 Sep 2021 21:43:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id NPrpIvL0TGFpMAAAMHmgww (envelope-from ); Thu, 23 Sep 2021 21:43:14 +0000 Subject: Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable To: Simon Marchi , gdb-patches@sourceware.org References: <20210917224909.GA15407@delia> <5b995a81-afd0-adbb-1639-b1aecfa4d8e7@polymtl.ca> Message-ID: <13a04bcb-6842-a5ce-5457-ed4510a0a79b@suse.de> Date: Thu, 23 Sep 2021 23:43:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <5b995a81-afd0-adbb-1639-b1aecfa4d8e7@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 9/23/21 5:12 PM, Simon Marchi wrote: > On 2021-09-17 6:49 p.m., Tom de Vries via Gdb-patches wrote: >> Hi, >> >> I noticed a pattern: >> ... >> if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { >> return -1 >> } >> >> foreach var {a b} { >> clean_restart ${binfile} >> ... >> } >> ... >> >> In this case, gdb is restarted three times, while it's only necessary two >> times. >> >> Fix this by replacing prepare_for_testing with build_executable. >> >> I wrote a script that attempts this tranformation on each test-case (only the >> per-test part shown here): >> ... >> cd $build >> make check RUNTESTFLAGS=$test >> sum=$build/testsuite/gdb.sum >> if ! grep -q "expected passes" $sum; then >> echo skipping $test >> return >> fi >> >> grep ^# $sum > ref.txt >> sed -i 's/prepare_for_testing/build_executable/' $src/$test >> make check RUNTESTFLAGS=$test >> >> grep ^# $sum > mod.txt >> if cmp ref.txt mod.txt; then >> return >> else >> ( cd $src; git ch -f $test ) >> fi >> ... >> >> This patch is the result of running the script on all test-cases, minus the >> cases where prepare_for_testing was used in a comment. Touches 76 test-cases. > > I didn't check all changes, but I agree with the idea of the patch. Good to hear. I've reviewed all changes once more. I found a problem in cpp-linkage-name.exp. The test passes, but the gdb commands execute on a lingering gdb instance started by function_range, so I had to fix that first (by adding gdb_exit at the end of function_range) to trigger the FAIL introduced by the script. I've removed the change in that test-case, and similar cases, and am currently retesting. Thanks, - Tom