From 62f2f198cdf2e006f27f61dfa6210d276d7a8e37 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 13 May 2021 16:56:03 +0100 Subject: [PATCH] gdb/testsuite: resolve duplicate test names in gdb.guile/*.exp This commit resolves almost all of the remaining duplicate test names in gdb.guile/*.exp. This is done by either: - Making use of with_test_prefix, - Giving tests a unique name, - Extending the existing name to make it unique, - Not printing PASS lines for simple setup commands (e.g. loading support modules, or adjusting GDB internal settings not relating to guile). gdb/testsuite/ChangeLog: * gdb.guile/scm-frame-args.exp: Add with_test_prefix to resolve duplicate test names. * gdb.guile/scm-parameter.exp: Provide test names to avoid duplicate names based on the command being run. * gdb.guile/scm-symbol.exp: Extend test name to make it unique. * gdb.guile/scm-type.exp (restart_gdb): Don't print PASS line when loading a support module. (test_equality): Update test name to match the actual test, making the name unique in the process. * gdb.guile/scm-value.exp (test_value_in_inferior): Add test names to resolve duplicate tests. (test_inferior_function_call): Likewise. (test_subscript_regression): Likewise. --- gdb/testsuite/ChangeLog | 16 ++++++ gdb/testsuite/gdb.guile/scm-frame-args.exp | 58 +++++++++++----------- gdb/testsuite/gdb.guile/scm-parameter.exp | 9 ++-- gdb/testsuite/gdb.guile/scm-symbol.exp | 2 +- gdb/testsuite/gdb.guile/scm-type.exp | 6 +-- gdb/testsuite/gdb.guile/scm-value.exp | 23 ++++++--- 6 files changed, 69 insertions(+), 45 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index afcf2acc0ff..287313f5d01 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2021-05-10 Andrew Burgess + + * gdb.guile/scm-frame-args.exp: Add with_test_prefix to resolve + duplicate test names. + * gdb.guile/scm-parameter.exp: Provide test names to avoid + duplicate names based on the command being run. + * gdb.guile/scm-symbol.exp: Extend test name to make it unique. + * gdb.guile/scm-type.exp (restart_gdb): Don't print PASS line when + loading a support module. + (test_equality): Update test name to match the actual test, making + the name unique in the process. + * gdb.guile/scm-value.exp (test_value_in_inferior): Add test names + to resolve duplicate tests. + (test_inferior_function_call): Likewise. + (test_subscript_regression): Likewise. + 2021-05-10 Andrew Burgess * lib/guile.exp (gdb_scm_load_file): Use empty test name to diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.exp b/gdb/testsuite/gdb.guile/scm-frame-args.exp index f5c81747f01..89603cfc917 100644 --- a/gdb/testsuite/gdb.guile/scm-frame-args.exp +++ b/gdb/testsuite/gdb.guile/scm-frame-args.exp @@ -37,37 +37,35 @@ gdb_breakpoint [gdb_get_line_number "break-here"] gdb_continue_to_breakpoint "break-here" ".* break-here .*" # Test all combinations with raw off. - gdb_test_no_output "set print raw-frame-arguments off" - -gdb_test_no_output "set print frame-arguments none" -gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ - "frame pretty,none" - -#gdb_test_no_output "set guile print-stack full" - -gdb_test_no_output "set print frame-arguments scalars" -gdb_test "frame" ".*foo \\(x=42, ss=super struct = {\[.\]{3}}\\).*" \ - "frame pretty,scalars" - -gdb_test_no_output "set print frame-arguments all" -gdb_test "frame" \ - ".*foo \\(x=42, ss=super struct = {a = m=<1>, b = m=<2>}\\).*" \ - "frame pretty,all" +with_test_prefix "raw-frame-arguments=off" { + gdb_test_no_output "set print frame-arguments none" + gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ + "frame pretty,none" + + gdb_test_no_output "set print frame-arguments scalars" + gdb_test "frame" ".*foo \\(x=42, ss=super struct = {\[.\]{3}}\\).*" \ + "frame pretty,scalars" + + gdb_test_no_output "set print frame-arguments all" + gdb_test "frame" \ + ".*foo \\(x=42, ss=super struct = {a = m=<1>, b = m=<2>}\\).*" \ + "frame pretty,all" +} # Test all combinations with raw on. - gdb_test_no_output "set print raw-frame-arguments on" - -gdb_test_no_output "set print frame-arguments none" -gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ - "frame raw,none" - -gdb_test_no_output "set print frame-arguments scalars" -gdb_test "frame" ".*foo \\(x=42, ss=\[.\]{3}\\).*" \ - "frame raw,scalars" - -gdb_test_no_output "set print frame-arguments all" -gdb_test "frame" \ - ".*foo \\(x=42, ss={a = {m = 1}, b = {m = 2}}\\).*" \ - "frame raw,all" +with_test_prefix "raw-frame-arguments=on" { + gdb_test_no_output "set print frame-arguments none" + gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ + "frame raw,none" + + gdb_test_no_output "set print frame-arguments scalars" + gdb_test "frame" ".*foo \\(x=42, ss=\[.\]{3}\\).*" \ + "frame raw,scalars" + + gdb_test_no_output "set print frame-arguments all" + gdb_test "frame" \ + ".*foo \\(x=42, ss={a = {m = 1}, b = {m = 2}}\\).*" \ + "frame raw,all" +} diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp index 857f8c5eba7..67120b23366 100644 --- a/gdb/testsuite/gdb.guile/scm-parameter.exp +++ b/gdb/testsuite/gdb.guile/scm-parameter.exp @@ -161,11 +161,14 @@ gdb_test_multiline "restricted gdb parameter" \ "end" with_test_prefix "test-restricted-param" { - gdb_test "show test-restricted-param" "The value of the restricted parameter is 2." + gdb_test "show test-restricted-param" "The value of the restricted parameter is 2." \ + "test-restricted-param is initially 2" gdb_test_no_output "set test-restricted-param 10" - gdb_test "show test-restricted-param" "The value of the restricted parameter is 10." + gdb_test "show test-restricted-param" "The value of the restricted parameter is 10." \ + "test-restricted-param is now 10" gdb_test "set test-restricted-param 42" "Error: Range of parameter is 0-10." - gdb_test "show test-restricted-param" "The value of the restricted parameter is 2." + gdb_test "show test-restricted-param" "The value of the restricted parameter is 2." \ + "test-restricted-param is back to 2 again" } # Test registering a parameter that already exists. diff --git a/gdb/testsuite/gdb.guile/scm-symbol.exp b/gdb/testsuite/gdb.guile/scm-symbol.exp index 3e23c08eefc..38fe6026a0e 100644 --- a/gdb/testsuite/gdb.guile/scm-symbol.exp +++ b/gdb/testsuite/gdb.guile/scm-symbol.exp @@ -182,7 +182,7 @@ if ![gdb_guile_runto_main] { } gdb_breakpoint [gdb_get_line_number "Break at end."] -gdb_continue_to_breakpoint "Break at end." +gdb_continue_to_breakpoint "Break at end again" gdb_scm_test_silent_cmd "guile (define a (car (lookup-symbol \"a\")))" \ "get variable a for unload" gdb_test "guile (print (symbol-valid? a))" \ diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp index 517c99f8369..ccde98ca224 100644 --- a/gdb/testsuite/gdb.guile/scm-type.exp +++ b/gdb/testsuite/gdb.guile/scm-type.exp @@ -55,7 +55,7 @@ proc restart_gdb {exefile} { return 0 } gdb_scm_test_silent_cmd "guile (use-modules (gdb iterator))" \ - "load iterator module" + "load iterator module" 0 return 1 } @@ -176,9 +176,9 @@ proc test_equality {lang} { gdb_test "guile (print (eq? (value-type st) (value-type ar)))" \ "= #f" "test type eq? on not-equal types" gdb_test "guile (print (equal? (value-type st) (value-type st)))" \ - "= #t" "test type eq? on equal types" + "= #t" "test type equal? on equal types" gdb_test "guile (print (equal? (value-type st) (value-type ar)))" \ - "= #f" "test type eq? on not-equal types" + "= #f" "test type equal? on not-equal types" if {$lang == "c++"} { gdb_scm_test_silent_cmd "guile (define c (parse-and-eval \"c\"))" \ diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp index 982b9bf17b9..bd5b14999d8 100644 --- a/gdb/testsuite/gdb.guile/scm-value.exp +++ b/gdb/testsuite/gdb.guile/scm-value.exp @@ -132,21 +132,26 @@ proc test_value_in_inferior {} { gdb_test "gu (print (value-lazy? inval))" \ "#t" gdb_test "gu (define inval2 (value-add inval 1))" \ - "ERROR: Cannot access memory at address 0x0.*" $test + "ERROR: Cannot access memory at address 0x0.*" \ + "$test, using value in value-add" gdb_test "gu (value-fetch-lazy! inval))" \ - "ERROR: Cannot access memory at address 0x0.*" $test + "ERROR: Cannot access memory at address 0x0.*" \ + "$test, using value in value-fetch-lazy!" } gdb_test_no_output "gu (define argc-lazy (parse-and-eval \"argc\"))" gdb_test_no_output "gu (define argc-notlazy (parse-and-eval \"argc\"))" gdb_test_no_output "gu (value-fetch-lazy! argc-notlazy)" - gdb_test "gu (print (value-lazy? argc-lazy))" "= #t" + gdb_test "gu (print (value-lazy? argc-lazy))" "= #t" \ + "argc-lazy is initially lazy" gdb_test "gu (print (value-lazy? argc-notlazy))" "= #f" gdb_test "print argc" "= 1" "sanity check argc" - gdb_test "gu (print (value-lazy? argc-lazy))" "= #t" + gdb_test "gu (print (value-lazy? argc-lazy))" "= #t" \ + "argc-lazy is still lazy after argc is printed" gdb_test_no_output "set argc=2" gdb_test "gu (print argc-notlazy)" "= 1" gdb_test "gu (print argc-lazy)" "= 2" - gdb_test "gu (print (value-lazy? argc-lazy))" "= #f" + gdb_test "gu (print (value-lazy? argc-lazy))" "= #f" \ + "argc-lazy is no longer lazy" # Test string fetches, both partial and whole. gdb_test "print st" "\"divide et impera\"" @@ -239,7 +244,8 @@ proc test_inferior_function_call {} { "= void" # Correct inferior call with arguments. - gdb_test "p/x fp2" "= $hex.*" + gdb_test "p/x fp2" "= $hex.*" \ + "place fp2 into value history, the first time" gdb_scm_test_silent_cmd "gu (define fp2 (history-ref 0))" \ "get fp2 value from history" gdb_scm_test_silent_cmd "gu (set! fp2 (value-dereference fp2))" \ @@ -255,7 +261,8 @@ proc test_inferior_function_call {} { "ERROR: .*: Wrong type argument in position 1 \\(expecting function \\(value of TYPE_CODE_FUNC\\)\\): .*" # Incorrect number of arguments. - gdb_test "p/x fp2" "= $hex.*" + gdb_test "p/x fp2" "= $hex.*" \ + "place fp2 into value history, the second time" gdb_scm_test_silent_cmd "gu (define fp3 (history-ref 0))" \ "get fp3 value from history" gdb_scm_test_silent_cmd "gu (set! fp3 (value-dereference fp3))" \ @@ -334,7 +341,7 @@ proc test_subscript_regression {exefile lang} { } gdb_breakpoint [gdb_get_line_number "break to inspect struct and union"] - gdb_continue_to_breakpoint "break to inspect struct and union" + gdb_continue_to_breakpoint "break to inspect struct and union in $lang" gdb_scm_test_silent_cmd "gu (define intv (make-value 1))" \ "Create int value for subscript test" -- 2.30.2