Fix test breakages caused by removal of gdb_py_test_multiple.

Tom de Vries detected that some python tests were broken as
they were still using gdb_py_test_multiple that was replaced
by gdb_test_multiline.  Repair these tests by using the new function.

gdb/testsuite/ChangeLog
2020-06-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.python/py-breakpoint.exp: use gdb_test_multiline instead
	of gdb_py_test_multiple.
	* gdb.python/py-cmd.exp: Likewise.
	* gdb.python/py-events.exp: Likewise.
	* gdb.python/py-function.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.python/py-infthread.exp: Likewise.
	* gdb.python/py-linetable.exp: Likewise.
	* gdb.python/py-parameter.exp: Likewise.
	* gdb.python/py-value.exp: Likewise.
This commit is contained in:
Philippe Waroquiers 2020-06-30 18:40:21 +02:00
parent bbd19b19e4
commit 2a17c803f6
10 changed files with 52 additions and 39 deletions

View File

@ -1,3 +1,16 @@
2020-06-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.python/py-breakpoint.exp: use gdb_test_multiline instead
of gdb_py_test_multiple.
* gdb.python/py-cmd.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.python/py-function.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.python/py-infthread.exp: Likewise.
* gdb.python/py-linetable.exp: Likewise.
* gdb.python/py-parameter.exp: Likewise.
* gdb.python/py-value.exp: Likewise.
2020-06-30 Tom de Vries <tdevries@suse.de>
PR testsuite/26175

View File

