From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23694 invoked by alias); 15 Jun 2010 16:19:29 -0000 Received: (qmail 23681 invoked by uid 22791); 15 Jun 2010 16:19:27 -0000 X-SWARE-Spam-Status: No, hits=-2.2 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; Tue, 15 Jun 2010 16:19:20 +0000 Received: (qmail 1649 invoked from network); 15 Jun 2010 16:19:18 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Jun 2010 16:19:18 -0000 Date: Tue, 15 Jun 2010 16:19:00 -0000 From: Daniel Jacobowitz To: Frederic Riss Cc: Michael Snyder , "gdb-patches@sourceware.org" Subject: Re: [resubmit] gdb.base, r*.exp thru w*.exp Message-ID: <20100615161912.GA7975@caradoc.them.org> Mail-Followup-To: Frederic Riss , Michael Snyder , "gdb-patches@sourceware.org" References: <4BF59BBB.8020603@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-06/txt/msg00341.txt.bz2 On Tue, Jun 15, 2010 at 05:55:48PM +0200, Frederic Riss wrote: > On 20 May 2010 22:29, Michael Snyder wrote: > > Index: setshow.exp > > --- setshow.exp 5 May 2010 18:06:58 -0000 ? ? ? 1.14 > > +++ setshow.exp 20 May 2010 20:24:11 -0000 > > @@ -54,27 +54,25 @@ if { ![runto_main] } { > > ?#test set annotate 2 > > -send_gdb "set annotate 2\n" > > -gdb_expect { > > - ? ? ? -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ > > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? { pass "set annotate 2" } > > - ? ? ? timeout ? ? ? ? ? ? ? ? { fail "(timeout) set annotate 2" } > > + > > +gdb_test_multiple "set annotate 2" "set annotate 2" { > > + ? ?-re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" { > > + ? ?pass "set annotate 2" > > ? ? } > > +} > > Before that commit, the test seemed 100% reliable. This hunk unfortunately exhibits a common subtle pitfall :-( You can use bare gdb_expect with a string that contains gdb_prompt not at the end, or contains more than one gdb_prompt, although it's a bit tricky. You can't do the same with gdb_test_multiple, because it has patterns like ".*$gdb_prompt $" -> FAIL. If the output comes out buffered in such a way that the prompt is written separately from the post-prompt text, this will match before GDB is done printing output. -- Daniel Jacobowitz CodeSourcery