2006-11-10 Vladimir Prus <vladimir@codesourcery.com>
* gdb.base/completion.exp: Fix completion tests for 'info' and 'info '. * gdb.base/help.exp (help_test_raw, test_class_help) (test_prefix_command_help): Move... * lib/gdb.exp: Here. * gdb.base/main.exp: Adjust. * gdb.cp/maint.exp: Adjust. * gdb.trace/tracecmd.exp: Use test_help_class.
This commit is contained in:
parent
73ca250004
commit
d8295fe954
|
@ -1,3 +1,14 @@
|
||||||
|
2006-11-10 Vladimir Prus <vladimir@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.base/completion.exp: Fix completion tests for
|
||||||
|
'info' and 'info '.
|
||||||
|
* gdb.base/help.exp (help_test_raw, test_class_help)
|
||||||
|
(test_prefix_command_help): Move...
|
||||||
|
* lib/gdb.exp: Here.
|
||||||
|
* gdb.base/main.exp: Adjust.
|
||||||
|
* gdb.cp/maint.exp: Adjust.
|
||||||
|
* gdb.trace/tracecmd.exp: Use test_help_class.
|
||||||
|
|
||||||
2006-11-09 Vladimir Prus <vladimir@codesourcery.com>
|
2006-11-09 Vladimir Prus <vladimir@codesourcery.com>
|
||||||
|
|
||||||
* gdb.stabs/weird.exp (print_weird_var): Use
|
* gdb.stabs/weird.exp (print_weird_var): Use
|
||||||
|
|
|
@ -313,7 +313,7 @@ gdb_expect {
|
||||||
-re "^info $"\
|
-re "^info $"\
|
||||||
{ send_gdb "\n"
|
{ send_gdb "\n"
|
||||||
gdb_expect {
|
gdb_expect {
|
||||||
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
|
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands.*$gdb_prompt $"\
|
||||||
{ pass "complete 'info'"}
|
{ pass "complete 'info'"}
|
||||||
-re ".*$gdb_prompt $" { fail "complete 'info'"}
|
-re ".*$gdb_prompt $" { fail "complete 'info'"}
|
||||||
timeout {fail "(timeout) complete 'info'"}
|
timeout {fail "(timeout) complete 'info'"}
|
||||||
|
@ -329,7 +329,7 @@ gdb_expect {
|
||||||
-re "^info \\\x07$"\
|
-re "^info \\\x07$"\
|
||||||
{ send_gdb "\n"
|
{ send_gdb "\n"
|
||||||
gdb_expect {
|
gdb_expect {
|
||||||
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
|
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*$gdb_prompt $"\
|
||||||
{ pass "complete 'info '"}
|
{ pass "complete 'info '"}
|
||||||
-re ".*$gdb_prompt $" { fail "complete 'info '"}
|
-re ".*$gdb_prompt $" { fail "complete 'info '"}
|
||||||
timeout {fail "(timeout) complete 'info '"}
|
timeout {fail "(timeout) complete 'info '"}
|
||||||
|
|
|
@ -30,65 +30,6 @@ set bug_id 0
|
||||||
|
|
||||||
gdb_start
|
gdb_start
|
||||||
|
|
||||||
# Test the output of GDB_COMMAND matches the pattern obtained
|
|
||||||
# by concatenating all elements of EXPECTED_LINES. This makes
|
|
||||||
# it possible to split otherwise very long string into pieces.
|
|
||||||
# If third argument is not empty, it's used as the name of the
|
|
||||||
# test to be printed on pass/fail.
|
|
||||||
proc help_test_raw { gdb_command expected_lines args } {
|
|
||||||
set message $gdb_command
|
|
||||||
if [llength $args]>0 then {
|
|
||||||
set message [lindex $args 0]
|
|
||||||
}
|
|
||||||
set expected_output [join $expected_lines ""]
|
|
||||||
gdb_test "${gdb_command}" "${expected_output}" $message
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test the output of "help COMMNAD_CLASS". EXPECTED_INITIAL_LINES
|
|
||||||
# are regular expressions that should match the beginning of output,
|
|
||||||
# before the list of commands in that class. The presence of
|
|
||||||
# command list and standard epilogue will be tested automatically.
|
|
||||||
proc test_class_help { command_class expected_initial_lines } {
|
|
||||||
set l_stock_body {
|
|
||||||
"List of commands\:.*\[\r\n\]+"
|
|
||||||
"Type \"help\" followed by command name for full documentation\.\[\r\n\]+"
|
|
||||||
"Type \"apropos word\" to search for commands related to \"word\"\.[\r\n\]+"
|
|
||||||
"Command name abbreviations are allowed if unambiguous\."
|
|
||||||
}
|
|
||||||
set l_entire_body [concat $expected_initial_lines $l_stock_body]
|
|
||||||
help_test_raw "help ${command_class}" $l_entire_body
|
|
||||||
}
|
|
||||||
|
|
||||||
# COMMAND_LIST should have either one element -- command to test, or
|
|
||||||
# two elements -- abbreviated command to test, and full command the first
|
|
||||||
# element is abbreviation of.
|
|
||||||
# The command must be a prefix command. EXPECTED_INITIAL_LINES
|
|
||||||
# are regular expressions that should match the beginning of output,
|
|
||||||
# before the list of subcommands. The presence of
|
|
||||||
# subcommand list and standard epilogue will be tested automatically.
|
|
||||||
proc test_prefix_command_help { command_list expected_initial_lines args } {
|
|
||||||
set command [lindex $command_list 0]
|
|
||||||
if {[llength $command_list]>1} {
|
|
||||||
set full_command [lindex $command_list 1]
|
|
||||||
} else {
|
|
||||||
set full_command $command
|
|
||||||
}
|
|
||||||
# Use 'list' and not just {} because we want variables to
|
|
||||||
# be expanded in this list.
|
|
||||||
set l_stock_body [list\
|
|
||||||
"List of $full_command subcommands\:.*\[\r\n\]+"\
|
|
||||||
"Type \"help $full_command\" followed by $full_command subcommand name for full documentation\.\[\r\n\]+"\
|
|
||||||
"Type \"apropos word\" to search for commands related to \"word\"\.\[\r\n\]+"\
|
|
||||||
"Command name abbreviations are allowed if unambiguous\."]
|
|
||||||
set l_entire_body [concat $expected_initial_lines $l_stock_body]
|
|
||||||
if {[llength $args]>0} {
|
|
||||||
help_test_raw "help ${command}" $l_entire_body [lindex $args 0]
|
|
||||||
} else {
|
|
||||||
help_test_raw "help ${command}" $l_entire_body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# force the height of the debugger to be pretty large so no pagers getused
|
# force the height of the debugger to be pretty large so no pagers getused
|
||||||
gdb_test "set height 400" "" "test set height"
|
gdb_test "set height 400" "" "test set height"
|
||||||
|
|
||||||
|
|
|
@ -679,20 +679,15 @@ gdb_expect {
|
||||||
timeout { fail "(timeout) help maint info" }
|
timeout { fail "(timeout) help maint info" }
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "help maint print\n"
|
test_prefix_command_help {"maint print" "maintenance print"} {
|
||||||
gdb_expect {
|
"Maintenance command for printing GDB internal state\\.\[\r\n\]+"
|
||||||
-re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print architecture -- Print the internal architecture configuration.*maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
|
|
||||||
{ pass "help maint print" }
|
|
||||||
-re ".*$gdb_prompt $" { fail "help maint print" }
|
|
||||||
timeout { fail "(timeout) help maint print" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "help maint\n"
|
test_prefix_command_help {"maint" "maintenance"} {
|
||||||
gdb_expect {
|
"Commands for use by GDB maintainers\\.\[\r\n\]+"
|
||||||
-re "Commands for use by GDB maintainers\\.\[\r\n\]+Includes commands to dump specific internal GDB structures in\[\r\n\]+a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+to test internal functions such as the C\\+\\+/ObjC demangler, etc\\..*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
|
"Includes commands to dump specific internal GDB structures in\[\r\n\]+"
|
||||||
{ pass "help maint" }
|
"a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+"
|
||||||
-re ".*$gdb_prompt $" { fail "help maint" }
|
"to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+"
|
||||||
timeout { fail "(timeout) help maint" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#set oldtimeout $timeout
|
#set oldtimeout $timeout
|
||||||
|
|
|
@ -29,13 +29,17 @@ proc test_help {} {
|
||||||
set first_component_help "Print the first class/namespace component of NAME"
|
set first_component_help "Print the first class/namespace component of NAME"
|
||||||
set namespace_help "Print the list of possible C\\+\\+ namespaces"
|
set namespace_help "Print the list of possible C\\+\\+ namespaces"
|
||||||
|
|
||||||
|
test_prefix_command_help {"maintenance cplus"} {
|
||||||
|
"C\\+\\+ maintenance commands\.\[\r\n\]+"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_prefix_command_help {"maint cp" "maintenance cplus"} {
|
||||||
|
"C\\+\\+ maintenance commands.\r\n\r\n"
|
||||||
|
}
|
||||||
|
|
||||||
set multiple_help_body "List of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- ${first_component_help}\r\nmaintenance cplus namespace -- ${namespace_help}\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
|
set multiple_help_body "List of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- ${first_component_help}\r\nmaintenance cplus namespace -- ${namespace_help}\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
|
||||||
|
|
||||||
set help_maint_cp "C\\+\\+ maintenance commands.\r\n\r\n${multiple_help_body}"
|
gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\n.*"
|
||||||
|
|
||||||
gdb_test "help maintenance cplus" "${help_maint_cp}"
|
|
||||||
gdb_test "help maint cp" "${help_maint_cp}"
|
|
||||||
gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\n${multiple_help_body}"
|
|
||||||
|
|
||||||
gdb_test "help maint cp first_component" "${first_component_help}."
|
gdb_test "help maint cp first_component" "${first_component_help}."
|
||||||
gdb_test "help maint cp namespace" "${namespace_help}."
|
gdb_test "help maint cp namespace" "${namespace_help}."
|
||||||
|
|
|
@ -66,109 +66,9 @@ set testline2 [expr $baseline + 3]
|
||||||
#
|
#
|
||||||
|
|
||||||
set helpcnt 0;
|
set helpcnt 0;
|
||||||
send_gdb "help tracepoints\n"
|
test_class_help "tracepoints" {
|
||||||
gdb_expect {
|
"Tracing of program execution without stopping the program\.[\r\n\]+"
|
||||||
-re "Tracing of program execution without stopping the program." {
|
} "1.0: help tracepoints"
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "actions -- Specify the actions to be taken at a tracepoint" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "collect -- Specify one or more data items to be collected" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "delete tracepoints -- Delete specified tracepoints" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "end -- Ends a list of.*actions" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "info tracepoints -- Status of tracepoints" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "passcount -- Set the passcount for a tracepoint" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "save-tracepoints -- Save current tracepoint definitions" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tdump -- Print everything collected at the current tracepoint" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind -- Select a trace frame" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind end -- Synonym for 'none'" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind line -- Select a trace frame by line number" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind none -- De-select any trace frame and resume 'live' debugging" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind outside -- Select a trace frame whose PC is outside" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind pc -- Select a trace frame by PC" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind range -- Select a trace frame whose PC is in the given" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind start -- Select the first trace frame in the trace buffer" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tfind tracepoint -- Select a trace frame by tracepoint number" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "trace -- Set a tracepoint at a specified line or function or addr" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tstart -- Start trace data collection" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tstatus -- Display the status of the current trace data collection" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "tstop -- Stop trace data collection" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "while-stepping -- Specify single-stepping behavior at a tracepoint" {
|
|
||||||
incr helpcnt;
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re ".*$gdb_prompt $" {
|
|
||||||
if { $helpcnt == 21 } {
|
|
||||||
pass "1.0: help tracepoints"
|
|
||||||
} else {
|
|
||||||
warning "$helpcnt";
|
|
||||||
fail "1.0: help tracepoints"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# test trace command:
|
# test trace command:
|
||||||
|
|
|
@ -2409,3 +2409,61 @@ proc gdb_gnu_strip_debug { dest args } {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Test the output of GDB_COMMAND matches the pattern obtained
|
||||||
|
# by concatenating all elements of EXPECTED_LINES. This makes
|
||||||
|
# it possible to split otherwise very long string into pieces.
|
||||||
|
# If third argument is not empty, it's used as the name of the
|
||||||
|
# test to be printed on pass/fail.
|
||||||
|
proc help_test_raw { gdb_command expected_lines args } {
|
||||||
|
set message $gdb_command
|
||||||
|
if [llength $args]>0 then {
|
||||||
|
set message [lindex $args 0]
|
||||||
|
}
|
||||||
|
set expected_output [join $expected_lines ""]
|
||||||
|
gdb_test "${gdb_command}" "${expected_output}" $message
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test the output of "help COMMNAD_CLASS". EXPECTED_INITIAL_LINES
|
||||||
|
# are regular expressions that should match the beginning of output,
|
||||||
|
# before the list of commands in that class. The presence of
|
||||||
|
# command list and standard epilogue will be tested automatically.
|
||||||
|
proc test_class_help { command_class expected_initial_lines args } {
|
||||||
|
set l_stock_body {
|
||||||
|
"List of commands\:.*\[\r\n\]+"
|
||||||
|
"Type \"help\" followed by command name for full documentation\.\[\r\n\]+"
|
||||||
|
"Type \"apropos word\" to search for commands related to \"word\"\.[\r\n\]+"
|
||||||
|
"Command name abbreviations are allowed if unambiguous\."
|
||||||
|
}
|
||||||
|
set l_entire_body [concat $expected_initial_lines $l_stock_body]
|
||||||
|
|
||||||
|
eval [list help_test_raw "help ${command_class}" $l_entire_body] $args
|
||||||
|
}
|
||||||
|
|
||||||
|
# COMMAND_LIST should have either one element -- command to test, or
|
||||||
|
# two elements -- abbreviated command to test, and full command the first
|
||||||
|
# element is abbreviation of.
|
||||||
|
# The command must be a prefix command. EXPECTED_INITIAL_LINES
|
||||||
|
# are regular expressions that should match the beginning of output,
|
||||||
|
# before the list of subcommands. The presence of
|
||||||
|
# subcommand list and standard epilogue will be tested automatically.
|
||||||
|
proc test_prefix_command_help { command_list expected_initial_lines args } {
|
||||||
|
set command [lindex $command_list 0]
|
||||||
|
if {[llength $command_list]>1} {
|
||||||
|
set full_command [lindex $command_list 1]
|
||||||
|
} else {
|
||||||
|
set full_command $command
|
||||||
|
}
|
||||||
|
# Use 'list' and not just {} because we want variables to
|
||||||
|
# be expanded in this list.
|
||||||
|
set l_stock_body [list\
|
||||||
|
"List of $full_command subcommands\:.*\[\r\n\]+"\
|
||||||
|
"Type \"help $full_command\" followed by $full_command subcommand name for full documentation\.\[\r\n\]+"\
|
||||||
|
"Type \"apropos word\" to search for commands related to \"word\"\.\[\r\n\]+"\
|
||||||
|
"Command name abbreviations are allowed if unambiguous\."]
|
||||||
|
set l_entire_body [concat $expected_initial_lines $l_stock_body]
|
||||||
|
if {[llength $args]>0} {
|
||||||
|
help_test_raw "help ${command}" $l_entire_body [lindex $args 0]
|
||||||
|
} else {
|
||||||
|
help_test_raw "help ${command}" $l_entire_body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue