aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-03-15 10:44:07 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-03-16 09:31:06 +0000
commitf302f9e26e872a8da4b1d4556ea2eeebeca866e7 (patch)
treec1f18143c89bb514ea7bf670ede97b9b65b35edc /gdb/testsuite
parent80d49d6a1b865c84a8596da465db285cbbdfd1bb (diff)
downloadgdb-f302f9e26e872a8da4b1d4556ea2eeebeca866e7.zip
gdb-f302f9e26e872a8da4b1d4556ea2eeebeca866e7.tar.gz
gdb-f302f9e26e872a8da4b1d4556ea2eeebeca866e7.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog20
-rw-r--r--gdb/testsuite/gdb.threads/execl.exp11
-rw-r--r--gdb/testsuite/gdb.threads/print-threads.exp62
-rw-r--r--gdb/testsuite/gdb.threads/queue-signal.exp12
-rw-r--r--gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp6
-rw-r--r--gdb/testsuite/lib/gdb.exp2
-rw-r--r--gdb/testsuite/lib/prelink-support.exp12
7 files changed, 77 insertions, 48 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 6ed26d1..374ea39 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -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 -.
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index db4c5d2..68341be 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 16b4b10..2693b6b 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 3ec3adc..ca06ce7 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 2d4417c..78ded0d 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 0496ca2..f400680 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 6976912..6550715 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]"