From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66073 invoked by alias); 8 Jun 2016 00:23:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 66048 invoked by uid 89); 8 Jun 2016 00:23:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4382, favorite, our, white X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Jun 2016 00:23:31 +0000 Received: from ball (CPE00fc8d3ff2d3-CM00fc8d3ff2d0.cpe.net.cable.rogers.com [99.242.1.93]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 9FDA9C0B9; Wed, 8 Jun 2016 00:23:28 +0000 (UTC) Date: Wed, 08 Jun 2016 00:23:00 -0000 From: Trevor Saunders To: David Malcolm Cc: Jakub Jelinek , Bernd Schmidt , gcc-patches@gcc.gnu.org, Bernd Schmidt , Jeff Law Subject: Re: [PATCH] Selftest framework (v7) Message-ID: <20160608002034.GA22681@ball> References: <5750BF79.20201@redhat.com> <1464981166-25871-1-git-send-email-dmalcolm@redhat.com> <57540F16.8050504@t-online.de> <1465222628.11895.58.camel@redhat.com> <20160606215350.GB29668@ball> <20160606215749.GK7387@tucnak.redhat.com> <20160607021331.GA3115@ball> <1465309112.11895.108.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465309112.11895.108.camel@redhat.com> User-Agent: Mutt/1.6.0 (2016-04-01) X-SW-Source: 2016-06/txt/msg00528.txt.bz2 On Tue, Jun 07, 2016 at 10:18:32AM -0400, David Malcolm wrote: > On Mon, 2016-06-06 at 22:14 -0400, Trevor Saunders wrote: > > On Mon, Jun 06, 2016 at 11:57:49PM +0200, Jakub Jelinek wrote: > > > On Mon, Jun 06, 2016 at 05:53:50PM -0400, Trevor Saunders wrote: > > > > > > As far as I can > > > > > > tell this just involves moving the start of namespace > > > > > > selftest > > > > > > upwards a > > > > > > bit in the files where we have tests. > > > > > > > > > > Yes, and it does seem cleaner to have all of the selftest code > > > > > start > > > > > like this: > > > > > > > > > > #if CHECKING_P > > > > > > > > What are we gaining by ifdefing this? I would think on reasonable > > > > systems the compiler would optimize out the call to the selftests > > > > in > > > > release builds and then the linker would gc all the unused > > > > functions. > > > > Do we really care about code size in places that doesn't happen > > > > enough > > > > to go through this? > > > > > > Not everyone is building the compiler with LTO, and if you don't, > > > then > > > how would you optimize that away? > > > > -ffunction-sections -Wl,--gc-sections should be enough I think. I > > guess > > we don't use those at the moment though. > > > > > And yes, not having the self-tests, especially if they are going to > > > grow > > > further, in release compilers is desirable, especially if it would > > > be > > > intermixed with hot code. > > > > That's fair, though turning on --gc-sections where we can should > > further > > help with that, and that should be more effective with > > -ffunction-sections -fdata-sections, so its seems to me like the > > right > > thing to do is add configure tests to enable those? And then its > > more > > of a non issue? > > I appreciate that you'd done a lot of work on eliminating preprocessor > use in gcc, and that we'd prefer to minimize the amount of #if code we > have - though it's relatively easy to test the with/without #if > CHECKING_P case (compared to all of the various target-specific > macros). yeah, I certainly agree CHECKING_P is one of the more defensable macros. > Historically gcc testing has largely been "black box" testing: run the > built programs with specific inputs and look for specific outputs. My > hope with -fself-tests is that we can build up our "white box" test > coverage to complement the above, with unit tests. My favorite example > is the testing for gengtype that I posted as a followup, which gives us > some immediate test coverage that gengtype is working as expected, > which is hard to do using our traditional approach to testing. I'd probably say testing hash tables / vec is more useful, but whatever ;) > I hope that we can add a lot more tests to -fself-test, in particular, > I want us to have unit tests for hot code, including code that's hidden > deep inside the implementation and that might normally get inlined > away. To play Devil's Advocate: if we find we're able to do a release > build with the selftests enabled and that it isn't slowing down the > release build, does that imply we need more unit tests for our hottest > code? (the counterargument being that the checked build still needs to > run in a bearable amount of time). by enabled do you mean we build the code or actually run the tests on every compile? I would think basically any tests are two slow for the latter. For the former I would say building the self test code should have very little effect on performance since its all separate functions. There's some of course because of call sites effecting inlining etc, but we can probably minimize that with -ffunction-sections --gc-sections and attribute cold? > That said, I want -fself-test to always run quickly (e.g. less than a > second); let's not put anything slow in there. Also, any unit tests > involving analyzing several gimple or RTL statements at once seem to be > easier to do via the gimple and RTL frontends that Prasad and I are > working on respectively. (I think we can use -fself-test for unit > -testing implementation details of passes that involve one statement at > a time, but as soon as we start dealing with multiple statements and > control flow, that it's probably better to express it using a > gimple/RTL dump in DejaGnu form). That makes sense. Trev > > > Hope the above sounds sane > Dave