[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3)
authorTom de Vries <tdevries@suse.de>
Sat, 2 Nov 2019 05:55:10 +0000 (06:55 +0100)
committerTom de Vries <tdevries@suse.de>
Sat, 2 Nov 2019 05:55:10 +0000 (06:55 +0100)
There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
        set message [lindex $args 2]
+       if { $message == [lindex $args 0] && [llength $args] == 3 } {
+           error "HERE"
+       }
     } else {
         set message [lindex $args 0]
     }
...
and fix all occurrences in the testsuite/gdb.cp subdir.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-11-02  Tom de Vries  <tdevries@suse.de>

* gdb.cp/anon-union.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.cp/cpexprs.exp: Same.
* gdb.cp/except-multi-location.exp: Same.
* gdb.cp/exceptprint.exp: Same.
* gdb.cp/gdb2384.exp: Same.
* gdb.cp/inherit.exp: Same.
* gdb.cp/m-static.exp: Same.
* gdb.cp/meth-typedefs.exp: Same.
* gdb.cp/misc.exp: Same.
* gdb.cp/namespace.exp: Same.
* gdb.cp/non-trivial-retval.exp: Same.
* gdb.cp/overload.exp: Same.
* gdb.cp/pr17132.exp: Same.
* gdb.cp/re-set-overloaded.exp: Same.
* gdb.cp/rvalue-ref-types.exp: Same.
* gdb.cp/templates.exp: Same.

Change-Id: I0254d0cea71e7376aedb078166188a8010eeaebe

17 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/anon-union.exp
gdb/testsuite/gdb.cp/cpexprs.exp
gdb/testsuite/gdb.cp/except-multi-location.exp
gdb/testsuite/gdb.cp/exceptprint.exp
gdb/testsuite/gdb.cp/gdb2384.exp
gdb/testsuite/gdb.cp/inherit.exp
gdb/testsuite/gdb.cp/m-static.exp
gdb/testsuite/gdb.cp/meth-typedefs.exp
gdb/testsuite/gdb.cp/misc.exp
gdb/testsuite/gdb.cp/namespace.exp
gdb/testsuite/gdb.cp/non-trivial-retval.exp
gdb/testsuite/gdb.cp/overload.exp
gdb/testsuite/gdb.cp/pr17132.exp
gdb/testsuite/gdb.cp/re-set-overloaded.exp
gdb/testsuite/gdb.cp/rvalue-ref-types.exp
gdb/testsuite/gdb.cp/templates.exp

index f6464e9246cd3184db9ba4b8e93484a2663196df..d89df03fc4cf1104a46457eedff585e28ce280d2 100644 (file)
@@ -1,3 +1,22 @@
+2019-11-02  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.cp/anon-union.exp: Drop superfluous 3rd argument to gdb_test.
+       * gdb.cp/cpexprs.exp: Same.
+       * gdb.cp/except-multi-location.exp: Same.
+       * gdb.cp/exceptprint.exp: Same.
+       * gdb.cp/gdb2384.exp: Same.
+       * gdb.cp/inherit.exp: Same.
+       * gdb.cp/m-static.exp: Same.
+       * gdb.cp/meth-typedefs.exp: Same.
+       * gdb.cp/misc.exp: Same.
+       * gdb.cp/namespace.exp: Same.
+       * gdb.cp/non-trivial-retval.exp: Same.
+       * gdb.cp/overload.exp: Same.
+       * gdb.cp/pr17132.exp: Same.
+       * gdb.cp/re-set-overloaded.exp: Same.
+       * gdb.cp/rvalue-ref-types.exp: Same.
+       * gdb.cp/templates.exp: Same.
+
 2019-11-01  Luis Machado  <luis.machado@linaro.org>
 
        PR gdb/25124
index ee056bcd118bd901e0f4e7a3be4db23c72b1bc3a..4bd7e199156b028ab83ef16ad6bb6709ce41d9c6 100644 (file)
@@ -134,7 +134,7 @@ gdb_test "print foo" \
     "print foo 9"
 
 # Step over next four assignments