@ -320,7 +320,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
}
delete_breakpoints
gdb_py_test_multiple "Sub-class a breakpoint" \
gdb_test_multiline "Sub-class a breakpoint" \
"python" "" \
"class bp_eval (gdb.Breakpoint):" "" \
" inf_i = 0" "" \
@ -333,7 +333,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
" return False" "" \
"end" ""
gdb_py_test_multiple "Sub-class a second breakpoint" \
gdb_test_multiline "Sub-class a second breakpoint" \
"python" "" \
"class bp_also_eval (gdb.Breakpoint):" "" \
" count = 0" "" \
@ -344,7 +344,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
" return False" "" \
"end" ""
gdb_py_test_multiple "Sub-class a third breakpoint" \
gdb_test_multiline "Sub-class a third breakpoint" \
"python" "" \
"class basic (gdb.Breakpoint):" "" \
" count = 0" "" \
@ -381,7 +381,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
"Set breakpoint" 0
gdb_py_test_silent_cmd "python eval_bp2.condition = \"1==1\"" \
"Set a condition" 0
gdb_py_test_multiple "Construct an eval function" \
gdb_test_multiline "Construct an eval function" \
"python" "" \
"def stop_func ():" "" \
" return True" "" \
@ -402,7 +402,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
gdb_test "python print (check_eval.count)" "1" \
"Test that evaluate function is run when location also has normal bp"
gdb_py_test_multiple "Sub-class a watchpoint" \
gdb_test_multiline "Sub-class a watchpoint" \
"python" "" \
"class wp_eval (gdb.Breakpoint):" "" \
" def stop (self):" "" \
@ -434,7 +434,7 @@ proc_with_prefix test_bkpt_temporary { } {
}
delete_breakpoints
gdb_py_test_multiple "Sub-class and check temporary breakpoint" \
gdb_test_multiline "Sub-class and check temporary breakpoint" \
"python" "" \
"class temp_bp (gdb.Breakpoint):" "" \
" count = 0" "" \
@ -521,7 +521,7 @@ proc_with_prefix test_bkpt_events {} {
clean_restart ${testfile}
gdb_py_test_multiple "Create event handler" \
gdb_test_multiline "Create event handler" \
"python" "" \
"def note_event(arg):" "" \
" global last_bp_event" "" \

View File

@ -34,7 +34,7 @@ if ![runto_main] then {
# Test a simple command.
gdb_py_test_multiple "input simple command" \
gdb_test_multiline "input simple command" \
"python" "" \
"class test_cmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -48,7 +48,7 @@ gdb_test "test_cmd ugh" "test_cmd output, arg = ugh" "call simple command"
# Test a prefix command, and a subcommand within it.
gdb_py_test_multiple "input prefix command" \
gdb_test_multiline "input prefix command" \
"python" "" \
"class prefix_cmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -60,7 +60,7 @@ gdb_py_test_multiple "input prefix command" \
gdb_test "prefix_cmd ugh" "prefix_cmd output, arg = ugh" "call prefix command"
gdb_py_test_multiple "input subcommand" \
gdb_test_multiline "input subcommand" \
"python" "" \
"class subcmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -74,7 +74,7 @@ gdb_test "prefix_cmd subcmd ugh" "subcmd output, arg = ugh" "call subcmd"
# Test prefix command using keyword arguments.
gdb_py_test_multiple "input prefix command, keyword arguments" \
gdb_test_multiline "input prefix command, keyword arguments" \
"python" "" \
"class prefix_cmd2 (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -86,7 +86,7 @@ gdb_py_test_multiple "input prefix command, keyword arguments" \
gdb_test "prefix_cmd2 argh" "prefix_cmd2 output, arg = argh" "call prefix command, keyword arguments"
gdb_py_test_multiple "input subcommand under prefix_cmd2" \
gdb_test_multiline "input subcommand under prefix_cmd2" \
"python" "" \
"class subcmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -100,7 +100,7 @@ gdb_test "prefix_cmd2 subcmd ugh" "subcmd output, arg = ugh" "call subcmd under
# Test a subcommand in an existing GDB prefix.
gdb_py_test_multiple "input new subcommand" \
gdb_test_multiline "input new subcommand" \
"python" "" \
"class newsubcmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -114,7 +114,7 @@ gdb_test "info newsubcmd ugh" "newsubcmd output, arg = ugh" "call newsubcmd"
# Test a command that throws gdb.GdbError.
gdb_py_test_multiple "input command to throw error" \
gdb_test_multiline "input command to throw error" \
"python" "" \
"class test_error_cmd (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -145,7 +145,7 @@ gdb_test "python print (gdb.string_to_argv ('1\\ 2 3'))" \
"string_to_argv ('1\\ 2 3')"
# Test user-defined python commands.
gdb_py_test_multiple "input simple user-defined command" \
gdb_test_multiline "input simple user-defined command" \
"python" "" \
"class test_help (gdb.Command):" "" \
" \"\"\"Docstring\"\"\"" "" \
@ -166,7 +166,7 @@ gdb_test "show user test_help" "Not a user command\." \
"don't show user-defined python command in `show user command`"
# Test expression completion on fields
gdb_py_test_multiple "expression completion command" \
gdb_test_multiline "expression completion command" \
"python" "" \
"class expr_test (gdb.Command):" "" \
" def __init__ (self):" "" \
@ -266,7 +266,7 @@ if { [readline_is_used] } {
# Test that interrupting pagination throws a gdb quit.
gdb_test_no_output "set height 10"
gdb_py_test_multiple "input multi-line-output command" \
gdb_test_multiline "input multi-line-output command" \
"python" "" \
"class test_mline (gdb.Command):" "" \
" \"\"\"Docstring\"\"\"" "" \

View File

@ -213,13 +213,13 @@ dir ok: True.*" "Inferior 2 terminated."
# Test before_prompt event.
gdb_py_test_multiple "define new user command" \
gdb_test_multiline "define new user command" \
"define xxz" "End with a line saying just .end.." \
"set variable \$x = 72" "" \
"set variable \$y = 93" "" \
"end" ""
gdb_py_test_multiple "add before_prompt listener" \
gdb_test_multiline "add before_prompt listener" \
"python" "" \
"count = 0" "" \
"def listener():" "" \

View File

@ -27,7 +27,7 @@ gdb_reinitialize_dir $srcdir/$subdir
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
gdb_py_test_multiple "input convenience function" \
gdb_test_multiline "input convenience function" \
"python" "" \
"class test_func (gdb.Function):" "" \
" def __init__ (self):" "" \
@ -41,7 +41,7 @@ gdb_test "print \$test_func (\"ugh\")" "= \"test_func output, arg = ugh\"" "call
# Test returning a gdb.Value from the function. This segfaulted GDB at one point.
gdb_py_test_multiple "input value-returning convenience function" \
gdb_test_multiline "input value-returning convenience function" \
"python" "" \
"class Double (gdb.Function):" "" \
" def __init__ (self):" "" \
@ -59,7 +59,7 @@ foreach lang [concat [gdb_supported_languages] auto] {
gdb_test "print \$double (1)" "= 2" "call value-returning function, language = $lang"
}
gdb_py_test_multiple "input int-returning function" \
gdb_test_multiline "input int-returning function" \
"python" "" \
"class Yes(gdb.Function):" "" \
" def __init__(self):" "" \
@ -72,7 +72,7 @@ gdb_py_test_multiple "input int-returning function" \
gdb_test "print \$yes() && \$yes()" " = 1" "call yes with &&"
gdb_test "print \$yes() || \$yes()" " = 1" "call yes with ||"
gdb_py_test_multiple "Test GDBError" \
gdb_test_multiline "Test GDBError" \
"python" "" \
"class GDBError(gdb.Function):" "" \
" def __init__(self):" "" \
@ -85,7 +85,7 @@ gdb_py_test_multiple "Test GDBError" \
gdb_test "print \$gdberror()" "This is a GdbError.*" \
"Test GdbError. There should not be a stack trace"
gdb_py_test_multiple "Test Normal Error" \
gdb_test_multiline "Test Normal Error" \
"python" "" \
"class NormalError(gdb.Function):" "" \
" def __init__(self):" "" \
@ -99,7 +99,7 @@ gdb_test_no_output "set python print-stack full"
gdb_test "print \$normalerror()" "Traceback.*File.*line 5.*in invoke.*RuntimeError.*This is a Normal Error.*" \
"Test a Runtime error. There should be a stack trace."
gdb_py_test_multiple "input command-calling function" \
gdb_test_multiline "input command-calling function" \
"python" "" \
"class CallCommand(gdb.Function):" "" \
" def __init__(self):" "" \

View File

@ -218,7 +218,7 @@ with_test_prefix "is_valid" {
gdb_test "python print (inf_list\[0\].is_valid())" "True" \
"check inferior validity 1"
gdb_py_test_multiple "install new inferior event handler" \
gdb_test_multiline "install new inferior event handler" \
"python" "" \
"my_inferior_count = 1" "" \
"def new_inf_handler(evt):" "" \
@ -227,7 +227,7 @@ with_test_prefix "is_valid" {
" my_inferior_count = my_inferior_count + 1" "" \
"gdb.events.new_inferior.connect(new_inf_handler)" "" \
"end" ""
gdb_py_test_multiple "install inferior deleted event handler" \
gdb_test_multiline "install inferior deleted event handler" \
"python" "" \
"def del_inf_handler(evt):" "" \
" global my_inferior_count" "" \

View File

@ -30,7 +30,7 @@ clean_restart ${testfile}
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
gdb_py_test_multiple "install new_thread event handler" \
gdb_test_multiline "install new_thread event handler" \
"python" "" \
"seen_a_thread = False" "" \
"def thread_handler(evt):" "" \

View File

@ -40,7 +40,7 @@ if { [skip_python_tests] } { continue }
gdb_py_test_silent_cmd "python lt = gdb.selected_frame().find_sal().symtab.linetable()" \
"get instruction" 0
gdb_py_test_multiple "input simple command" \
gdb_test_multiline "input simple command" \
"python" "" \
"def list_lines():" "" \
" for l in lt:" "" \

View File

@ -39,7 +39,7 @@ gdb_test "python print (gdb.parameter ('directories'))" $directories
# Test a simple boolean parameter.
with_test_prefix "boolean parameter" {
gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test_multiline "Simple gdb booleanparameter" \
"python" "" \
"class TestParam (gdb.Parameter):" "" \
" \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
@ -79,7 +79,7 @@ with_test_prefix "boolean parameter" {
# Test an enum parameter.
with_test_prefix "enum parameter" {
gdb_py_test_multiple "enum gdb parameter" \
gdb_test_multiline "enum gdb parameter" \
"python" "" \
"class TestEnumParam (gdb.Parameter):" "" \
" \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
@ -112,7 +112,7 @@ with_test_prefix "enum parameter" {
# Test a file parameter.
with_test_prefix "file parameter" {
gdb_py_test_multiple "file gdb parameter" \
gdb_test_multiline "file gdb parameter" \
"python" "" \
"class TestFileParam (gdb.Parameter):" "" \
" \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
@ -144,7 +144,7 @@ with_test_prefix "file parameter" {
# Test a parameter that is not documented.
with_test_prefix "undocumented parameter" {
gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test_multiline "Simple gdb booleanparameter" \
"python" "" \
"class TestUndocParam (gdb.Parameter):" "" \
" def get_show_string (self, pvalue):" ""\
@ -179,7 +179,7 @@ with_test_prefix "undocumented parameter" {
# Test a parameter that is not documented in any way..
with_test_prefix "really undocumented parameter" {
gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test_multiline "Simple gdb booleanparameter" \
"python" "" \
"class TestNodocParam (gdb.Parameter):" "" \
" def __init__ (self, name):" "" \
@ -207,7 +207,7 @@ with_test_prefix "really undocumented parameter" {
# Test deprecated API. Do not use in your own implementations.
with_test_prefix "deprecated API parameter" {
gdb_py_test_multiple "Simple gdb booleanparameter" \
gdb_test_multiline "Simple gdb booleanparameter" \
"python" "" \
"class TestParam (gdb.Parameter):" "" \
" \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
@ -238,7 +238,7 @@ with_test_prefix "deprecated API parameter" {
}
foreach kind {PARAM_ZUINTEGER PARAM_ZUINTEGER_UNLIMITED} {
gdb_py_test_multiple "Simple gdb $kind" \
gdb_test_multiline "Simple gdb $kind" \
"python" "" \
"class TestNodocParam (gdb.Parameter):" "" \
" def __init__ (self, name):" "" \
@ -261,7 +261,7 @@ foreach kind {PARAM_ZUINTEGER PARAM_ZUINTEGER_UNLIMITED} {
}
}
gdb_py_test_multiple "Throwing gdb parameter" \
gdb_test_multiline "Throwing gdb parameter" \
"python" "" \
"class TestThrowParam (gdb.Parameter):" "" \
" def __init__ (self, name):" "" \

View File

@ -172,7 +172,7 @@ proc test_value_numeric_ops {} {
proc test_value_boolean {} {
# First, define a useful function to test booleans.
gdb_py_test_multiple "define function to test booleans" \
gdb_test_multiline "define function to test booleans" \
"python" "" \
"def test_bool (val):" "" \
" if val:" "" \
@ -506,7 +506,7 @@ proc test_parse_and_eval {} {
# Test that values are hashable.
proc test_value_hash {} {
gdb_py_test_multiple "Simple Python value dictionary" \
gdb_test_multiline "Simple Python value dictionary" \
"python" "" \
"one = gdb.Value(1)" "" \
"two = gdb.Value(2)" "" \