[PATCH] Python 3 support, part 2 (testsuite part)

Paul_Koning@Dell.com Paul_Koning@Dell.com
Mon Dec 10 21:09:00 GMT 2012


On Nov 16, 2012, at 2:32 PM, Tom Tromey wrote:

>>>>>> "Paul" ==   <Paul_Koning@Dell.com> writes:
> 
> Paul> Most of the changes are for turning "print" from a statement into
> Paul> a function call.  There are also some changes to handle the fact
> Paul> that "str" is now Unicode and the separate "unicode" type is gone,
> Paul> similarly "int" is now long integer and "long" is gone.
> 
> In the future, please split up patches like this.
> The patch in its present form is difficult to read.
> For example, all the "print" changes are obvious -- as a separate patch
> those could get a simple "ok" without much fuss.
> 
> Paul> Ok to commit?
> 
> Yes, thanks.
> 
> Tom

Sorry for the long delay... I looked more closely at my test results and noticed an error I had overlooked.  It was not correctly setting the gdb_py_is_py3k and gdb_py_is_py24 variables.  The correction for that error changes testsuite/lib/gdb.exp -- all the other the testsuite changes are unaffected.  Attached is the updated diff for that file.

Ok with that correction?

	paul

Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.223
diff -u -r1.223 gdb.exp
--- gdb/testsuite/lib/gdb.exp	26 Nov 2012 19:23:56 -0000	1.223
+++ gdb/testsuite/lib/gdb.exp	10 Dec 2012 16:56:36 -0000
@@ -1550,7 +1550,10 @@
 
 proc skip_python_tests {} {
     global gdb_prompt
-    gdb_test_multiple "python print 'test'" "verify python support" {
+    global gdb_py_is_py3k
+    global gdb_py_is_py24
+
+    gdb_test_multiple "python print ('test')" "verify python support" {
 	-re "not supported.*$gdb_prompt $"	{
 	    unsupported "Python support is disabled."
 	    return 1
@@ -1558,6 +1561,26 @@
 	-re "$gdb_prompt $"	{}
     }
 
+    set gdb_py_is_py24 0
+    gdb_test_multiple "python print (sys.version_info\[0\])" "check if python 3" {
+	-re "3.*$gdb_prompt $"	{
+            set gdb_py_is_py3k 1
+        }
+	-re ".*$gdb_prompt $"	{
+            set gdb_py_is_py3k 0
+        }
+    }
+    if { $gdb_py_is_py3k == 0 } {
+        gdb_test_multiple "python print (sys.version_info\[1\])" "check if python 2.4" {
+	    -re "\[45\].*$gdb_prompt $" {
+                set gdb_py_is_py24 1
+            }
+	    -re ".*$gdb_prompt $" {
+                set gdb_py_is_py24 0
+            }
+        }
+    }
+
     return 0
 }



More information about the Gdb-patches mailing list