-gdb_test "next 4" "53\[ \t\]*w = 45;" "next 4"
+gdb_test "next 4" "53\[ \t\]*w = 45;"
 
 # Tests for anon unions that are not members of a class or struct
 
index d7decaf542694a6ab570c03fb0faa43f54049007..be4a5a1bc934b4210c1710db8c705028e9c797cf 100644 (file)
@@ -705,12 +705,12 @@ gdb_test "set listsize 1"
 
 # "print METHOD"
 foreach name [get_functions print] {
-    gdb_test "print $name" [get $name print] "print $name"
+    gdb_test "print $name" [get $name print]
 }
 
 # "list METHOD"
 foreach name [get_functions list] {
-    gdb_test "list $name" [get $name list] "list $name"
+    gdb_test "list $name" [get $name list]
 }
 
 # Running to breakpoint -- use any function we can "list"
index 1258d893afbb97ca7d6cb7668ab83d3737688c28..e56928e245f8740bf3f20a2134031bd7e755691b 100644 (file)
@@ -64,12 +64,9 @@ proc test_multi_libstdcpp {static_bin static_lib} {
        return 0
     }
 
-    gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \
-       "catch catch"
-    gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \
-       "catch throw"
-    gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-       "catch rethrow"
+    gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)"
+    gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)"
+    gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)"
 
     set ws "\[ \t\]*"
     gdb_test "info breakpoints" \
index f6dcd0f5bdf9a43c1d2b41d114ea3ec1aaaf373f..de10454937a573fd06a60491d77c4c2a2819de1c 100644 (file)
@@ -60,12 +60,9 @@ proc do_exceptprint_tests {prefix output} {
     }
 }
 
-gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \
-    "catch catch"
-gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \
-    "catch throw"
-gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-    "catch rethrow"
+gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)"
+gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)"
+gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)"
 
 do_exceptprint_tests string "$hex \"hi bob\""
 do_exceptprint_tests int 23
index c18e5c9481b75c4e7ca3e58b9ec55c9b419e0469..03b3ad938dee8b32e77ebfc8741eb2de227e30ca 100644 (file)
@@ -53,8 +53,7 @@ gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
 gdb_continue_to_breakpoint "set breakpoint here"
 
 gdb_test "print d1.meth ()" \
-    ".*42.*" \
-    "print d1.meth ()"
+    ".*42.*"
 
 # Now try again.  gdb's without the fix will hopefully segv here
 
index ffe1e58b27346145f1081526aa2823ead1b3bdd6..bd89cf989a868ffc6253736ffd6b78034a850307 100644 (file)
@@ -479,9 +479,9 @@ proc test_print_svi_members { } {
     gdb_test "print g_vC.vC::vx" "$vhn = 10"
 
     # Print members of g_vC using compact form.
-    gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va"
-    gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc"
-    gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx"
+    gdb_test "print g_vC.va" "$vhn = 7"
+    gdb_test "print g_vC.vc" "$vhn = 9"
+    gdb_test "print g_vC.vx" "$vhn = 10"
 }
 
 # Single virtual inheritance, print complete classes.
index e729c685c93d7c3fba3d55662c1771094c80f50a..19b9182d83e75ba798856eea5c79580b21353d6f 100644 (file)
@@ -179,7 +179,7 @@ gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const flo
 
 # Also make sure static const members can be found via "info var".
 if { $non_dwarf } { setup_xfail *-*-* }
-gdb_test "info variable everywhere" "File .*/m-static\[.\]h.*const int gnu_obj_4::everywhere;" "info variable everywhere"
+gdb_test "info variable everywhere" "File .*/m-static\[.\]h.*const int gnu_obj_4::everywhere;"
 
 # Perhaps at some point test4 should also include a test for a static
 # const int that was initialized in the header file.  But I'm not sure
