From patchwork Wed Nov 26 18:35:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 3955 Received: (qmail 1560 invoked by alias); 26 Nov 2014 18:35:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1546 invoked by uid 89); 26 Nov 2014 18:35:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 26 Nov 2014 18:35:42 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id BD.22.05330.804C5745; Wed, 26 Nov 2014 13:14:00 +0100 (CET) Received: from simark-hp.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.93) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 26 Nov 2014 13:35:18 -0500 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] Fix test always passing in python/py-linetable.exp Date: Wed, 26 Nov 2014 13:35:12 -0500 Message-ID: <1417026912-883-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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. 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. 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. 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 ()