2006-11-10 Vladimir Prus <vladimir@codesourcery.com>
authorVladimir Prus <vladimir@codesourcery.com>
Fri, 10 Nov 2006 16:58:53 +0000 (16:58 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Fri, 10 Nov 2006 16:58:53 +0000 (16:58 +0000)
        * 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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/completion.exp
gdb/testsuite/gdb.base/help.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.cp/maint.exp
gdb/testsuite/gdb.trace/tracecmd.exp
gdb/testsuite/lib/gdb.exp

index eb7c9e9712cae2384d2737353b5671e71d80181c..8e3dd057c5bd1089b644ec6c45d10a5348a80336 100644 (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
index 40102fae369fe26a1bf7d38974002fa7ad03b9ae..8295e3170ab5fe82d5e6d154f23dba7653aaf7f1 100644 (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 '"}
index f74fbea65db940afb8c90911bf1b602c38afefee..a76bec76a1613d736e64e1247f079998934b7739 100644 (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"
 
index bbbd2622e17b2b11c59fcecdeab07af9188c4f98..f3fe9ded04e8c5b3556be63cf6e5e26759250dba 100644 (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]
index 6b781dfc80a66d777ad29e0c756a8b186e9b25d7..15e76774caddff99cf0127ff8f83cac558633be1 100644 (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"
 
-    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."
+    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 help_maint_cp "C\\+\\+ maintenance commands.\r\n\r\n${multiple_help_body}"
+    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."
 
-    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}."
index 1609e67ac598e8520fba5d38bcc0a3c2f2c6e66d..3bf12800a50e0a016e7d5421c7ac6142aa7043ba 100644 (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:
index 86c7e1de0621527aeda7c8b7732315988d3f6555..3c1eb87774741bb84528e351f23f4a26996d4fb3 100644 (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
+    }
+}
This page took 0.048157 seconds and 4 git commands to generate.