From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103023 invoked by alias); 27 Feb 2020 16:03:43 -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 103012 invoked by uid 89); 27 Feb 2020 16:03:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=alternatively X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 16:03:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582819420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R4IpmORzf4YRitfECekNy/hDxhcIGpJEmO9SS6h7EK4=; b=Ev65vJEk4X+l2KexG8aJxnCCm0E/LgnSPE0DjLePCI8M2BuiBsDLHdKt/vg6UN3SHk0BmT sYbkDv330l3dEJURzKsgFFJj3OSZybqnXrU9Xrf05UlGqf7s7KDEBnTSBuTGVgo6Y0nEN1 YnLZDrZEfiQ8j6tdGzeMKlIzrquceA8= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-63jxobB9MNi6lv6tazPzrQ-1; Thu, 27 Feb 2020 11:02:51 -0500 Received: by mail-ed1-f71.google.com with SMTP id bc3so57455edb.15 for ; Thu, 27 Feb 2020 08:02:51 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id h18sm266204ejf.54.2020.02.27.08.02.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Feb 2020 08:02:48 -0800 (PST) Subject: Re: [RFC][gdb/testsuite] Add -lbl option in gdb_test_multiple To: Tom de Vries , gdb-patches@sourceware.org References: <20200219174014.GA28126@delia> <851a18b0-b172-4b59-e411-ce3379c95c76@redhat.com> <0208e698-e2e1-c13f-486f-caa3f7766d6a@suse.de> <883bfb0f-c8e7-ae6c-aa94-2486b3c76362@redhat.com> <80d69419-60df-8308-9587-295a86c5041b@suse.de> From: Pedro Alves Message-ID: <946e4070-8328-3ff1-eb45-1532a8782acd@redhat.com> Date: Thu, 27 Feb 2020 16:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <80d69419-60df-8308-9587-295a86c5041b@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg01010.txt.bz2 On 2/21/20 3:35 PM, Tom de Vries wrote: > I think we don't want to integrate -lbl in the user_code parsing, because: > ... > gdb_test_multiple "command" "testname" { > -re "bla" { > } > -lbl > } > ... > and: > ... > gdb_test_multiple "command" "testname" { > -lbl > -re "bla" { > } > } > ... > will have the same effect, which is likely to cause confusion. Well: gdb_test_multiple "command" "testname" { -re "bar" { } -timeout 60 } and: gdb_test_multiple "command" "testname" { -timeout 60 -re "bla" { } } also have the same effect. So there's precedent and it goes all the way back to expect. > [gdb/testsuite] Add -lbl option in gdb_test_multiple > > Add gdb_test_multiple option -lbl, that adds a regexp after the user code that > reads one line, and discards it: > ... > -re "\r\n\[^\r\n\]*(?=\r\n)" { > exp_continue > } > ... > > In order to be able to write: > ... > gdb_test_multiple "command" "testname" { > ... > } -lbl > ... > as opposed to having to insert the "" for the prompt_regexp arguments: > ... > gdb_test_multiple "command" "testname" { > ... > } "" -lbl > ... > rewrite the promp_regexp argument usage into: > ... > gdb_test_multiple "command" "testname" { > ... > } -prompt $prompt_regexp > ... Honestly, to me, this: gdb_test_multiple "command" "testname" { ... } -lbl -prompt $prompt_regexp looks a bit harder to grok than: gdb_test_multiple "command" "testname" { -lbl -prompt $prompt_regexp ... } ... because those options appear at the end, after the regexes. Alternatively, if you don't like the -lbl within the {} block, and if we're going to use "-" options, how about supporting them before the {} user code block, so that the user code block is always at the end? Like: gdb_test_multiple "command" "testname" -lbl { ... } gdb_test_multiple "command" "testname" -prompt $prompt_regexp { ... } That should be doable with: -proc gdb_test_multiple { command message user_code { prompt_regexp "" } } { +proc gdb_test_multiple { command message args } { and then walking the $args list, processing "-" arguments, and interpreting the first non-"-" argument as the user code block (and erroring out if there are more arguments). I think the gdb_test_multiple code would look quite similar to your patch, except that the user_code parameter would no longer be a parameter, instead it would be a local variable set to the first non-"-" element of $args. Thanks, Pedro Alves