From 3714a195e08a5cc7713b27def7a3c3b534da53e8 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Sat, 23 Mar 2019 22:49:09 +0000 Subject: [PATCH] gdb/testsuite: Make test names unique in gdb.python/py-prettyprint.exp This makes the test names unique in gdb.python/py-prettyprint.exp, it also switches to use gdb_breakpoint and gdb_continue_to_breakpoint more so that we avoid test names with the source line number in - this is bad if the test source ever changes as the test names will then change. One final change is to switch from using gdb_py_test_silent_cmd to use gdb_test_no_output, the former should be used for running python commands and can catch any thrown exception. However, in this case the command being run is not a python command, its just a normal GDB CLI command that produces no output, so lets use the appropriate wrapper function. gdb/testsuite/ChangeLog: * gdb.python/py-prettyprint.exp: Use gdb_breakpoint and gdb_continue_to_breakpoint more throughout this test. (run_lang_tests) Supply unique test names, and use gdb_test_no_output. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.python/py-prettyprint.exp | 26 ++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a2b8f24..04a90fc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2019-03-26 Andrew Burgess + * gdb.python/py-prettyprint.exp: Use gdb_breakpoint and + gdb_continue_to_breakpoint more throughout this test. + (run_lang_tests) Supply unique test names, and use + gdb_test_no_output. + +2019-03-26 Andrew Burgess + * gdb.base/finish-pretty.exp: Update expected results. * gdb.base/pretty-print.c: New file. * gdb.base/pretty-print.exp: New file. diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index 5ec5fdb..3359082 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -49,9 +49,9 @@ proc run_lang_tests {exefile lang} { gdb_test_no_output "set print pretty on" - gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ - ".*Breakpoint.*" - gdb_test "continue" ".*Breakpoint.*" + gdb_breakpoint [gdb_get_line_number "break to inspect" ${testfile}.c] + gdb_continue_to_breakpoint "break to inspect" ".*break to inspect.*" + set remote_python_file [gdb_remote_download host \ ${srcdir}/${subdir}/${testfile}.py] @@ -78,12 +78,15 @@ proc run_lang_tests {exefile lang} { gdb_test "print ref" "= a=<15> b=< a=<8> b=<$hex>>" gdb_test "print derived" \ " = \{.* = pp class name: Vbase1.* = \{.* = pp value variable is: 1,.*members of Vbase2:.*_vptr.Vbase2 = $hex.* = \{.*members of Vbase3.*members of Derived:.*value = 2.*" - gdb_test "print ns " "\"embedded\\\\000null\\\\000string\"" - gdb_py_test_silent_cmd "set print elements 3" "" 1 - gdb_test "print ns" "emb\.\.\.." - gdb_py_test_silent_cmd "set print elements 10" "" 1 - gdb_test "print ns" "embedded\\\\000n\.\.\.." - gdb_py_test_silent_cmd "set print elements 200" "" 1 + gdb_test "print ns " "\"embedded\\\\000null\\\\000string\"" \ + "print ns with default element limit" + gdb_test_no_output "set print elements 3" + gdb_test "print ns" "emb\.\.\.." \ + "print ns with element limit of 3" + gdb_test_no_output "set print elements 10" + gdb_test "print ns" "embedded\\\\000n\.\.\.." \ + "print ns with element limit of 10" + gdb_test_no_output "set print elements 200" } if { ![is_address_zero_readable] } { @@ -168,9 +171,8 @@ gdb_continue_to_breakpoint "eval-break" ".* eval-break .*" gdb_test "info locals" "eval9 = eval=<123456789>" -gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ - ".*Breakpoint.*" -gdb_test "continue" ".*Breakpoint.*" +gdb_breakpoint [gdb_get_line_number "break to inspect" ${testfile}.c ] +gdb_continue_to_breakpoint "break to inspect" ".*break to inspect.*" gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \ "print ss enabled #1" -- 2.7.4