From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32335 invoked by alias); 2 May 2011 14:58:48 -0000 Received: (qmail 32326 invoked by uid 22791); 2 May 2011 14:58:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 May 2011 14:58:32 +0000 Received: (qmail 3712 invoked from network); 2 May 2011 14:58:31 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 2 May 2011 14:58:31 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFC] Fixing gdb.base/completion.exp (PR testsuite/12649) Date: Mon, 02 May 2011 14:58:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.2; x86_64; ; ) Cc: Marek Polacek References: <4DB82F26.30801@redhat.com> <201104281614.31962.pedro@codesourcery.com> <4DBAC6BB.4030402@redhat.com> In-Reply-To: <4DBAC6BB.4030402@redhat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201105021558.30272.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-05/txt/msg00016.txt.bz2 On Friday 29 April 2011 15:10:03, Marek Polacek wrote: > On 04/28/2011 05:14 PM, Pedro Alves wrote: > > Are you sure? I did't see that when I try it. > > For instance this is OK: > gdb_test_no_output "complete hfgfh" "complete 'hfgfh'" > > but this is not: > gdb_test_no_output "hfgfh\t" "complete 'hfgfh'" Haven't really looked at exactly why that happens (it's most likely something withing gdb_test_multiple that causes it), we can always keep the send_gdb, and pass an empty command to gdb_test_multiple, like in the patchlet below. > > > And I'd much rather we do this (remote the races) as first step instead > > of completely rewriting the whole test file into something completely > > different... > > Good point. > > > A follow up step would convert/simplify the send_gdb+gdb_expects > > into gdb_test&friends. > > Something like this attempt? > http://sourceware.org/ml/gdb-patches/2011-04/msg00538.html No, I mean something along the lines of the incomplete patch below, really convert/simplifying the send_gdb+gdb_expects into gdb_test&friends. After that is done, the testfile should quite a bit smaller, and couple of patterns should emerge. Then, looking at the patterns, we could consider coming up with some helper functions that would allow running the tests in several different ways, e.g, once with \t, and another with "complete", as I suggested a couple of messages ago. Made possible since we now understand what races were there in the "\t" original version. --- gdb/testsuite/gdb.base/completion.exp | 25 +++++++++++-------------- gdb/testsuite/lib/gdb.exp | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) Index: src/gdb/testsuite/gdb.base/completion.exp =================================================================== --- src.orig/gdb/testsuite/gdb.base/completion.exp 2011-05-02 15:30:52.000000000 +0100 +++ src/gdb/testsuite/gdb.base/completion.exp 2011-05-02 15:50:30.649463000 +0100 @@ -94,21 +94,18 @@ if ![runto_main] then { set oldtimeout1 $timeout set timeout 30 - +set test "complete 'hfgfh'" send_gdb "hfgfh\t" -gdb_expect { - -re "^hfgfh\\\x07$"\ - { send_gdb "\n" - gdb_expect { - -re "Undefined command: \"hfgfh\"\\. Try \"help\"\\..*$gdb_prompt $"\ - { pass "complete 'hfgfh'"} - -re ".*$gdb_prompt $" { fail "complete 'hfgfh'"} - timeout {fail "(timeout) complete 'hfgfh'"} - } - } - -re ".*$gdb_prompt $" { fail "complete 'hfgfh'" } - timeout { fail "(timeout) complete 'hfgfh'" } - } +gdb_test_multiple "" "$test" { + -re "^hfgfh\\\x07$" { + send_gdb "\n" + gdb_test_multiple "" $test { + -re "Undefined command: \"hfgfh\"\\. Try \"help\"\\..*$gdb_prompt $" { + pass $test + } + } + } +} #exp_internal 0 Index: src/gdb/testsuite/lib/gdb.exp =================================================================== --- src.orig/gdb/testsuite/lib/gdb.exp 2011-04-28 17:17:41.000000000 +0100 +++ src/gdb/testsuite/lib/gdb.exp 2011-05-02 15:52:55.889463000 +0100 @@ -593,7 +593,7 @@ proc gdb_test_multiple { command message set message $command } - if [string match "*\[\r\n\]" $command] { + if { $command != "" && [string match "*\[\r\n\]" $command] } { error "Invalid trailing newline in \"$message\" test" } -- Pedro Alves