From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69734 invoked by alias); 24 Dec 2017 14:47:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69720 invoked by uid 89); 24 Dec 2017 14:47:41 -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,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2582, day X-HELO: mail-pf0-f176.google.com Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Dec 2017 14:47:39 +0000 Received: by mail-pf0-f176.google.com with SMTP id u25so17133111pfg.5 for ; Sun, 24 Dec 2017 06:47:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KYFzBMrvNTHENoM3/MGlG0Ch6vt5jn0DhHo35880Jj8=; b=O6OcSHkyp3YXphGPaMaatvtB8mZHW4AaKIr594cQ3uT9qPzVsxNnm1VHMucq4Inhzo uRihLhXXIjuZcspSdZzyM9kiczPG+mqSJJsE0G07OxxZWDdotxlgOTEQNNwDkymaTUTl J2yX2+UehxnqHXk6Oz2zAUJMnDMmeCXS38elffIN26EQuOpQoOcj6wC7P7yyZGSysdMk UeNI7mOpS0nmOJv70zTgnuKcNUPbWxNCGd8htJASqVwybZtIBPes/aebOvIiW/FpE1jg E0qwvG2rco0Can2onMACk8PIQ4tokJnUcQ6CFvuuT/+NqRlOPeXlldvmrFDodlq3c7pI oHPA== X-Gm-Message-State: AKGB3mKCR+GhpEJNnn4HPuSoOXefWDoS2+/gfIajbErhQDM8HOf8Yt/v V0qEj9QBTsxJNg7tmQJ7XIwD391E X-Google-Smtp-Source: ACJfBosKa+jVyYeLpLIixlWtVb1/SfAlpIAObVfEiPKF+4H9FwfPaBzrKR4o4M0ma84xTbzDb8E16w== X-Received: by 10.98.218.24 with SMTP id c24mr20443427pfh.143.1514126858015; Sun, 24 Dec 2017 06:47:38 -0800 (PST) Received: from localhost (g194.124-44-10.ppp.wakwak.ne.jp. [124.44.10.194]) by smtp.gmail.com with ESMTPSA id e9sm23564688pgc.15.2017.12.24.06.47.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Dec 2017 06:47:37 -0800 (PST) Date: Sun, 24 Dec 2017 14:47:00 -0000 From: Stafford Horne To: Simon Marchi Cc: GDB patches , Openrisc Subject: Re: [PATCH v3 1/4] reggroups: Add test and docs for `info reg $reggroup` feature Message-ID: <20171224144734.GF32243@lianli.shorne-pla.net> References: <20171219142257.13402-1-shorne@gmail.com> <20171219142257.13402-2-shorne@gmail.com> <00b5d74739aced5252fd0a035397b11f@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00b5d74739aced5252fd0a035397b11f@polymtl.ca> User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00491.txt.bz2 On Wed, Dec 20, 2017 at 09:58:45PM -0500, Simon Marchi wrote: > On 2017-12-19 09:22, Stafford Horne wrote: > > Until now this feature has existed but was not documented. Adding docs > > and tests. > > ... > > +proc fetch_reggroups {test} { > > + global gdb_prompt > > + global expect_out > > + > > + set reggroups {} > > + gdb_test_multiple "maint print reggroups" "get reggroups" { > > + -re "maint print reggroups\r\n" { > > + exp_continue > > + } > > + -re "^ Group\[ \t\]+Type\[ \t\]+\r\n" { > > + exp_continue > > + } > > + -re "^ (\[0-9a-zA-Z\-\]+)\[ \t\]+(user|internal)\[ \t\]+\r\n" { > > + lappend reggroups $expect_out(1,string) > > + exp_continue > > + } > > + -re ".*$gdb_prompt $" { > > The .* should not be necessary here. OK. > > + if { [llength $reggroups] != 0 } { > > + pass $test > > + } else { > > + fail "$test - didn't fetch any reggroups" > > + } > > + } > > + } > > + > > + return $reggroups > > +} > > + > > +set reggroups [fetch_reggroups "fetch reggroups"] > > + > > +foreach reggroup $reggroups { > > + gdb_test "info reg $reggroup" ".*" "info reg $reggroup" > > +} > > This doesn't really test anything. If you change the line to > > gdb_test "info reg hello$reggroup" ".*" "info reg $reggroup" > > to fake that the command doesn't work, the test still passes. So if > something breaks the feature of "info registers" handling reg groups, the > test won't catch it. But I understand the problem, the output is not really > predictable. I thought about matching at least one $hex number, but it's > not even guaranteed (some groups like mmx output nothing). > > What we could do (I'm open to better suggestions) is at least validate that > it doesn't output "Invalid register", which is the message given when > passing a register that doesn't exist. But then, if that message changes > one day for some reason, the test will become moot again (because GDB will > output something else than "Invalid register" if the functionality breaks, > but the test won't catch it). So in addition, we could also validate that > "info registers a_non_existent_register" does output "Invalid register". > This way, if some GDB developers of the future change the message, the test > will fail, they will go look at your test file, read the comment that you > will have left, and update the test accordingly. Right, I will do this. I will also try to match at least one $hex number accross all reggroups. Some will be blank, but if all are blank its probably an issue. -Stafford