From: Andrew Burgess Date: Mon, 15 Mar 2021 10:44:07 +0000 (+0000) Subject: gdb/testsuite: squash duplicate test names in gdb.threads/*.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f302f9e26e872a8da4b1d4556ea2eeebeca866e7;p=binutils-gdb.git gdb/testsuite: squash duplicate test names in gdb.threads/*.exp Resolve all of the duplicate test names in the gdb.threads/*.exp set of tests (that I see). Nothing very exciting here, mostly either giving tests explicit testnames, or adding with_test_prefix. The only interesting one is gdb.threads/execl.exp, I believe the duplicate test name was caused by an actual duplicate test. I've remove the simpler form of the test. I don't believe we've lost any test coverage with this change. gdb/testsuite/ChangeLog: * gdb.threads/execl.exp: Remove duplicate 'info threads' test. Make use of $gdb_test_name instead of creating a separate $test variable. * gdb.threads/print-threads.exp: Add a with_test_prefix instead of adding a '($name)' at the end of each test. This also catches the one place where '($name)' was missing, and so caused a duplicate test name. * gdb.threads/queue-signal.exp: Give tests unique names to avoid duplicate test names based on the command being tested. * gdb.threads/signal-command-multiple-signals-pending.exp: Likewise. * lib/gdb.exp (gdb_compile_shlib_pthreads): Tweak test name to avoid duplicate testnames when a test script uses this proc and also gdb_compile_pthreads. * lib/prelink-support.exp (build_executable_own_libs): Use with_test_prefix to avoid duplicate test names when we call build_executable twice. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6ed26d1979f..374ea394172 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2021-03-16 Andrew Burgess + + * gdb.threads/execl.exp: Remove duplicate 'info threads' test. + Make use of $gdb_test_name instead of creating a separate $test + variable. + * gdb.threads/print-threads.exp: Add a with_test_prefix instead of + adding a '($name)' at the end of each test. This also catches the + one place where '($name)' was missing, and so caused a duplicate + test name. + * gdb.threads/queue-signal.exp: Give tests unique names to avoid + duplicate test names based on the command being tested. + * gdb.threads/signal-command-multiple-signals-pending.exp: + Likewise. + * lib/gdb.exp (gdb_compile_shlib_pthreads): Tweak test name to + avoid duplicate testnames when a test script uses this proc and + also gdb_compile_pthreads. + * lib/prelink-support.exp (build_executable_own_libs): Use + with_test_prefix to avoid duplicate test names when we call + build_executable twice. + 2021-03-15 Tom Tromey * gdb.ada/fixed_points.exp: Add tests of unary + and -. diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp index db4c5d2f9b2..68341be4d21 100644 --- a/gdb/testsuite/gdb.threads/execl.exp +++ b/gdb/testsuite/gdb.threads/execl.exp @@ -54,21 +54,18 @@ gdb_test_no_output "delete 2" gdb_test "continue" ".*Breakpoint 1, main.*" \ "continue across exec" -gdb_test "info threads" ".*" "info threads after exec" - -set test "info threads after exec" -gdb_test_multiple "info threads" "$test" { +gdb_test_multiple "info threads" "info threads after exec" { -re "2 *Thread .*$gdb_prompt $" { # Old threads left behind. - fail "$test" + fail "$gdb_test_name" } -re "4 *Thread .*$gdb_prompt $" { # New threads registered. - fail "$test" + fail "$gdb_test_name" } -re "$gdb_prompt $" { # Target doesn't register the main thread, pass for now. - pass "$test" + pass "$gdb_test_name" } } diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp index 16b4b10ab70..2693b6b362c 100644 --- a/gdb/testsuite/gdb.threads/print-threads.exp +++ b/gdb/testsuite/gdb.threads/print-threads.exp @@ -45,38 +45,40 @@ gdb_test "shell stty intr '^C'" ".*" proc test_all_threads { name kill } { global gdb_prompt inferior_exited_re - set i 0 - set j 0 - gdb_test_multiple "continue" "all threads ran once" { - -re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" { - set i [expr $i + 1] - pass "hit thread_function breakpoint, $i ($name)" - send_gdb "continue\n" - exp_continue - } - -re "Breakpoint \[0-9\]+, .* kill \\(.*\\) .*$gdb_prompt" { - set j [expr $j + 1] - if { $kill == 1 } { - pass "hit kill breakpoint, $j ($name)" - } else { - fail "hit kill breakpoint, $j ($name) (unexpected)" + with_test_prefix $name { + set i 0 + set j 0 + gdb_test_multiple "continue" "all threads ran once" { + -re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" { + set i [expr $i + 1] + pass "hit thread_function breakpoint, $i" + send_gdb "continue\n" + exp_continue } - send_gdb "continue\n" - exp_continue - } - -re "$inferior_exited_re normally.\[\r\n\]+$gdb_prompt" { - pass "program exited normally" - if {$i == 5} { - pass "all threads ran once ($name)" - } else { - fail "all threads ran once ($name) (total $i threads ran)" + -re "Breakpoint \[0-9\]+, .* kill \\(.*\\) .*$gdb_prompt" { + set j [expr $j + 1] + if { $kill == 1 } { + pass "hit kill breakpoint, $j" + } else { + fail "hit kill breakpoint, $j (unexpected)" + } + send_gdb "continue\n" + exp_continue } - } - -re " received signal SIGTRAP.*(Thread \[-0-9a-fx\]* \\(zombie\\)|0x00000000 in ).*$gdb_prompt $" { - if { $kill == 1 } { - kfail "gdb/1265" "Running threads ($name) (zombie thread)" - } else { - fail "running threads ($name) (unknown output)" + -re "$inferior_exited_re normally.\[\r\n\]+$gdb_prompt" { + pass "program exited normally" + if {$i == 5} { + pass "all threads ran once" + } else { + fail "all threads ran once (total $i threads ran)" + } + } + -re " received signal SIGTRAP.*(Thread \[-0-9a-fx\]* \\(zombie\\)|0x00000000 in ).*$gdb_prompt $" { + if { $kill == 1 } { + kfail "gdb/1265" "Running threads (zombie thread)" + } else { + fail "running threads (unknown output)" + } } } } diff --git a/gdb/testsuite/gdb.threads/queue-signal.exp b/gdb/testsuite/gdb.threads/queue-signal.exp index 3ec3adcaac0..ca06ce789d2 100644 --- a/gdb/testsuite/gdb.threads/queue-signal.exp +++ b/gdb/testsuite/gdb.threads/queue-signal.exp @@ -60,16 +60,20 @@ gdb_test_no_output "set scheduler-locking on" gdb_test_no_output "set var ready = 1" # Thread sigusr1_thread gets a SIGUSR1 which we leave alone. -gdb_test "thread $sigusr1_thread" "" -gdb_test "continue" "SIGUSR1.*" +gdb_test "thread $sigusr1_thread" "" \ + "switch to SIGUSR1 thread" +gdb_test "continue" "SIGUSR1.*" \ + "continue until we get SIGUSR1" # Inject SIGUSR2 into thread sigusr2_thread. -gdb_test "thread $sigusr2_thread" "" +gdb_test "thread $sigusr2_thread" "" \ + "switch to SIGUSR2 thread" gdb_test_no_output "queue-signal SIGUSR2" # The main thread gets SIGABRT which we then throw away. gdb_test "thread 1" "" -gdb_test "continue" "SIGABRT.*" +gdb_test "continue" "SIGABRT.*" \ + "continue until we get SIGABRT" gdb_test_no_output "queue-signal 0" # Now let every thread run. diff --git a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp index 2d4417c6506..78ded0db4c2 100644 --- a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp +++ b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp @@ -53,14 +53,16 @@ proc test { schedlock } { gdb_test "continue" "thread_function.*" "thread 2 created" gdb_test "continue" "thread_function.*" "thread 3 created" - gdb_test "continue" "all_threads_started.*" + gdb_test "continue" "all_threads_started.*" \ + "continue to all_threads_started" # Using schedlock, let the main thread queue a signal for each # non-main thread. gdb_test_no_output "set scheduler-locking on" gdb_test "break all_threads_signalled" "Breakpoint .* at .*$srcfile.*" - gdb_test "continue" "all_threads_signalled.*" + gdb_test "continue" "all_threads_signalled.*" \ + "continue to all_threads signalled" gdb_test "info threads" "\\\* 1\[ \t\]+Thread.*" "thread 1 selected" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0496ca2afe1..f4006800aa0 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4529,7 +4529,7 @@ proc gdb_compile_shlib_pthreads {sources dest options} { set why_msg "missing runtime threads library" } {^$} { - pass "successfully compiled posix threads test case" + pass "successfully compiled posix threads shlib test case" set built_binfile 1 break } diff --git a/gdb/testsuite/lib/prelink-support.exp b/gdb/testsuite/lib/prelink-support.exp index 6976912f0f3..6550715ba3a 100644 --- a/gdb/testsuite/lib/prelink-support.exp +++ b/gdb/testsuite/lib/prelink-support.exp @@ -122,8 +122,10 @@ proc build_executable_own_libs {testname executable sources options {interp ""} error "This proc can be only used for native target." } - if {[build_executable $testname $executable $sources $options] == -1} { - return "" + with_test_prefix "initial build" { + if {[build_executable $testname $executable $sources $options] == -1} { + return "" + } } set binfile [standard_output_file ${executable}] @@ -181,8 +183,10 @@ proc build_executable_own_libs {testname executable sources options {interp ""} set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"] } - if {[build_executable $testname $executable $sources $options] == -1} { - return "" + with_test_prefix "rebuild" { + if {[build_executable $testname $executable $sources $options] == -1} { + return "" + } } set prelink_args "--ld-library-path=$dir $binfile [concat $dests]"