From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 256CB3858C54; Tue, 5 Mar 2024 16:35:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 256CB3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709656543; bh=U+HIRZ+Xac79JCdOT/kB3D5qbBO5FthJJ+vzM8w2Sus=; h=From:To:Subject:Date:From; b=Mp/297Q63a/hRxtJ1PkQ2y9Z7xrBxLxLeoOFj33X2oBpNNWujmAg3J3DXWjZhFuFu /wE5uJl9IDaJ9VCtjLwoMnpPvxWTUCrZK4QWbT0x7Vp36ogmhngS3esYo8z98nRgGF kQXtbhHyMiqg7Y9SuXcdvn70w90BgJ5oYscxXuEY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix duplicate test names in gdb.trace/circ.exp X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: b208792b31cf194f069af034290b8df6d3ee27c3 X-Git-Newrev: f08311ceb1ba4e19eab7070e676416337455a074 Message-Id: <20240305163543.256CB3858C54@sourceware.org> Date: Tue, 5 Mar 2024 16:35:42 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df08311ceb1ba= 4e19eab7070e676416337455a074 commit f08311ceb1ba4e19eab7070e676416337455a074 Author: Andrew Burgess Date: Thu Feb 1 12:57:11 2024 +0000 gdb/testsuite: fix duplicate test names in gdb.trace/circ.exp =20 This fixes some duplicate test names in gdb.trace/circ.exp when using native-gdbserver and native-extended-gdbserver boards. =20 In this test we set the trace buffer size twice. The same test name was used each time the size was adjusted. =20 I've fixed this issue by: =20 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, =20 2. Calling the new proc each time we want to adjust the buffer size. =20 After this the duplicate test names are resolved. There should be no change in what is tested after this commit. Diff: --- gdb/testsuite/gdb.trace/circ.exp | 76 ++++++++++++++++++++++++------------= ---- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/cir= c.exp index 66bb64852fd..d123a1e7686 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)" =20 -# 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 } -} =20 -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.*$gd= b_prompt $" { - set total_size $expect_out(2,string) - if { $test_size !=3D $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 fr= ee.*" { + set total_size $expect_out(2,string) + if { $required_size !=3D $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 } =20 -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 +} =20 -gdb_test_multiple "tstatus" $test { - -re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gd= b_prompt $" { - set total_size $expect_out(2,string) - if { $test_size !=3D $total_size } { - unsupported "target does not support changing trace buffer size" - return 1 - } - pass $test - } +if {[set_trace_buffer_size 400] < 0} { + return } =20 gdb_test_no_output "set circular-trace-buffer off" \