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:
Vladimir Prus 2006-11-10 16:58:53 +00:00
parent 73ca250004
commit d8295fe954
7 changed files with 92 additions and 183 deletions

View File

@ -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>
* gdb.stabs/weird.exp (print_weird_var): Use

View File

@ -313,7 +313,7 @@ gdb_expect {
-re "^info $"\
{ send_gdb "\n"
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'"}
-re ".*$gdb_prompt $" { fail "complete 'info'"}
timeout {fail "(timeout) complete 'info'"}
@ -329,7 +329,7 @@ gdb_expect {
-re "^info \\\x07$"\
{ send_gdb "\n"
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 '"}
-re ".*$gdb_prompt $" { fail "complete 'info '"}
timeout {fail "(timeout) complete 'info '"}

View File

@ -30,65 +30,6 @@ set bug_id 0
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
gdb_test "set height 400" "" "test set height"

View File

@ -679,21 +679,16 @@ gdb_expect {
timeout { fail "(timeout) help maint info" }
}
send_gdb "help maint print\n"
gdb_expect {
-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" }
}
test_prefix_command_help {"maint print" "maintenance print"} {
"Maintenance command for printing GDB internal state\\.\[\r\n\]+"
}
send_gdb "help maint\n"
gdb_expect {
-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 $"\
{ pass "help maint" }
-re ".*$gdb_prompt $" { fail "help maint" }
timeout { fail "(timeout) help maint" }
}
test_prefix_command_help {"maint" "maintenance"} {
"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\\.\[\r\n\]+"
}
#set oldtimeout $timeout
#set timeout [expr $timeout + 300]

View File

@ -29,13 +29,17 @@ proc test_help {} {
set first_component_help "Print the first class/namespace component of NAME"
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 help_maint_cp "C\\+\\+ maintenance commands.\r\n\r\n${multiple_help_body}"
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 "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\n.*"
gdb_test "help maint cp first_component" "${first_component_help}."
gdb_test "help maint cp namespace" "${namespace_help}."

View File

@ -66,109 +66,9 @@ set testline2 [expr $baseline + 3]
#
set helpcnt 0;
send_gdb "help tracepoints\n"
gdb_expect {
-re "Tracing of program execution without stopping the program." {
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_class_help "tracepoints" {
"Tracing of program execution without stopping the program\.[\r\n\]+"
} "1.0: help tracepoints"
#
# test trace command:

View File

@ -2409,3 +2409,61 @@ proc gdb_gnu_strip_debug { dest args } {
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
}
}