From 4a0a0bd20a48fad8af0e78d90955db9b6e291a34 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 13 May 2021 17:04:35 +0100 Subject: [PATCH] gdb/testsuite: resolve remaining duplicate tests in gdb.guile/ The remaining duplicates are resolved by adding a with_test_prefix and reindenting a proc. I also added a couple of additional test names to some of the tests. gdb/testsuite/ChangeLog: * gdb.guile/scm-pretty-print.exp (run_lang_tests): Give some tests unique names, also wrap proc body in with_test_prefix. --- gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.guile/scm-pretty-print.exp | 157 ++++++++++--------- 2 files changed, 86 insertions(+), 76 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 287313f5d01..c6821c1b950 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-05-10 Andrew Burgess + + * gdb.guile/scm-pretty-print.exp (run_lang_tests): Give some tests + unique names, also wrap proc body in with_test_prefix. + 2021-05-10 Andrew Burgess * gdb.guile/scm-frame-args.exp: Add with_test_prefix to resolve diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.exp b/gdb/testsuite/gdb.guile/scm-pretty-print.exp index 1544682e836..f1ed7141680 100644 --- a/gdb/testsuite/gdb.guile/scm-pretty-print.exp +++ b/gdb/testsuite/gdb.guile/scm-pretty-print.exp @@ -28,83 +28,88 @@ gdb_start if { [skip_guile_tests] } { continue } proc run_lang_tests {exefile lang} { - global srcdir subdir srcfile testfile hex - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } { - untested "failed to compile in $lang mode" - return + with_test_prefix "lang=$lang" { + global srcdir subdir srcfile testfile hex + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } { + untested "failed to compile in $lang mode" + return + } + + set nl "\[\r\n\]+" + + # Start with a fresh gdb. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${exefile} + + if ![gdb_guile_runto_main] { + return + } + + 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.*" + + set remote_scheme_file [gdb_remote_download host \ + ${srcdir}/${subdir}/${testfile}.scm] + + gdb_scm_load_file ${remote_scheme_file} + + gdb_test "print ss" " = a= b=<$hex>> b= b=<$hex>>" + gdb_test "print ssa\[1\]" " = a= b=<$hex>> b= b=<$hex>>" + gdb_test "print ssa" " = {a= b=<$hex>> b= b=<$hex>>, a= b=<$hex>> b= b=<$hex>>}" + + gdb_test "print arraystruct" " = {$nl *y = 7, *$nl *x = {a=<23> b=<$hex>, a=<24> b=<$hex>} *$nl *}" + + if {$lang == "c++"} { + gdb_test "print cps" "= a=<8> b=<$hex>" + gdb_test "print cpss" " = {$nl *zss = 9, *$nl *s = a=<10> b=<$hex>$nl}" + gdb_test "print cpssa\[0\]" " = {$nl *zss = 11, *$nl *s = a=<12> b=<$hex>$nl}" + gdb_test "print cpssa\[1\]" " = {$nl *zss = 13, *$nl *s = a=<14> b=<$hex>$nl}" + gdb_test "print cpssa" " = {{$nl *zss = 11, *$nl *s = a=<12> b=<$hex>$nl *}, {$nl *zss = 13, *$nl *s = a=<14> b=<$hex>$nl *}}" + gdb_test "print sss" "= a=<15> b= b=<$hex>>" + gdb_test "print ref" "= a=<15> b= 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\"" \ + "print ns with 200 elements" + gdb_test_no_output "set print elements 3" "" + gdb_test "print ns" "emb\.\.\.." \ + "print ns with 3 elements" + gdb_test_no_output "set print elements 10" "" + gdb_test "print ns" "embedded\\\\000n\.\.\.." \ + "print ns with 10 elements" + gdb_test_no_output "set print elements 200" "" + } + + if { ![is_address_zero_readable] } { + gdb_test "print ns2" "" + } + + gdb_test "print x" " = \"this is x\"" + gdb_test "print cstring" " = \"const string\"" + + gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\"" + + gdb_test_no_output "guile (set! *pp-ls-encoding* \"UTF-8\")" + gdb_test "print estring2" "\"embedded \", " + + gdb_test_no_output "set guile print-stack full" + gdb_test "print hint_error" "ERROR: Invalid display hint: 42\r\nhint_error_val" + + gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" + + gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}" + + gdb_test_no_output "set print pretty off" + gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \ + "print nstype on one line" + + gdb_continue_to_end } - - set nl "\[\r\n\]+" - - # Start with a fresh gdb. - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${exefile} - - if ![gdb_guile_runto_main] { - return - } - - 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.*" - - set remote_scheme_file [gdb_remote_download host \ - ${srcdir}/${subdir}/${testfile}.scm] - - gdb_scm_load_file ${remote_scheme_file} - - gdb_test "print ss" " = a= b=<$hex>> b= b=<$hex>>" - gdb_test "print ssa\[1\]" " = a= b=<$hex>> b= b=<$hex>>" - gdb_test "print ssa" " = {a= b=<$hex>> b= b=<$hex>>, a= b=<$hex>> b= b=<$hex>>}" - - gdb_test "print arraystruct" " = {$nl *y = 7, *$nl *x = {a=<23> b=<$hex>, a=<24> b=<$hex>} *$nl *}" - - if {$lang == "c++"} { - gdb_test "print cps" "= a=<8> b=<$hex>" - gdb_test "print cpss" " = {$nl *zss = 9, *$nl *s = a=<10> b=<$hex>$nl}" - gdb_test "print cpssa\[0\]" " = {$nl *zss = 11, *$nl *s = a=<12> b=<$hex>$nl}" - gdb_test "print cpssa\[1\]" " = {$nl *zss = 13, *$nl *s = a=<14> b=<$hex>$nl}" - gdb_test "print cpssa" " = {{$nl *zss = 11, *$nl *s = a=<12> b=<$hex>$nl *}, {$nl *zss = 13, *$nl *s = a=<14> b=<$hex>$nl *}}" - gdb_test "print sss" "= a=<15> b= b=<$hex>>" - gdb_test "print ref" "= a=<15> b= 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_scm_test_silent_cmd "set print elements 3" "" 1 - gdb_test "print ns" "emb\.\.\.." - gdb_scm_test_silent_cmd "set print elements 10" "" 1 - gdb_test "print ns" "embedded\\\\000n\.\.\.." - gdb_scm_test_silent_cmd "set print elements 200" "" 1 - } - - if { ![is_address_zero_readable] } { - gdb_test "print ns2" "" - } - - gdb_test "print x" " = \"this is x\"" - gdb_test "print cstring" " = \"const string\"" - - gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\"" - - gdb_test_no_output "guile (set! *pp-ls-encoding* \"UTF-8\")" - gdb_test "print estring2" "\"embedded \", " - - gdb_test_no_output "set guile print-stack full" - gdb_test "print hint_error" "ERROR: Invalid display hint: 42\r\nhint_error_val" - - gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" - - gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}" - - gdb_test_no_output "set print pretty off" - gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \ - "print nstype on one line" - - gdb_continue_to_end } run_lang_tests "${binfile}" "c" -- 2.30.2