index 088315458445a927d383c18a12849821d1e64711..a767f7c92cbd798fda69738fcbe7336e93faa0fa 100644 (file)
@@ -181,8 +181,7 @@ foreach f [list "$func" "'$func'"] {
             "file: \".*$srcfile\", line number: $line2, symbol: \"B::$func_re\"" \
             "$line2${any}B::test${any}" \
             "file: \".*$srcfile\", line number: $line3, symbol: \"$func_re\"" \
-            "$line3${any}// test${any}"] \
-       "list $f"
+            "$line3${any}// test${any}"]
 
     delete_breakpoints
     gdb_test "break $f" "\\(3 locations\\)"
index 4397b4b3fe4d1dff493933ee7601cab807e85ea6..b5b01ced92e29469f125397cd0ea283cbf8f6690 100644 (file)
@@ -93,8 +93,8 @@ test_expr "set variable v_bool_array\[1\] = true" \
     "set a bool array elem"
 
 # bool constants
-gdb_test "print true" "\\$\[0-9\]* = true" "print true"
-gdb_test "print false" "\\$\[0-9\]* = false" "print false"
+gdb_test "print true" "\\$\[0-9\]* = true"
+gdb_test "print false" "\\$\[0-9\]* = false"
 
 # arithmetic conversions
 gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true"
index 32f673d2eed694b01ac441cab871ba991351d011..59842e1fe5683a7e0d3881100a06dbb8e58538bb 100644 (file)
@@ -71,12 +71,10 @@ gdb_test "up" ".*main.*" "up from marker1"
 # shouldn't work with quotes, I'm only including one version.
 
 gdb_test "print 'AAA::c'" \
-    "\\$\[0-9\]* = 0 '\\\\(0|000)'" \
-    "print 'AAA::c'"
+    "\\$\[0-9\]* = 0 '\\\\(0|000)'"
 
 gdb_test "print AAA::c" \
-    "\\$\[0-9\]* = 0 '\\\\(0|000)'" \
-    "print AAA::c"
+    "\\$\[0-9\]* = 0 '\\\\(0|000)'"
 
 # An object declared using "using".
 
