2012-12-10 Paul Koning <paul_koning@dell.com>

* gdb.base/charset.exp: Change print syntax for Python 3
	compatibility.
	* gdb.python/py-block.exp: Ditto.
	* gdb.python/py-breakpoint.exp: Ditto.
	* gdb.python/py-cmd.exp: Ditto.
	* gdb.python/py-events.py: Ditto.
	* gdb.python/py-finish-breakpoint.py: Ditto.
	* gdb.python/py-finish-breakpoint2.exp: Ditto.
	* gdb.python/py-finish-breakpoint2.py: Ditto.
	* gdb.python/py-frame-inline.exp: Ditto.
	* gdb.python/py-frame.exp: Ditto.
	* gdb.python/py-infthread.exp: Ditto.
	* gdb.python/py-objfile.exp: Ditto.
	* gdb.python/py-parameter.exp: Ditto.
	* gdb.python/py-progspace.exp: Ditto.
	* gdb.python/py-prompt.exp: Ditto.
	* gdb.python/py-symbol.exp: Ditto.
	* gdb.python/py-symtab.exp: Ditto.
	* gdb.python/py-template.exp: Ditto.
	* gdb.python/py-value-cc.exp: Ditto.
	* gdb.python/python.exp: Ditto.
	* gdb.python/source2.py: Ditto.
	* gdb.python/lib-types.exp: Change print syntax for Python 3
	compatibility.
	Use sorted() function rather than sort() method.
	Accept either int or long values for enum values.
	* gdb.python/py-events.exp: Use exec(open(...).read()) instead of
	execfile for Python 3 compatibility.
	* gdb.python/py-evsignal.exp: Ditto.
	* gdb.python/py-evthreads.exp: Ditto.
	* gdb.python/py-mi.exp: Ditto.
	* gdb.python/py-pp-maint.exp: Ditto.
	* gdb.python/py-prettyprint.exp: Ditto.
	* gdb.python/py-finish-breakpoint.exp: Change print syntax for
	Python 3 compatibility.
	Skip tests for Python 2.4.
	* gdb.python/py-inferior.exp: Change print syntax for
	Python 3 compatibility.
	Use byte string rather than character string in memory write test
	if Python 3.
	* gdb.python/py-pp-maint.py: Change class declarations to "new
	class" syntax.
	* gdb.python/py-prettyprint.py: Change iterator class to generator
	function for Python 3 compatibility.
	Make all classes "new style".
	Fix indentation issue and stray semicolon.
	* gdb.python/py-shared.expChange print syntax for Python 3
	compatibility.
	Define "long" if Python 3.
	* gdb.python/py-type.exp: Change print syntax for Python 3
	compatibility.
	Accept either int or long values for enum values.
	* gdb.python/py-value.exp: Change print syntax for Python 3
	compatibility.
	Skip "long" and "unicode" tests if Python 3.
	Accept either "type" or "class" in type checks.
	* lib/gdb.exp (gdb_py_is_py3k): New flag set if Python 3.
	(gdb_py_is_py24): New flag set if Python 2.4 or 2.5.
This commit is contained in:
Paul Koning
2012-12-10 21:22:21 +00:00
parent c766f7ecdd
commit 9325cb04b5
37 changed files with 677 additions and 595 deletions

View File

