From: Tom de Vries Date: Sat, 2 Nov 2019 05:55:10 +0000 (+0100) Subject: [gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e96ec2bab75a943e1666497b1389e297775af5a8;p=binutils-gdb.git [gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3) There's a pattern: ... gdb_test ... that can be written shorter as: ... gdb_test ... 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 * 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 --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f6464e9246c..d89df03fc4c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2019-11-02 Tom de Vries + + * 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 PR gdb/25124 diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp index ee056bcd118..4bd7e199156 100644 --- a/gdb/testsuite/gdb.cp/anon-union.exp +++ b/gdb/testsuite/gdb.cp/anon-union.exp @@ -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 diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp index d7decaf5426..be4a5a1bc93 100644 --- a/gdb/testsuite/gdb.cp/cpexprs.exp +++ b/gdb/testsuite/gdb.cp/cpexprs.exp @@ -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" diff --git a/gdb/testsuite/gdb.cp/except-multi-location.exp b/gdb/testsuite/gdb.cp/except-multi-location.exp index 1258d893afb..e56928e245f 100644 --- a/gdb/testsuite/gdb.cp/except-multi-location.exp +++ b/gdb/testsuite/gdb.cp/except-multi-location.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp index f6dcd0f5bdf..de10454937a 100644 --- a/gdb/testsuite/gdb.cp/exceptprint.exp +++ b/gdb/testsuite/gdb.cp/exceptprint.exp @@ -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 diff --git a/gdb/testsuite/gdb.cp/gdb2384.exp b/gdb/testsuite/gdb.cp/gdb2384.exp index c18e5c9481b..03b3ad938de 100644 --- a/gdb/testsuite/gdb.cp/gdb2384.exp +++ b/gdb/testsuite/gdb.cp/gdb2384.exp @@ -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 diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index ffe1e58b273..bd89cf989a8 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -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. diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp index e729c685c93..19b9182d83e 100644 --- a/gdb/testsuite/gdb.cp/m-static.exp +++ b/gdb/testsuite/gdb.cp/m-static.exp @@ -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 diff --git a/gdb/testsuite/gdb.cp/meth-typedefs.exp b/gdb/testsuite/gdb.cp/meth-typedefs.exp index 08831545844..a767f7c92cb 100644 --- a/gdb/testsuite/gdb.cp/meth-typedefs.exp +++ b/gdb/testsuite/gdb.cp/meth-typedefs.exp @@ -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\\)" diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp index 4397b4b3fe4..b5b01ced92e 100644 --- a/gdb/testsuite/gdb.cp/misc.exp +++ b/gdb/testsuite/gdb.cp/misc.exp @@ -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" diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index 32f673d2eed..59842e1fe56 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -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 " \ - "print 'BBB::Class::xyzq'" + "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex " gdb_test "print BBB::Class::xyzq" \ - "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex " \ - "print BBB::Class::xyzq" + "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex " # Break on a function in a class in a namespace diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.exp b/gdb/testsuite/gdb.cp/non-trivial-retval.exp index f9456208327..1109cff8c2f 100644 --- a/gdb/testsuite/gdb.cp/non-trivial-retval.exp +++ b/gdb/testsuite/gdb.cp/non-trivial-retval.exp @@ -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}" diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index a169419f79e..5d7a5c77296 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -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 " \ - "print foo::overload1arg(void)" + "\\$$decimal = {int \\(foo \\*( const|)\\)} $hex " 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 " \ - "print foo::overload1arg($t)" + "\\$$decimal = {int \\(foo \\*( const|), $t\\)} $hex " } diff --git a/gdb/testsuite/gdb.cp/pr17132.exp b/gdb/testsuite/gdb.cp/pr17132.exp index 117accd5bed..9a1608e6f2e 100644 --- a/gdb/testsuite/gdb.cp/pr17132.exp +++ b/gdb/testsuite/gdb.cp/pr17132.exp @@ -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" diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.exp b/gdb/testsuite/gdb.cp/re-set-overloaded.exp index 0112c687de2..18ff52be670 100644 --- a/gdb/testsuite/gdb.cp/re-set-overloaded.exp +++ b/gdb/testsuite/gdb.cp/re-set-overloaded.exp @@ -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. diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp index 9eb12f5ad08..4db2cc4b187 100644 --- a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp +++ b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp @@ -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 &&" diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index b178e2b6798..5825d21f2de 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -577,8 +577,7 @@ gdb_test_multiple "ptype/r Garply >" "ptype Garply >" # print out a function from a nested template name gdb_test "print Garply >::garply" \ - "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*(| const), int, (class |)Garply\\)\\} $hex \[ \t\]*>::garply\\(int, (class |)Garply\\)>" \ - "print Garply >::garply" + "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*(| const), int, (class |)Garply\\)\\} $hex \[ \t\]*>::garply\\(int, (class |)Garply\\)>" # djb - 06-03-2000 # Now should work fine