From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47688 invoked by alias); 2 Aug 2017 15:43:09 -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 47676 invoked by uid 89); 2 Aug 2017 15:43:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Hes, He's, installs, vary X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Aug 2017 15:43:07 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B77757C844; Wed, 2 Aug 2017 15:43:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B77757C844 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-116-95.phx2.redhat.com [10.3.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 851C77F775; Wed, 2 Aug 2017 15:43:05 +0000 (UTC) Subject: Re: [PATCH 0/2] Python testcases to check DWARF output To: Pierre-Marie de Rodat , gcc-patches@gcc.gnu.org References: <20170726160040.6516-1-derodat@adacore.com> From: Jeff Law Message-ID: Date: Wed, 02 Aug 2017 15:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170726160040.6516-1-derodat@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00189.txt.bz2 On 07/26/2017 10:00 AM, Pierre-Marie de Rodat wrote: > Hello, > > At the last GNU Cauldron, Richard Biener and I talked about DWARF output > testing. Except for guality tests, which are disabled on several > targets, the only way tests check the DWARF is scanning the annotated > assembly (-dA), making it hard to write reliable tests. > > For instance, checking the number of times DW_AT_location is present in > order to check that some specific variable is assigned one is fuzzy. > Depending on the target and on the evolution of the compiler, the number > of output variables, or which one is assigned a location can vary > legitimately but still make the test fail. > > On my side, I already had written an out-of-tree testsuite for the DWARF > features I added for Ada. This testsuite uses a DWARF parser in order to > perform checks on a tree: > . I had to update it > a couple of times, for instance when a change created a > DW_TAG_const_type DIE or removed one somewhere in a type tree, but > that’s very rare. I would say that I’m satisfied with the checks I could > express, but I don’t remember I ever caught a regression with them, so I > have no representative experience to share in this area. Maybe DWARF > back-end developpers do a too good job. ;-) > > Anyway, Richard and I discussed about doing something similar in-tree, > and here is a candidate set of patches to achieve that: > > * The first patch installs DejaGNU scripts to run a Python interpreter > in testcases. > > * The second one installs other DejaGNU scripts to detect DWARF > dumping tools, plus a small Python library to parse and pattern > match DIEs and their attributes. It also adds several C and Ada > tests as examples; these are inspired by existing homonym tests > based on assembly scanning. > > For now, this supports only platforms where objdump is available for the > current target, but extending it to other tools, such as otool on Darwin > should be doable. > > I would appreciate feedback about the idea and the implementation I > propose. This is the first time I do more in the testsuite than just > adding new tests, so thank you in advance for you patience in reviewing > these. :-) > > I tested these patches on x86_64-linux. I hate to throw in a wrench at this point, but has anyone looked at dwgrep from Petr Machata? He's not doing much with it anymore, but it might provide enough of a dwarf scanning framework to be useful for testing purposes. jeff