From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17224 invoked by alias); 24 Oct 2011 07:43:54 -0000 Received: (qmail 17214 invoked by uid 22791); 24 Oct 2011 07:43:52 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Oct 2011 07:43:37 +0000 Received: by vcbfk1 with SMTP id fk1so5977799vcb.0 for ; Mon, 24 Oct 2011 00:43:36 -0700 (PDT) Received: by 10.52.30.42 with SMTP id p10mr21733996vdh.127.1319442216079; Mon, 24 Oct 2011 00:43:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.180.75 with HTTP; Mon, 24 Oct 2011 00:43:16 -0700 (PDT) In-Reply-To: <20111021083242.GA8363@host1.jankratochvil.net> References: <20111021083242.GA8363@host1.jankratochvil.net> From: Kevin Pouget Date: Mon, 24 Oct 2011 09:15:00 -0000 Message-ID: Subject: Re: Dejagnu testing issue To: Jan Kratochvil Cc: Tom Tromey , gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-10/txt/msg00619.txt.bz2 On Fri, Oct 21, 2011 at 10:32 AM, Jan Kratochvil wrote: > On Fri, 21 Oct 2011 10:14:42 +0200, Kevin Pouget wrote: >> for the record, here is the way to get the pid based on "expect_out": >> >> gdb_test_multiple "info inferior" "list inferiors" { >> =A0 =A0 -re ".* \* 1.*process (\[0-9\]*).*$gdb_prompt $" { >> =A0 =A0 =A0 set pid $expect_out(1,string) >> =A0 =A0 =A0 pass "list inferiors" >> =A0 =A0 } >> } > > While it works to make it working as was intended it could be for example: > > gdb_test_multiple "info inferior" "list inferiors" { > =A0 =A0-re "\r\n\\* 1 *process (\[0-9\]*) .*\r\n$gdb_prompt $" { > =A0 =A0 =A0 =A0set pid $expect_out(1,string) > =A0 =A0 =A0 =A0pass "list inferiors" > =A0 =A0} > } > > Initial .* is redundant, start of the expect string is not anchored. > > \* is equal to * as the first level of backslashes is parsed by TCL > interpreter, not by the regex compiler. > > If one fixes \* -> \\* to really match an asterisk it no longer matches. > The asterisk is preceded by a newline, not by a space as in your regex st= ring. Thanks for this precision, the Dejagnu testsuite is not the easiest tool to master ... > Initial .* is redundant, start of the expect string is not anchored. just with this comment, I noticed that a lot of my tests not wrong, but not correctly written at least, and almost the same for > If one fixes \* -> \\* to really match an asterisk it no longer matches. Cordially, Kevin