@@ -106,13 +104,11 @@ gdb_test_multiple "info func xyzq" "info func xyzq" {
 # Call a function in a namespace
 
 gdb_test "print 'AAA::xyzq'('x')" \
-    "\\$\[0-9\]* = 97 'a'" \
-    "print 'AAA::xyzq'('x')"
+    "\\$\[0-9\]* = 97 'a'"
 
 gdb_test "print AAA::xyzq('x')" \
-    "\\$\[0-9\]* = 97 'a'" \
-    "print AAA::xyzq('x')"
-       
+    "\\$\[0-9\]* = 97 'a'"
+
 # Break on a function in a namespace
 
 gdb_test "break AAA::xyzq" \
@@ -126,12 +122,10 @@ gdb_test "break -qualified ::ensureOtherRefs" \
 # Call a function in a nested namespace
 
 gdb_test "print 'BBB::CCC::xyzq'('x')" \
-    "\\$\[0-9\]* = 122 'z'" \
-    "print 'BBB::CCC::xyzq'('x')"
+    "\\$\[0-9\]* = 122 'z'"
 
 gdb_test "print BBB::CCC::xyzq('x')" \
-    "\\$\[0-9\]* = 122 'z'" \
-    "print BBB::CCC::xyzq('x')"
+    "\\$\[0-9\]* = 122 'z'"
        
 # Break on a function in a nested namespace
 
@@ -146,12 +140,10 @@ gdb_test "break ::BBB::CCC::xyzq" \
 # Print address of a function in a class in a namespace
 
 gdb_test "print 'BBB::Class::xyzq'" \
-    "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>" \
-    "print 'BBB::Class::xyzq'"
+    "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>"
 
 gdb_test "print BBB::Class::xyzq" \
-    "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>" \
-    "print BBB::Class::xyzq"
+    "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>"
 
 # Break on a function in a class in a namespace
 
index f94562083277106d58e6544ada34ab70ce8de019..1109cff8c2fe6195f07dd6e99a45042bfcbafa8e 100644 (file)
@@ -30,8 +30,8 @@ if {![runto_main]} {
 gdb_breakpoint [gdb_get_line_number "Break here"]
 gdb_continue_to_breakpoint "Break here"
 
-gdb_test "p f1 (i1, i2)" ".* = {a = 123}" "p f1 (i1, i2)"
-gdb_test "p f2 (i1, i2)" ".* = {b = 123}" "p f2 (i1, i2)"
-gdb_test "p f22 (i1, i2)" ".* = {b1 = 123}" "p f22 (i1, i2)"
-gdb_test "p f3 (i1, i2)" ".* = {.* c = 123}" "p f3 (i1, i2)"
-gdb_test "p f4 (i1, i2)" ".* = {.* e = 123}" "p f4 (i1, i2)"
+gdb_test "p f1 (i1, i2)" ".* = {a = 123}"
+gdb_test "p f2 (i1, i2)" ".* = {b = 123}"
+gdb_test "p f22 (i1, i2)" ".* = {b1 = 123}"
+gdb_test "p f3 (i1, i2)" ".* = {.* c = 123}"
+gdb_test "p f4 (i1, i2)" ".* = {.* e = 123}"
index a169419f79e4d2ccb75e8d89cf09c1be3b07b177..5d7a5c772968c952e690e85e43f4ec46c605f079 100644 (file)
@@ -372,21 +372,17 @@ gdb_test "print intToChar(1)" "\\$\[0-9\]+ = 297"
 
 # Test expression evaluation with overloaded methods
 gdb_test "print foo::overload1arg" \
-    "non-unique member `overload1arg' requires type instantiation" \
-    "print foo::overload1arg"
+    "non-unique member `overload1arg' requires type instantiation"
 
 gdb_test "print foo::overload1arg(char***)" \
-    "no member function matches that type instantiation" \
-    "print foo::overload1arg(char***)"
+    "no member function matches that type instantiation"
 
 gdb_test "print foo::overload1arg(void)" \
-    "\\$$decimal = {int \\(foo \\*( const|)\\)} $hex <foo::overload1arg\\(\\)>" \
-    "print foo::overload1arg(void)"
+    "\\$$decimal = {int \\(foo \\*( const|)\\)} $hex <foo::overload1arg\\(\\)>"
 
 foreach t [list char "signed char" "unsigned char" "short" \
               "unsigned short" int "unsigned int" long "unsigned long" \
               float double] {
     gdb_test "print foo::overload1arg($t)" \
-       "\\$$decimal = {int \\(foo \\*( const|), $t\\)} $hex <foo::overload1arg\\($t\\)>" \
-       "print foo::overload1arg($t)"
+       "\\$$decimal = {int \\(foo \\*( const|), $t\\)} $hex <foo::overload1arg\\($t\\)>"
 }
index 117accd5bed2499ff783037e82654bb2ca2c279a..9a1608e6f2e88c3bf0211d0a76cde19129e7ad64 100644 (file)
@@ -30,11 +30,11 @@ if {![runto_main]} {
 gdb_breakpoint [gdb_get_line_number "Break here"]
 gdb_continue_to_breakpoint "Break here"
 
-gdb_test "ptype a_ptr->func ()" ".* = int" "ptype a_ptr->func ()"
-gdb_test "ptype a->func ()" ".* = int" "ptype a->func ()"
+gdb_test "ptype a_ptr->func ()" ".* = int"
+gdb_test "ptype a->func ()" ".* = int"
 gdb_test "p sizeof (a_ptr->func()) == sizeof (int)" ".* = true" \
   "p sizeof (a_ptr->func())"
 gdb_test "p sizeof (a->func()) == sizeof (int)" ".* = true" \
   "p sizeof (a->func())"
-gdb_test "p 1 && a->func()" ".* = true" "p 1 && a->func()"
-gdb_test "p 0 || a->func()" ".* = true" "p 0 || a->func()"
+gdb_test "p 1 && a->func()" ".* = true"
+gdb_test "p 0 || a->func()" ".* = true"
index 0112c687de20357bc1098ba136d0912cb9131355..18ff52be670c71121fbc896b91970ae37d777dcc 100644 (file)
@@ -36,7 +36,7 @@ clean_restart $testfile
 gdb_load_shlib ${sofile}
 
 gdb_test_no_output "set breakpoint pending yes"
-gdb_test "break C::C" {Breakpoint [0-9]+ \(C::C\) pending\.} "break C::C"
+gdb_test "break C::C" {Breakpoint [0-9]+ \(C::C\) pending\.}
 gdb_test_no_output {set variable $brk = $bpnum}
 
 # runto or runto_main would call delete_breakpoints.
index 9eb12f5ad0826e75a8ea36fd0ee862991b2f65ea..4db2cc4b1876019d3b14f20af2ed2ccf495b4ba9 100644 (file)
@@ -42,7 +42,7 @@ gdb_test "up" ".*main.*" "up from marker1 1"
 
 gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt" 
 
-gdb_test "ptype rrt" "type = short( int)? &&" "ptype rrt"
+gdb_test "ptype rrt" "type = short( int)? &&"
 
 gdb_test "print *rrpt" ".$decimal = -1" "print value of *rrpt"
 
@@ -52,11 +52,11 @@ gdb_test "print *rrpt" ".$decimal = -1" "print value of *rrpt"
 
 gdb_test "x /hd rrpt" "$hex:\[ \t\]*-1" "examine value at rrpt"
 
-gdb_test "ptype rrpt" "type = short( int)? \\*&&" "ptype rrpt"
+gdb_test "ptype rrpt" "type = short( int)? \\*&&"
 
 gdb_test "print rrat\[0\]" ".$decimal = 0" "print value of rrat\[0\]"
 
-gdb_test "ptype rrat" "type = short( int)? \\\(&&\\\)\\\[4\\\]" "ptype rrat"
+gdb_test "ptype rrat" "type = short( int)? \\\(&&\\\)\\\[4\\\]"
 
 gdb_test "print rrat\[1\]" ".$decimal = 1" "print value of rrat\[1\]"
 gdb_test "print rrat\[2\]" ".$decimal = 2" "print value of rrat\[2\]"
@@ -74,17 +74,17 @@ gdb_test "ptype rrC" "type = char &&"
 
 gdb_test "ptype rrUC" "type = unsigned char &&"
 
-gdb_test "ptype rrS" "type = short( int)? &&" "ptype rrS"
+gdb_test "ptype rrS" "type = short( int)? &&"
 
-gdb_test "ptype rrUS" "type = unsigned short( int)? &&" "ptype rrUS"
+gdb_test "ptype rrUS" "type = unsigned short( int)? &&"
 
 gdb_test "ptype rrI" "type = int &&"
 
 gdb_test "ptype rrUI" "type = unsigned int &&"
 
-gdb_test "ptype rrL" "type = long( int)? &&" "ptype rrL"
+gdb_test "ptype rrL" "type = long( int)? &&"
 
-gdb_test "ptype rrUL" "type = unsigned long( int)? &&" "ptype rrUL"
+gdb_test "ptype rrUL" "type = unsigned long( int)? &&"
 
 gdb_test "ptype rrF" "type = float &&"
 
index b178e2b67980c8bc59db003ea7c6989bf8c901b8..5825d21f2de70f8fffda2ab7cb4e2a8518ad9b03 100644 (file)
@@ -577,8 +577,7 @@ gdb_test_multiple "ptype/r Garply<Garply<char> >" "ptype Garply<Garply<char> >"
 # print out a function from a nested template name
 
 gdb_test "print Garply<Garply<char> >::garply" \
-    "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*(| const), int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>\[ \t\]*>::garply\\(int, (class |)Garply<char>\\)>" \
-    "print Garply<Garply<char> >::garply"
+    "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*(| const), int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>\[ \t\]*>::garply\\(int, (class |)Garply<char>\\)>"
 
 # djb - 06-03-2000
 # Now should work fine
This page took 0.065449 seconds and 4 git commands to generate.