From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id A46D83858D20; Tue, 5 Mar 2024 16:35:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A46D83858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709656537; bh=plVlVo1Y2A3peP08lM1Qmvd8AralPmeYFv2SQHlMFCY=; h=From:To:Subject:Date:From; b=G9eHCi9nG3P0SaAlhKwqhSLPesxv0f4fXsa96Th15Y5bPGWGpolrlyCyEgziag0o3 L1JmOgO63YgvWzGGU3iIcbnxmtln9oy22aQ4Ix1fH/Om/28rqHXgbNVWuwGIKwZbyI E7WR3gaNf1OvTfMS0T83QLxkykSIhkUNmz9nl34U= 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 some more duplicate test names in gdb.trace/ X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 533c24e167926995da0a03083f41b8d88141d938 X-Git-Newrev: b208792b31cf194f069af034290b8df6d3ee27c3 Message-Id: <20240305163537.A46D83858D20@sourceware.org> Date: Tue, 5 Mar 2024 16:35:37 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db208792b31cf= 194f069af034290b8df6d3ee27c3 commit b208792b31cf194f069af034290b8df6d3ee27c3 Author: Andrew Burgess Date: Thu Feb 1 12:49:02 2024 +0000 gdb/testsuite: fix some more duplicate test names in gdb.trace/ =20 This commit fixes some duplicate test names in the gdb.trace/ directory when run with the native-gdbserver and native-extended-gdbserver boards. In this case the duplicates relate to the calls to gdb_compile_pthreads which emits a fixed PASS message, as there are two calls to gdb_compile_pthreads we get a duplicate PASS message. =20 In both cases the problem is fixed by adding a with_test_prefix around one of the compilations, however, I've made additional changes to clean up the tests a little while I was working on them: =20 1. Switch to use prepare_for_testing instead of gdb_compile_pthreads. By passing the 'pthreads' option this does call gdb_compile_pthreads under the hood, but using the standard compile function is cleaner, =20 2. Using prepare_for_testing removes the need to call clean_restart immediately afterwards, so those calls are removed, =20 3. I removed the unneeded $executable and $expfile globals, where the $executable global was used I've replaced this with $binfile, =20 4. When we compile two executables I've now given these different names so that both exist at the end of the test run, =20 5. Removed a gdb_reinitialize_dir call, this is covered by clean_restart, =20 6. Use gdb_test_no_output where it makes sense. =20 I now see no duplicate test names when running these test scripts. There should be no change in what is being tested after this commit. Diff: --- gdb/testsuite/gdb.trace/ftrace-lock.exp | 45 +++++++++++++------------- gdb/testsuite/gdb.trace/trace-mt.exp | 56 +++++++++++++++--------------= ---- 2 files changed, 46 insertions(+), 55 deletions(-) diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.tr= ace/ftrace-lock.exp index eb0d0f02933..ce2b890229a 100644 --- a/gdb/testsuite/gdb.trace/ftrace-lock.exp +++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp @@ -16,9 +16,10 @@ load_lib "trace-support.exp" =20 require allow_shlib_tests =20 +# Check that the target supports trace. +require gdb_trace_common_supports_arch + standard_testfile -set executable $testfile -set expfile $testfile.exp =20 # make check RUNTESTFLAGS=3D'gdb.trace/ftrace-lock.exp NUM_THREADS=3D2' if ![info exists NUM_THREADS] { @@ -27,25 +28,23 @@ if ![info exists NUM_THREADS] { =20 # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -set options [list debug [gdb_target_symbol_prefix_flags] \ +set options [list debug pthreads [gdb_target_symbol_prefix_flags] \ additional_flags=3D-DNUM_THREADS=3D$NUM_THREADS] =20 -# Check that the target supports trace. -require gdb_trace_common_supports_arch -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable = $options] !=3D "" } { - untested "failed to compile" - return -1 -} - -clean_restart ${testfile} +with_test_prefix "runtime trace support check" { + if { [prepare_for_testing "prepare for testing" ${binfile}-check \ + $srcfile $options] } { + return + } =20 -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } =20 -if ![gdb_target_supports_trace] { - unsupported "target does not support trace" - return -1 + if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 + } } =20 # Compile the test case with the in-process agent library. @@ -54,13 +53,11 @@ set remote_libipa [gdb_load_shlib $libipa] =20 lappend options shlib=3D$libipa =20 -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable = $options] !=3D "" } { - untested "failed to compile with in-process agent library" - return -1 +if { [prepare_for_testing "prepare for testing with libipa" \ + $binfile $srcfile $options] } { + return } =20 -clean_restart ${executable} - if ![runto_main] { return -1 } @@ -76,7 +73,7 @@ gdb_breakpoint "fail" qualified gdb_test "ftrace set_point" "Fast tracepoint .*" \ "fast tracepoint at a long insn" =20 -gdb_test "tstart" "" +gdb_test_no_output "tstart" =20 # If NUM_THREADS is high then this test case may timeout. Increase the # timeout temporarily. @@ -86,4 +83,4 @@ with_timeout_factor $NUM_THREADS { "do not hit the fail function" } =20 -gdb_test "tstop" "" +gdb_test_no_output "tstop" diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace= /trace-mt.exp index bfa66dd88ee..e56064bbe8b 100644 --- a/gdb/testsuite/gdb.trace/trace-mt.exp +++ b/gdb/testsuite/gdb.trace/trace-mt.exp @@ -15,39 +15,36 @@ load_lib "trace-support.exp" =20 standard_testfile -set executable $testfile -set expfile $testfile.exp =20 # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] =20 require gdb_trace_common_supports_arch =20 -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags] ] !=3D "" } { - # gdb_compile_pthreads provides an appropriate unsupported message. - return -1 -} - -clean_restart ${testfile} +with_test_prefix "runtime trace support check" { + if { [prepare_for_testing "prepare for testing" ${binfile} $srcfile \ + [list debug pthreads $additional_flags]] } { + return + } =20 -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } =20 -if ![gdb_target_supports_trace] { - unsupported "target does not support trace" - return -1 + if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 + } } =20 -proc step_over_tracepoint { trace_type } \ +proc step_over_tracepoint { binfile trace_type } \ {with_test_prefix "step over $trace_type" \ { - global executable global hex =20 # Start with a fresh gdb. - clean_restart ${executable} + clean_restart $binfile + # Make sure inferior is running in all-stop mode. gdb_test_no_output "set non-stop 0" if ![runto_main] { @@ -66,14 +63,13 @@ proc step_over_tracepoint { trace_type } \ =20 # Set breakpoint and tracepoint at the same address. =20 -proc break_trace_same_addr { trace_type option } \ +proc break_trace_same_addr { binfile trace_type option } \ {with_test_prefix "$trace_type $option" \ { - global executable global hex =20 # Start with a fresh gdb. - clean_restart ${executable} + clean_restart $binfile if ![runto_main] { return -1 } @@ -100,10 +96,10 @@ proc break_trace_same_addr { trace_type option } \ }} =20 foreach break_always_inserted { "on" "off" } { - break_trace_same_addr "trace" ${break_always_inserted} + break_trace_same_addr $binfile "trace" ${break_always_inserted} } =20 -step_over_tracepoint "trace" +step_over_tracepoint $binfile "trace" =20 require allow_shlib_tests =20 @@ -111,24 +107,22 @@ set libipa [get_in_proc_agent] set remote_libipa [gdb_load_shlib $libipa] =20 # Compile test case again with IPA. -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags shlib=3D$libipa] ] !=3D "" } { - untested "failed to compile with in-process agent library" - return -1 +set binfile_ipa ${binfile}-ipa +if { [prepare_for_testing "prepare for testing" $binfile_ipa $srcfile \ + [list debug pthreads $additional_flags shlib=3D$libipa]] } { + return } -clean_restart ${executable} =20 if ![runto_main] { return 0 } =20 -gdb_reinitialize_dir $srcdir/$subdir if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != =3D 0 } { untested "could not find IPA lib loaded" } else { foreach break_always_inserted { "on" "off" } { - break_trace_same_addr "ftrace" ${break_always_inserted} + break_trace_same_addr $binfile_ipa "ftrace" ${break_always_inserted} } =20 - step_over_tracepoint "ftrace" + step_over_tracepoint $binfile_ipa "ftrace" }