diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-02-01 12:57:11 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-03-05 16:35:23 +0000 |
commit | f08311ceb1ba4e19eab7070e676416337455a074 (patch) | |
tree | e235e6651ace9eb96b81643b15f87db0ddd18e58 /gdb | |
parent | b208792b31cf194f069af034290b8df6d3ee27c3 (diff) | |
download | gdb-f08311ceb1ba4e19eab7070e676416337455a074.zip gdb-f08311ceb1ba4e19eab7070e676416337455a074.tar.gz gdb-f08311ceb1ba4e19eab7070e676416337455a074.tar.bz2 |
gdb/testsuite: fix duplicate test names in gdb.trace/circ.exp
This fixes some duplicate test names in gdb.trace/circ.exp when using
native-gdbserver and native-extended-gdbserver boards.
In this test we set the trace buffer size twice. The same test name
was used each time the size was adjusted.
I've fixed this issue by:
1. Creating a new proc, set_trace_buffer_size, which factors out the
code to change the buffer size, and uses test names based on the
size we're setting the buffer too,
2. Calling the new proc each time we want to adjust the buffer size.
After this the duplicate test names are resolved. There should be no
change in what is tested after this commit.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.trace/circ.exp | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp index 66bb648..d123a1e 100644 --- a/gdb/testsuite/gdb.trace/circ.exp +++ b/gdb/testsuite/gdb.trace/circ.exp @@ -115,45 +115,59 @@ gdb_test "show circular-trace-buffer" \ "Target's use of circular trace buffer is on." \ "show circular-trace-buffer (on)" -# Check if changing the trace buffer size is supported. This step is -# repeated twice. This helps in case the trace buffer size is 100. -set test_size 100 -set test "change buffer size to $test_size" -gdb_test_multiple "set trace-buffer-size $test_size" $test { - -re ".*Target does not support this command.*$gdb_prompt $" { - unsupported "target does not support changing trace buffer size" - return 1 +# Use 'set trace-buffer-size' to change the trace buffer size to +# REQUIRED_SIZE. Return -1 if the current target doesn't support +# adjusting the trace buffer size. Return 0 if the adjustment failed +# for some other reason. Return 1 if the trace buffer size was +# correctly adjusted. +# +# If this proc returns -1 then a suitable call to the unsupported proc +# will have already been made. +proc set_trace_buffer_size { required_size } { + set test_passed false + gdb_test_multiple "set trace-buffer-size $required_size" "" { + -re -wrap ".*Target does not support this command.*" { + unsupported "target does not support changing trace buffer size" + return -1 + } + -re -wrap "" { + pass $gdb_test_name + set test_passed true + } } - -re "$gdb_prompt $" { - pass $test + + if { !$test_passed } { + return 0 } -} -set test "check whether setting trace buffer size is supported" -gdb_test_multiple "tstatus" $test { - -re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gdb_prompt $" { - set total_size $expect_out(2,string) - if { $test_size != $total_size } { - unsupported "target does not support changing trace buffer size" - return 1 + set test_passed false + gdb_test_multiple "tstatus" "check trace-buffer-size is $required_size" { + -re -wrap ".*Trace buffer has ($::decimal) bytes of ($::decimal) bytes free.*" { + set total_size $expect_out(2,string) + if { $required_size != $total_size } { + unsupported "target does not support changing trace buffer size" + return -1 + } + pass $gdb_test_name + set test_passed true } - pass $test } + + if { !$test_passed } { + return 0 + } + + return 1 } -set test_size 400 -gdb_test_no_output "set trace-buffer-size $test_size" \ - "change buffer size to $test_size" +# Check if changing the trace buffer size is supported. This step is +# repeated twice. This helps in case the trace buffer size is 100. +if {[set_trace_buffer_size 100] < 0} { + return +} -gdb_test_multiple "tstatus" $test { - -re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gdb_prompt $" { - set total_size $expect_out(2,string) - if { $test_size != $total_size } { - unsupported "target does not support changing trace buffer size" - return 1 - } - pass $test - } +if {[set_trace_buffer_size 400] < 0} { + return } gdb_test_no_output "set circular-trace-buffer off" \ |