gdb/testsuite: use foreach_with_prefix in gdb.threads/non-ldr-exc-*.exp
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 1 Dec 2020 20:07:08 +0000 (15:07 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 1 Dec 2020 20:08:06 +0000 (15:08 -0500)
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

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
gdb/testsuite/gdb.threads/non-ldr-exc-4.exp

index d123b44068d04ce16cc3754c6c1db1ef9e160376..d3f0f885b2d61852a3f75e76ce9cb0a1b7150660 100644 (file)
@@ -1,3 +1,14 @@
+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.
index 3a20653f7463fefc5d7c59014b23e5f5f3b793b4..78280e5bd2b7dcd918b8d8b11470414528eb9d8f 100644 (file)
@@ -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
-  }
 }
index a2eb546089fd459503620b5823fa30e084d14d87..194c1510290589c3a699a5ab1630d90b0a9ad23b 100644 (file)
@@ -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
-  }
 }
index c4de2e748cb6fe92e23d2fbe8cc8eaa75d268d37..50350e9f6d826d36c2edabe80d3d73abb156b732 100644 (file)
@@ -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
-  }
 }
index 7de266b8b9403ba7e4b29d7ce603a4ccf56d70fb..0838eace415635490474aea3067167e4dfe1e036 100644 (file)
@@ -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
-  }
 }