From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7012 invoked by alias); 26 Nov 2014 21:08:59 -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 7000 invoked by uid 89); 26 Nov 2014 21:08:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 26 Nov 2014 21:08:57 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAQL8qkh004386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Nov 2014 16:08:52 -0500 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAQL8pFI011816 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 26 Nov 2014 16:08:52 -0500 From: Sergio Durigan Junior To: Simon Marchi Cc: , Phil Muldoon Subject: Re: [PATCH] Fix test always passing in python/py-linetable.exp References: <1417026912-883-1-git-send-email-simon.marchi@ericsson.com> X-URL: http://blog.sergiodj.net Date: Wed, 26 Nov 2014 21:08:00 -0000 In-Reply-To: <1417026912-883-1-git-send-email-simon.marchi@ericsson.com> (Simon Marchi's message of "Wed, 26 Nov 2014 13:35:12 -0500") Message-ID: <878uixbrfg.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00670.txt.bz2 On Wednesday, November 26 2014, Simon Marchi wrote: > The following test is found in python/py-linetable.exp: > > gdb_test "python print sorted(fset)" \ > "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \ > "Test frozen set contains line numbers" > > I noticed that it passed when using Python 3, even though it should fail > because of the missing parentheses for the call print. > > There needs to be more escaping of the square brackets. Currently, it is > interpreted as "any one character from this big list of characters, > followed by .*". When adding the required amount of backslashes, the > test starts failing as it should. Hi Simon, This fix makes sense to me. Escaping brackets are always a source of confusion in TCL. Thanks for doing that. > Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L > suffix, so now the test fails because of that. Anybody knows why they > were there in the first place? I just tested with Python 2.4 and there > are no Ls. Yeah, I don't know. My wild guess it that it was a thinko because of the test just above it: gdb_test "python list_lines()" \ "L20 A $hex.*L21 A $hex.*L22 A $hex.*L24 A $hex.*L25 A $hex.*L40 A $hex.*L42 A $hex.*L44 A $hex.*L42 A $hex.*L46 A $hex.*" \ "test linetable iterator addr" Phil? > gdb/testsuite/ChangeLog: > > * gdb.python/py-linetable.exp: Properly escape sorted(fset) > test expected output. Add parentheses for the call to print. > Remove L suffix from integers. Two spaces after periods. > > Signed-off-by: Simon Marchi > --- > gdb/testsuite/gdb.python/py-linetable.exp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.python/py-linetable.exp > index 351f380..5d9b262 100644 > --- a/gdb/testsuite/gdb.python/py-linetable.exp > +++ b/gdb/testsuite/gdb.python/py-linetable.exp > @@ -60,8 +60,8 @@ gdb_test "python print (lt.line(1))" "None" \ > # Test gdb.Linetable.sourcelines () > gdb_py_test_silent_cmd "python fset = lt.source_lines()" \ > "Get all source lines into a frozen set" 0 > -gdb_test "python print sorted(fset)" \ > - "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \ > +gdb_test "python print (sorted(fset))" \ > + "\\\[20, 21, 22, 24, 25, 28, 29, 30, 32, 33, 37, 39, 40, 42, 44, 45, 46\\\].*" \ > "Test frozen set contains line numbers" > > # Test gdb.Linetable.has_line () > -- > 2.1.3 Other than that, LGTM (not an approval). Cheers, -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/