diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-02-01 12:49:02 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-03-05 16:35:23 +0000 |
commit | b208792b31cf194f069af034290b8df6d3ee27c3 (patch) | |
tree | fc5634443f5efc482c50639577ea7a2d410b9ea6 /gdb | |
parent | 533c24e167926995da0a03083f41b8d88141d938 (diff) | |
download | gdb-b208792b31cf194f069af034290b8df6d3ee27c3.zip gdb-b208792b31cf194f069af034290b8df6d3ee27c3.tar.gz gdb-b208792b31cf194f069af034290b8df6d3ee27c3.tar.bz2 |
gdb/testsuite: fix some more duplicate test names in gdb.trace/
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.
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:
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,
2. Using prepare_for_testing removes the need to call clean_restart
immediately afterwards, so those calls are removed,
3. I removed the unneeded $executable and $expfile globals, where
the $executable global was used I've replaced this with $binfile,
4. When we compile two executables I've now given these different
names so that both exist at the end of the test run,
5. Removed a gdb_reinitialize_dir call, this is covered by
clean_restart,
6. Use gdb_test_no_output where it makes sense.
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.trace/ftrace-lock.exp | 45 | ||||
-rw-r--r-- | 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.trace/ftrace-lock.exp index eb0d0f0..ce2b890 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" require allow_shlib_tests +# Check that the target supports trace. +require gdb_trace_common_supports_arch + standard_testfile -set executable $testfile -set expfile $testfile.exp # make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2' if ![info exists NUM_THREADS] { @@ -27,25 +28,23 @@ if ![info exists NUM_THREADS] { # 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=-DNUM_THREADS=$NUM_THREADS] -# Check that the target supports trace. -require gdb_trace_common_supports_arch -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - 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 + } -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } -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 + } } # Compile the test case with the in-process agent library. @@ -54,13 +53,11 @@ set remote_libipa [gdb_load_shlib $libipa] lappend options shlib=$libipa -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - untested "failed to compile with in-process agent library" - return -1 +if { [prepare_for_testing "prepare for testing with libipa" \ + $binfile $srcfile $options] } { + return } -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" -gdb_test "tstart" "" +gdb_test_no_output "tstart" # 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" } -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 bfa66dd..e56064b 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" standard_testfile -set executable $testfile -set expfile $testfile.exp # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] require gdb_trace_common_supports_arch -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags] ] != "" } { - # 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 + } -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } -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 + } } -proc step_over_tracepoint { trace_type } \ +proc step_over_tracepoint { binfile trace_type } \ {with_test_prefix "step over $trace_type" \ { - global executable global hex # 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 } \ # Set breakpoint and tracepoint at the same address. -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 # 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 } \ }} foreach break_always_inserted { "on" "off" } { - break_trace_same_addr "trace" ${break_always_inserted} + break_trace_same_addr $binfile "trace" ${break_always_inserted} } -step_over_tracepoint "trace" +step_over_tracepoint $binfile "trace" require allow_shlib_tests @@ -111,24 +107,22 @@ set libipa [get_in_proc_agent] set remote_libipa [gdb_load_shlib $libipa] # Compile test case again with IPA. -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags shlib=$libipa] ] != "" } { - 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=$libipa]] } { + return } -clean_restart ${executable} if ![runto_main] { return 0 } -gdb_reinitialize_dir $srcdir/$subdir if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 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} } - step_over_tracepoint "ftrace" + step_over_tracepoint $binfile_ipa "ftrace" } |