gdb/testsuite: squash duplicate test names in gdb.threads/*.exp
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 15 Mar 2021 10:44:07 +0000 (10:44 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 16 Mar 2021 09:31:06 +0000 (09:31 +0000)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/execl.exp
gdb/testsuite/gdb.threads/print-threads.exp
gdb/testsuite/gdb.threads/queue-signal.exp
gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/prelink-support.exp

index 6ed26d1979f8235f87d429ac45d09587f8ec66df..374ea39417276f07c68ad1e3a0e4442456b424a0 100644 (file)
@@ -1,3 +1,23 @@
+2021-03-16  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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  <tromey@adacore.com>
 
        * gdb.ada/fixed_points.exp: Add tests of unary + and -.
index db4c5d2f9b2149d74c9789a8c9a7531822cae6cc..68341be4d21981e9454e2c29800f69cf5da18744 100644 (file)
@@ -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"
     }
 }
 
index 16b4b10ab70cf7becdb7210b0b123ba9623eba82..2693b6b362c2ebe02ecb6ff0461d500779797685 100644 (file)
@@ -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)"
+               }
            }
        }
     }
index 3ec3adcaac0f6c856d597f148a9679a6e3eb87ec..ca06ce789d2f5a3e3dd983373bf08333a6c888fe 100644 (file)
@@ -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.
index 2d4417c6506f254cbb532298cea971c0b37b853b..78ded0db4c256d7f0d65c567075d58400cbf4fc1 100644 (file)
@@ -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"
 
index 0496ca2afe1c41d464e5882316de29455b763884..f4006800aa067bd718eb43c045e6016f8851d3df 100644 (file)
@@ -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
             }
index 6976912f0f31adf689b5d3f0c5cce13d0cf5b99c..6550715ba3a5877d9b6833248cfec19ecb572048 100644 (file)
@@ -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]"