From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15933 invoked by alias); 23 Oct 2018 23:37:46 -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 15919 invoked by uid 89); 23 Oct 2018 23:37:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=life X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Oct 2018 23:37:44 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w9NNbYmb023849 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Oct 2018 19:37:40 -0400 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CA2811E514; Tue, 23 Oct 2018 19:37:34 -0400 (EDT) Subject: Re: [PATCH][gdb/testsuite] Rewrite catch-follow-exec.exp To: Tom de Vries , Gary Benson Cc: gdb-patches@sourceware.org, Pedro Alves References: <20181005101122.GA23867@delia> <20181009135155.GB12668@blade.nx> <8f8ffb94-5a0c-8b2b-d541-eaacd7d1f42c@suse.de> <20181010092735.GA29557@blade.nx> <20181010134423.GA23926@blade.nx> <20181011074744.GA7677@delia> <20181011083318.GA13751@blade.nx> <06b38d2e3f0a9394280553e70b9dfaf8@polymtl.ca> <480ea2be-eac0-8d19-cfe7-93c56b33a7ac@suse.de> <9d0dc535-b053-5063-eb0c-d7bf3e80fe49@suse.de> From: Simon Marchi Message-ID: Date: Tue, 23 Oct 2018 23:37: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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00531.txt.bz2 On 2018-10-23 6:38 p.m., Tom de Vries wrote: > On 10/23/18 11:05 PM, Tom de Vries wrote: >> On 10/23/18 11:04 PM, Simon Marchi wrote: >>> On 2018-10-15 3:54 p.m., Tom de Vries wrote: >>>>> Just wondering.  Would it make life easier if we fixed PR 23368, which >>>>> is the reason we have to do the test in an unnatural way? >>>> >>>> Yes. >>> >>> Hi Tom, >>> >>> PR 23368 should be fixed now. Do you plan on updating catch-follow-exec.exp >>> to be written in a more standard way? >> >> Sure, will do. > > How does this look? Hi Tom, Thanks for looking into this so quickly. I have some superficial suggestions that can help shorten the test a bit and make it more readable (some of them can be personal preference though...). When the test name is omitted, it defaults to the command. So instead of gdb_test "catch exec" \ {Catchpoint [0-9][0-9]* \(exec\)} \ "catch exec" You can write gdb_test "catch exec" {Catchpoint [0-9][0-9]* \(exec\)} and the test name will be "catch exec". Instead of [0-9][0-9]*, I am pretty sure you can use [0-9]+, or $decimal, which is provided by DejaGnu (/usr/share/dejagnu/runtest.exp): 101: set decimal "\[0-9\]+" Except in the {} string, $decimal won't work, because it won't get substituted. For this: gdb_test "set follow-exec-mode new" \ "" \ "set follow-exec-mode new" You can use gdb_test_no_output "set follow-exec-mode new" (again, omitting the test name makes it default to the command) I'd suggest replacing gdb_test_multiple "info prog" "info prog" { -i "$gdb_spawn_id" eof { fail "info prog" } -i "$gdb_spawn_id" "No selected thread\." { pass "info prog" } } with the simpler gdb_test "info prog" "No selected thread." If GDB crashes as it did before your fix, the test will be unresolved, which is treated the same as a FAIL. If you decide to keep the gdb_test_multiple, I think you don't need to specify -i "$gdb_spawn_id", it's the default. Also, it's common practice to factor out the test name, to make sure it's constant. And because the test name is the same as the command, you could do set test "info prog" gdb_test_multiple $test $test { eof { fail $test } -re "No selected thread\." { pass $test } } While at it, could you update the comment at the top of the file, which currently says: # Check whether finish respects the print pretty user setting when printing the # function result. Thanks! Simon