From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50669 invoked by alias); 26 Jul 2017 16:16:06 -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 49908 invoked by uid 89); 26 Jul 2017 16:15:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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, 26 Jul 2017 16:15:20 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A34487C852; Wed, 26 Jul 2017 16:15:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A34487C852 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=dmalcolm@redhat.com Received: from ovpn-116-58.phx2.redhat.com (ovpn-116-58.phx2.redhat.com [10.3.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B91E692B1; Wed, 26 Jul 2017 16:15:10 +0000 (UTC) Message-ID: <1501085709.10760.49.camel@redhat.com> Subject: Re: [PATCH 0/2] Python testcases to check DWARF output From: David Malcolm To: Pierre-Marie de Rodat , gcc-patches@gcc.gnu.org Date: Wed, 26 Jul 2017 16:16:00 -0000 In-Reply-To: <20170726160040.6516-1-derodat@adacore.com> References: <20170726160040.6516-1-derodat@adacore.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg01682.txt.bz2 On Wed, 2017-07-26 at 18:00 +0200, 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. :-) (FWIW I'm a big fan of Python, so am happy to see this proposal) > I tested these patches on x86_64-linux. Which version of Python did you test against? As far as I can see you've coded this using the common subset of Python 2 and Python 3; it's worth spelling out what the assumptions are in this regard (and what the minimum versions are). Dave