From patchwork Wed Nov 26 04:36:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 3931 Received: (qmail 20945 invoked by alias); 26 Nov 2014 04:36:10 -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 20829 invoked by uid 89); 26 Nov 2014 04:36:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: smtp.electronicbox.net Received: from smtp.electronicbox.net (HELO smtp.electronicbox.net) (96.127.255.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Nov 2014 04:36:05 +0000 Received: from simark.localdomain (unknown [96.127.221.218]) by smtp.electronicbox.net (Postfix) with ESMTP id F1D50DF380; Tue, 25 Nov 2014 23:31:28 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: simon.marchi@polymtl.ca, Simon Marchi Subject: [PATCH 3/3] Fix prints in tests for Python 3 Date: Tue, 25 Nov 2014 23:36:01 -0500 Message-Id: <1416976561-1927-3-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1416976561-1927-1-git-send-email-simon.marchi@ericsson.com> References: <1416976561-1927-1-git-send-email-simon.marchi@ericsson.com> X-IsSubscribed: yes Python 3's print requires to use parentheses, so this patch adds them where they were missing. gdb/testsuite/ChangeLog: * gdb.python/py-linetable.exp: Add parentheses to calls to print. * gdb.python/py-type.exp: Same. * gdb.python/py-value-cc.exp: Same. * gdb.python/py-value.exp: Same. --- gdb/testsuite/gdb.python/py-linetable.exp | 14 +++++++------- gdb/testsuite/gdb.python/py-type.exp | 6 +++--- gdb/testsuite/gdb.python/py-value-cc.exp | 24 ++++++++++++------------ gdb/testsuite/gdb.python/py-value.exp | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.python/py-linetable.exp index 682b5b7..351f380 100644 --- a/gdb/testsuite/gdb.python/py-linetable.exp +++ b/gdb/testsuite/gdb.python/py-linetable.exp @@ -44,17 +44,17 @@ gdb_py_test_multiple "input simple command" \ "python" "" \ "def list_lines():" "" \ " for l in lt:" "" \ - " print 'L' +str(l.line)+' A '+hex(l.pc)" "" \ + " print ('L' + str(l.line) + ' A ' + hex(l.pc))" "" \ "end" "" 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" -gdb_test "python print len(lt.line(42))" "2" \ +gdb_test "python print (len(lt.line(42)))" "2" \ "Test length of a multiple pc line" -gdb_test "python print len(lt.line(20))" "1" \ +gdb_test "python print (len(lt.line(20)))" "1" \ "Test length of a single pc line" -gdb_test "python print lt.line(1)" "None" \ +gdb_test "python print (lt.line(1))" "None" \ "Test None returned for line with no pc" # Test gdb.Linetable.sourcelines () @@ -65,12 +65,12 @@ gdb_test "python print sorted(fset)" \ "Test frozen set contains line numbers" # Test gdb.Linetable.has_line () -gdb_test "python print lt.has_line(20)" \ +gdb_test "python print (lt.has_line(20))" \ "True.*" \ "Test has_pcs at line 20" -gdb_test "python print lt.has_line(44)" \ +gdb_test "python print (lt.has_line(44))" \ "True.*" \ "Test has_pcs at line 40" -gdb_test "python print lt.has_line(10)" \ +gdb_test "python print (lt.has_line(10))" \ "False.*" \ "Test has_pcs at line 10" diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 6b61f48..921b0cd 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -89,10 +89,10 @@ proc test_fields {lang} { gdb_py_test_silent_cmd "python ss = gdb.parse_and_eval('ss')" "init ss" 1 gdb_py_test_silent_cmd "python ss_fields = ss.type.fields()" \ "get fields from ss.type" 1 - gdb_test "python print len(ss_fields)" "2" "Check length of ss_fields" - gdb_test "python print ss_fields\[0\].name is None" "True" \ + gdb_test "python print (len(ss_fields))" "2" "Check length of ss_fields" + gdb_test "python print (ss_fields\[0\].name is None)" "True" \ "Check ss_fields\[0\].name" - gdb_test "python print ss_fields\[1\].name is None" "True" \ + gdb_test "python print (ss_fields\[1\].name is None)" "True" \ "Check ss_fields\[1\].name" # Regression test for # http://sourceware.org/bugzilla/show_bug.cgi?id=12070. diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp index 949f04f..a965f5d 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -88,18 +88,18 @@ gdb_test "python print(b_td\[b_fields\[0\]\]\['a'\])" "100" \ gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via field" gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via field" -gdb_test "python print len(x_fields)" "2" "number for fields in u" -gdb_test "python print x\[x_fields\[0\]\]\['x'\]" "101" "x.x via field" -gdb_test "python print x\[x_fields\[1\]\]\['a'\]" "102" "x.a via field" -gdb_test "python print x_ptr\[x_fields\[0\]\]\['x'\]" "101" "x_ptr->x via field" -gdb_test "python print x_ptr\[x_fields\[1\]\]\['a'\]" "102" "x_ptr->a via field" -gdb_test "python print xtd\[x_fields\[0\]\]\['x'\]" "101" "xtd->x via field" -gdb_test "python print xtd\[x_fields\[1\]\]\['a'\]" "102" "xtd->a via field" - -gdb_test "python print len(uu_fields)" "2" "number of fields in uu" -gdb_test "python print uu\[uu_fields\[0\]\]\['x'\]" "1000" "uu.x via field" -gdb_test "python print uu\[uu_fields\[1\]\]\['a'\]" "1000" "uu.a via field" +gdb_test "python print (len(x_fields))" "2" "number for fields in u" +gdb_test "python print (x\[x_fields\[0\]\]\['x'\])" "101" "x.x via field" +gdb_test "python print (x\[x_fields\[1\]\]\['a'\])" "102" "x.a via field" +gdb_test "python print (x_ptr\[x_fields\[0\]\]\['x'\])" "101" "x_ptr->x via field" +gdb_test "python print (x_ptr\[x_fields\[1\]\]\['a'\])" "102" "x_ptr->a via field" +gdb_test "python print (xtd\[x_fields\[0\]\]\['x'\])" "101" "xtd->x via field" +gdb_test "python print (xtd\[x_fields\[1\]\]\['a'\])" "102" "xtd->a via field" + +gdb_test "python print (len(uu_fields))" "2" "number of fields in uu" +gdb_test "python print (uu\[uu_fields\[0\]\]\['x'\])" "1000" "uu.x via field" +gdb_test "python print (uu\[uu_fields\[1\]\]\['a'\])" "1000" "uu.a via field" # Test overloaded operators. gdb_test_no_output "python a = gdb.parse_and_eval('a')" "init a" -gdb_test "python print a + 5" "10" "a + 5" +gdb_test "python print (a + 5)" "10" "a + 5" diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index 0e1534a..76238a1 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -294,7 +294,7 @@ proc test_value_in_inferior {} { # Test fetching a string longer than its declared (in C) size. # PR 16286 gdb_py_test_silent_cmd "python xstr = gdb.parse_and_eval('xstr')" "get xstr" 1 - gdb_test "python print xstr\['text'\].string (length = xstr\['length'\])" "x{100}" \ + gdb_test "python print (xstr\['text'\].string (length = xstr\['length'\]))" "x{100}" \ "read string beyond declared size" }