aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-12-01 15:07:08 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2020-12-01 15:08:06 -0500
commit0a6155a0722349087167d8489ed878a6f60bc360 (patch)
treeff693884006c85d31875be33e594ccc7add33ef2
parent539d71e89a21990d9fd15641477e4790129bdb11 (diff)
downloadfsf-binutils-gdb-0a6155a0722349087167d8489ed878a6f60bc360.zip
fsf-binutils-gdb-0a6155a0722349087167d8489ed878a6f60bc360.tar.gz
fsf-binutils-gdb-0a6155a0722349087167d8489ed878a6f60bc360.tar.bz2
gdb/testsuite: use foreach_with_prefix in gdb.threads/non-ldr-exc-*.exp
Replace the manual with_test_prefix in the do_test proc with using foreach_with_prefix at the top-level. This helps reduce the indentation level of the code a bit, and makes the test names in sync with the variable names used in the code. gdb/testsuite/ChangeLog: * gdb.threads/non-ldr-exc-1.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-2.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-3.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. * gdb.threads/non-ldr-exc-4.exp: Use foreach_with_prefix. (do_test): Don't use with_test_prefix. Change-Id: I3af1df2eee1a8add427a67b6048bb6dede41cbeb
-rw-r--r--gdb/testsuite/ChangeLog11
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-1.exp61
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-2.exp67
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-3.exp61
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-4.exp61
5 files changed, 134 insertions, 127 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d123b44..d3f0f88 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,16 @@
2020-12-01 Simon Marchi <simon.marchi@polymtl.ca>
+ * gdb.threads/non-ldr-exc-1.exp: Use foreach_with_prefix.
+ (do_test): Don't use with_test_prefix.
+ * gdb.threads/non-ldr-exc-2.exp: Use foreach_with_prefix.
+ (do_test): Don't use with_test_prefix.
+ * gdb.threads/non-ldr-exc-3.exp: Use foreach_with_prefix.
+ (do_test): Don't use with_test_prefix.
+ * gdb.threads/non-ldr-exc-4.exp: Use foreach_with_prefix.
+ (do_test): Don't use with_test_prefix.
+
+2020-12-01 Simon Marchi <simon.marchi@polymtl.ca>
+
* gdb.threads/non-ldr-exit.exp: Fix comment.
2020-12-01 Andrew Burgess <andrew.burgess@embecosm.com>
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index 3a20653..78280e5 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -24,44 +24,43 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
proc do_test { lock_sched nonstop } {
- with_test_prefix "lock-sched=$lock_sched,non-stop=$nonstop" {
- global executable
+ global executable
- save_vars { GDBFLAGS } {
- append GDBFLAGS " -ex \"set non-stop $nonstop\""
- clean_restart ${executable}
- }
-
- if ![runto_main] {
- return -1
- }
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set non-stop $nonstop\""
+ clean_restart ${executable}
+ }
- gdb_breakpoint [gdb_get_line_number "break-here"]
- gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+ if ![runto_main] {
+ return -1
+ }
- # Also test with sched-lock to make sure we can follow the
- # non-leader thread execing even though the main thread wasn't
- # resumed before the exec.
- if { $lock_sched } {
- gdb_test_no_output "set scheduler-locking on"
- }
+ gdb_breakpoint [gdb_get_line_number "break-here"]
+ gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- if { $nonstop == "on" } {
- gdb_test "thread 2" "Switching.*"
- }
+ # Also test with sched-lock to make sure we can follow the
+ # non-leader thread execing even though the main thread wasn't
+ # resumed before the exec.
+ if { $lock_sched } {
+ gdb_test_no_output "set scheduler-locking on"
+ }
- gdb_test "continue" \
- ".*is executing new program.*Breakpoint 1, main.* at .*" \
- "continue over exec"
+ if { $nonstop == "on" } {
+ gdb_test "thread 2" "Switching.*"
}
+
+ gdb_test "continue" \
+ ".*is executing new program.*Breakpoint 1, main.* at .*" \
+ "continue over exec"
}
-foreach nonstop {"on" "off"} {
- foreach schedlock {"on" "off"} {
- if {$schedlock == "on" && $nonstop == "on"} {
- # Schedule locking has no effect in nonstop mode.
- continue
+foreach_with_prefix nonstop {"on" "off"} {
+ foreach_with_prefix schedlock {"on" "off"} {
+ if {$schedlock == "on" && $nonstop == "on"} {
+ # Schedule locking has no effect in nonstop mode.
+ continue
+ }
+
+ do_test $schedlock $nonstop
}
- do_test $schedlock $nonstop
- }
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index a2eb546..194c151 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -25,48 +25,47 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
proc do_test { lock_sched nonstop } {
- with_test_prefix "lock-sched=$lock_sched,non-stop=$nonstop" {
- global executable
+ global executable
- save_vars { GDBFLAGS } {
- append GDBFLAGS " -ex \"set non-stop $nonstop\""
- clean_restart ${executable}
- }
-
- if ![runto_main] {
- return -1
- }
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set non-stop $nonstop\""
+ clean_restart ${executable}
+ }
- gdb_breakpoint [gdb_get_line_number "break-here"]
- gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+ if ![runto_main] {
+ return -1
+ }
- if { $nonstop == "on" } {
- gdb_test "thread 2" "Switching.*"
- }
+ gdb_breakpoint [gdb_get_line_number "break-here"]
+ gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- gdb_test "info threads" \
- "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*" \
- "single thread left"
+ if { $nonstop == "on" } {
+ gdb_test "thread 2" "Switching.*"
+ }
- # Also test with sched-lock to make sure we can follow the
- # non-leader thread execing even though the main thread wasn't
- # resumed before the exec.
- if { $lock_sched } {
- gdb_test_no_output "set scheduler-locking on"
- }
+ gdb_test "info threads" \
+ "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*" \
+ "single thread left"
- gdb_test "continue" \
- ".*is executing new program.*Breakpoint 1, main.* at .*" \
- "continue over exec"
+ # Also test with sched-lock to make sure we can follow the
+ # non-leader thread execing even though the main thread wasn't
+ # resumed before the exec.
+ if { $lock_sched } {
+ gdb_test_no_output "set scheduler-locking on"
}
+
+ gdb_test "continue" \
+ ".*is executing new program.*Breakpoint 1, main.* at .*" \
+ "continue over exec"
}
-foreach nonstop {"on" "off"} {
- foreach schedlock {"on" "off"} {
- if {$schedlock == "on" && $nonstop == "on"} {
- # Schedule locking has no effect in nonstop mode.
- continue
+foreach_with_prefix nonstop {"on" "off"} {
+ foreach_with_prefix schedlock {"on" "off"} {
+ if {$schedlock == "on" && $nonstop == "on"} {
+ # Schedule locking has no effect in nonstop mode.
+ continue
+ }
+
+ do_test $schedlock $nonstop
}
- do_test $schedlock $nonstop
- }
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index c4de2e7..50350e9 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -27,44 +27,43 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
proc do_test { lock_sched nonstop } {
- with_test_prefix "lock-sched=$lock_sched,non-stop=$nonstop" {
- global executable
+ global executable
- save_vars { GDBFLAGS } {
- append GDBFLAGS " -ex \"set non-stop $nonstop\""
- clean_restart ${executable}
- }
-
- if ![runto_main] {
- return -1
- }
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set non-stop $nonstop\""
+ clean_restart ${executable}
+ }
- gdb_breakpoint [gdb_get_line_number "break-here"]
- gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+ if ![runto_main] {
+ return -1
+ }
- # Also test with sched-lock to make sure we can follow the
- # non-leader thread execing even though the main thread wasn't
- # resumed before the exec.
- if { $lock_sched } {
- gdb_test_no_output "set scheduler-locking on"
- }
+ gdb_breakpoint [gdb_get_line_number "break-here"]
+ gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- if { $nonstop == "on" } {
- gdb_test "thread 2" "Switching.*"
- }
+ # Also test with sched-lock to make sure we can follow the
+ # non-leader thread execing even though the main thread wasn't
+ # resumed before the exec.
+ if { $lock_sched } {
+ gdb_test_no_output "set scheduler-locking on"
+ }
- gdb_test "continue" \
- ".*is executing new program.*Breakpoint 1, main.* at .*" \
- "continue over exec"
+ if { $nonstop == "on" } {
+ gdb_test "thread 2" "Switching.*"
}
+
+ gdb_test "continue" \
+ ".*is executing new program.*Breakpoint 1, main.* at .*" \
+ "continue over exec"
}
-foreach nonstop {"on" "off"} {
- foreach schedlock {"on" "off"} {
- if {$schedlock == "on" && $nonstop == "on"} {
- # Schedule locking has no effect in nonstop mode.
- continue
+foreach_with_prefix nonstop {"on" "off"} {
+ foreach_with_prefix schedlock {"on" "off"} {
+ if {$schedlock == "on" && $nonstop == "on"} {
+ # Schedule locking has no effect in nonstop mode.
+ continue
+ }
+
+ do_test $schedlock $nonstop
}
- do_test $schedlock $nonstop
- }
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index 7de266b..0838eac 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -26,44 +26,43 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
proc do_test { lock_sched nonstop } {
- with_test_prefix "lock-sched=$lock_sched,non-stop=$nonstop" {
- global executable
+ global executable
- save_vars { GDBFLAGS } {
- append GDBFLAGS " -ex \"set non-stop $nonstop\""
- clean_restart ${executable}
- }
-
- if ![runto_main] {
- return -1
- }
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set non-stop $nonstop\""
+ clean_restart ${executable}
+ }
- gdb_breakpoint [gdb_get_line_number "break-here"]
- gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+ if ![runto_main] {
+ return -1
+ }
- # Also test with sched-lock to make sure we can follow the
- # non-leader thread execing even though the main thread wasn't
- # resumed before the exec.
- if { $lock_sched } {
- gdb_test_no_output "set scheduler-locking on"
- }
+ gdb_breakpoint [gdb_get_line_number "break-here"]
+ gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- if { $nonstop == "on" } {
- gdb_test "thread 2" "Switching.*"
- }
+ # Also test with sched-lock to make sure we can follow the
+ # non-leader thread execing even though the main thread wasn't
+ # resumed before the exec.
+ if { $lock_sched } {
+ gdb_test_no_output "set scheduler-locking on"
+ }
- gdb_test "continue" \
- ".*is executing new program.*Breakpoint 1, main.* at .*" \
- "continue over exec"
+ if { $nonstop == "on" } {
+ gdb_test "thread 2" "Switching.*"
}
+
+ gdb_test "continue" \
+ ".*is executing new program.*Breakpoint 1, main.* at .*" \
+ "continue over exec"
}
-foreach nonstop {"on" "off"} {
- foreach schedlock {"on" "off"} {
- if {$schedlock == "on" && $nonstop == "on"} {
- # Schedule locking has no effect in nonstop mode.
- continue
+foreach_with_prefix nonstop {"on" "off"} {
+ foreach_with_prefix schedlock {"on" "off"} {
+ if {$schedlock == "on" && $nonstop == "on"} {
+ # Schedule locking has no effect in nonstop mode.
+ continue
+ }
+
+ do_test $schedlock $nonstop
}
- do_test $schedlock $nonstop
- }
}