From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14912 invoked by alias); 2 Oct 2019 13:03:56 -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 14747 invoked by uid 89); 2 Oct 2019 13:03:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=robustness, HX-Languages-Length:1912, awareness, eyes X-HELO: mail-wr1-f68.google.com Received: from mail-wr1-f68.google.com (HELO mail-wr1-f68.google.com) (209.85.221.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Oct 2019 13:03:55 +0000 Received: by mail-wr1-f68.google.com with SMTP id v8so19602477wrt.2 for ; Wed, 02 Oct 2019 06:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/NAThm79wL2ty3SvMCwzQAWh1QL4zrUHpEYGbAQ62qA=; b=SV/dxN2tiiHxju8SQoiN7BxOyihL7lZcVuOT6K2Jv+tic2fjdW3aF8paLQ25h2LKEa 9QLgGuZRSraJPYml3XBR2QGSIWmXipZQLC8aru6ghQoTXvuUGiN14etSwv11mdBDqTQv UjEdO9+CmXJ/CrN0oJpwo77DJIQNdCUHtEsb5NH8+2qwJCOJKLtXdiptmSkgq83kBmtF y42Ky890+fdTV3ZTpPyqidR8rRuOt+HrJhB57v7Hnhkk6R1pFqdtj9jzAgZCLGFQB4p3 9UUVP0qvY9xWplZIjVehk+gdaKeeYH6BuuzTV+zjPBziUVDM/7XeVHLyszmWr20GBa7w WPDg== Return-Path: Received: from localhost (host86-128-12-122.range86-128.btcentralplus.com. [86.128.12.122]) by smtp.gmail.com with ESMTPSA id g185sm8754026wme.10.2019.10.02.06.03.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 06:03:52 -0700 (PDT) Date: Wed, 02 Oct 2019 13:03:00 -0000 From: Andrew Burgess To: Keith Seitz Cc: gdb-patches Subject: Re: [PATCH] gdb/testsuite: Add gdb_test_multiple_name variable Message-ID: <20191002130351.GC4962@embecosm.com> References: <20191001172850.29867-1-andrew.burgess@embecosm.com> <83e83e2a-c0f8-5721-ad76-8b842aaad390@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83e83e2a-c0f8-5721-ad76-8b842aaad390@redhat.com> X-Fortune: I'm EMOTIONAL now because I have MERCHANDISING CLOUT!! X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00058.txt.bz2 * Keith Seitz [2019-10-01 10:41:40 -0700]: > On 10/1/19 10:28 AM, Andrew Burgess wrote: > > After this patch you can now write this: > > > > gdb_test_multiple "print foo" "test foo" { > > -re "expected output 1" { > > pass $gdb_test_multiple_name > > } > > -re "expected output 2" { > > fail $gdb_test_multiple_name > > } > > } > > OMG, why didn't *I* think of that!?! > > > The $gdb_test_multiple_name is setup by gdb_test_multiple, and cleaned > > up once the test has completed. Nested calls to gdb_test_multiple are > > supported, though $gdb_test_multiple_name will only ever contain the > > inner most test message (which is probably what you want). > > Your patch looks good to me (but I am not a maintainer), but I wanted to > ask if you considered using a stack to more robustly solve the nesting > problem? It might be unnecessary today -- even overkill -- but I > would think it is much easier on the eyes. Is your suggestion that we maintain a separate global test name stack and push/pop the latest test name to the stack? This would have the advantage that a nested action element could access the names of outer scopes, but this feels to me like something that would be both a pretty rare requirement, and something that can easily be solved by the user setting up some global variables as needed. On the question of robustness, I'd be interested to know if you've spotted a possible bug. My intention is that the TCL program stack should serve to backup any existing value of gdb_test_multiple_name, so there should never be a case where we have the wrong test name in place. Thanks, Andrew > > We have such support in the test suite already. See > testsuite/lib/data-structures.exp. [I am not suggesting any > changes, just trying to raise awareness for ::Stack et al usage > in the test suite.] > > Keith