Improve hand-call-in-threads.exp failure handling.
authorSandra Loosemore <sandra@codesourcery.com>
Wed, 9 Sep 2015 02:49:04 +0000 (19:49 -0700)
committerSandra Loosemore <sandra@codesourcery.com>
Wed, 9 Sep 2015 02:49:04 +0000 (19:49 -0700)
2015-09-08  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.threads/hand-call-in-threads.exp: Make sure the thread
command actually switches threads.  Give up on remaining
tests if target fails to stop at breakpoint.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/hand-call-in-threads.exp

index 2a1cc072757381b30884d76a5c9187d75c587a8b..fdd9e9558c9995f25d95dba8bb8c5dbd925001b0 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-08  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * gdb.threads/hand-call-in-threads.exp: Make sure the thread
+       command actually switches threads.  Give up on remaining
+       tests if target fails to stop at breakpoint.
+
 2015-09-03  Pierre-Marie de Rodat  <derodat@adacore.com>
 
        * gdb.ada/funcall_char.exp: New testcase.
index a9b90e13e9a1abc4ab4db9fcc22602fed1c53bd1..64af5110d98858f866f29010d589a8c1d594a09e 100644 (file)
@@ -84,10 +84,25 @@ set total_nr_threads [expr $NR_THREADS + 1]
 # Thread numbering in gdb is origin-1, so begin numbering at 1.
 for { set i 1 } { $i <= $total_nr_threads } { incr i } {
     set thread_nr $i
-    gdb_test "thread $thread_nr" ".*" \
+    gdb_test "thread $thread_nr" \
+       ".*Switching to thread $thread_nr.*" \
        "prepare to make hand call, thread $thread_nr"
-    gdb_test "call hand_call()" "Breakpoint 3, .*" \
-       "hand call, thread $thread_nr"
+    gdb_test_multiple "call hand_call()" "" {
+       -re "Breakpoint 3, .*$gdb_prompt $" {
+           pass "hand call, thread $thread_nr"
+       }
+       -re "$gdb_prompt $" {
+           fail "hand call, thread $thread_nr (got gdb prompt)"
+       }
+       timeout {
+           # If the target fails to stop at the breakpoint, it just ends
+           # up in an infinite loop in hand_call().  If this happens
+           # and we have lost the GDB prompt, no further tests in
+           # this file will work and there is no point in continuing.
+           fail "hand call, thread $thread_nr (runaway target)"
+           return 0
+       }
+    }
 }
 
 # Now have each hand-called function return.
This page took 0.031497 seconds and 4 git commands to generate.