@ -27,7 +27,7 @@ gdb_reinitialize_dir $srcdir/$subdir
if { [skip_python_tests] } { continue }
# We use "." here instead of ":" so that this works on win32 too.
gdb_test "python print gdb.parameter ('directories')" "$srcdir/$subdir.\\\$cdir.\\\$cwd"
gdb_test "python print (gdb.parameter ('directories'))" "$srcdir/$subdir.\\\$cdir.\\\$cwd"
# Test a simple boolean parameter.
gdb_py_test_multiple "Simple gdb booleanparameter" \
@ -49,11 +49,11 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \
"test_param = TestParam ('print test-param')" ""\
"end"
gdb_test "python print test_param.value" "True" "Test parameter value"
gdb_test "python print (test_param.value)" "True" "Test parameter value"
gdb_test "show print test-param" "The state of the Test Parameter is on.*" "Show parameter on"
gdb_test "set print test-param off" "Test Parameter has been set to off" "Turn off parameter"
gdb_test "show print test-param" "The state of the Test Parameter is off.*" "Show parameter off"
gdb_test "python print test_param.value" "False" "Test parameter value"
gdb_test "python print (test_param.value)" "False" "Test parameter value"
gdb_test "help show print test-param" "Show the state of the boolean test-param.*" "Test show help"
gdb_test "help set print test-param" "Set the state of the boolean test-param.*" "Test set help"
gdb_test "help set print" "set print test-param -- Set the state of the boolean test-param.*" "Test general help"
@ -76,11 +76,11 @@ gdb_py_test_multiple "enum gdb parameter" \
"test_enum_param = TestEnumParam ('print test-enum-param')" ""\
"end"
gdb_test "python print test_enum_param.value" "one" "Test enum parameter value"
gdb_test "python print (test_enum_param.value)" "one" "Test enum parameter value"
gdb_test "show print test-enum-param" "The state of the enum is one.*" "Show parameter is initial value"
gdb_test "set print test-enum-param two" "The state of the enum has been set to two" "Set enum to two"
gdb_test "show print test-enum-param" "The state of the enum is two.*" "Show parameter is new value"
gdb_test "python print test_enum_param.value" "two" "Test enum parameter value"
gdb_test "python print (test_enum_param.value)" "two" "Test enum parameter value"
gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "Set invalid enum parameter"
# Test a file parameter.
@ -100,11 +100,11 @@ gdb_py_test_multiple "file gdb parameter" \
"test_file_param = TestFileParam ('test-file-param')" ""\
"end"
gdb_test "python print test_file_param.value" "foo.txt" "Test file parameter value"
gdb_test "python print (test_file_param.value)" "foo.txt" "Test file parameter value"
gdb_test "show test-file-param" "The name of the file is foo.txt.*" "Show initial file value"
gdb_test "set test-file-param bar.txt" "The name of the file has been changed to bar.txt" "Set new file parameter" 1
gdb_test "show test-file-param" "The name of the file is bar.txt.*" "Show new file value"
gdb_test "python print test_file_param.value" "bar.txt" "Test new file parameter value"
gdb_test "python print (test_file_param.value)" "bar.txt" "Test new file parameter value"
gdb_test "set test-file-param" "Argument required.*"
# Test a parameter that is not documented.
@ -127,7 +127,7 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test "show print test-undoc-param" "The state of the Test Parameter is on.*" "Show parameter on"
gdb_test "set print test-undoc-param off" "Test Parameter has been set to off" "Turn off parameter"
gdb_test "show print test-undoc-param" "The state of the Test Parameter is off.*" "Show parameter off"
gdb_test "python print test_undoc_param.value" "False" "Test parameter value"
gdb_test "python print (test_undoc_param.value)" "False" "Test parameter value"
gdb_test "help show print test-undoc-param" "This command is not documented.*" "Test show help"
gdb_test "help set print test-undoc-param" "This command is not documented.*" "Test set help"
gdb_test "help set print" "set print test-undoc-param -- This command is not documented.*" "Test general help"
@ -145,7 +145,7 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test "show print test-nodoc-param" "This command is not documented.*" "Show parameter on"
gdb_test "set print test-nodoc-param off" "This command is not documented.*" "Turn off parameter"
gdb_test "show print test-nodoc-param" "This command is not documented.*.*" "Show parameter off"
gdb_test "python print test_nodoc_param.value" "False" "Test parameter value"
gdb_test "python print (test_nodoc_param.value)" "False" "Test parameter value"
gdb_test "help show print test-nodoc-param" "This command is not documented.*" "Test show help"
gdb_test "help set print test-nodoc-param" "This command is not documented.*" "Test set help"
gdb_test "help set print" "set print test-nodoc-param -- This command is not documented.*" "Test general help"
@ -163,11 +163,11 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \
"test_param = TestParam ('print test-param')" ""\
"end"
gdb_test "python print test_param.value" "True" "Test parameter value"
gdb_test "python print (test_param.value)" "True" "Test parameter value"
gdb_test "show print test-param" "State of the Test Parameter on.*" "Show parameter on"
gdb_test "set print test-param off" "Set the state of the Test Parameter.*" "Turn off parameter"
gdb_test "show print test-param" "State of the Test Parameter off.*" "Show parameter off"
gdb_test "python print test_param.value" "False" "Test parameter value"
gdb_test "python print (test_param.value)" "False" "Test parameter value"
gdb_test "help show print test-param" "State of the Test Parameter.*" "Test show help"
gdb_test "help set print test-param" "Set the state of the Test Parameter.*" "Test set help"
gdb_test "help set print" "set print test-param -- Set the state of the Test Parameter.*" "Test general help"