[RFC] thread tests, linux/gdbserver
Michael Snyder
Michael.Snyder@palmsource.com
Mon Sep 25 22:26:00 GMT 2006
Several thread tests contain patterns that explicitly look
for the string "Thread" (capitalized) in the info threads
output.
But target remote prints it as "thread" (lower case), and
so even though these tests can be run against gdbserver,
they will fail.
This patch just substitutes a pattern "\[Tt\]hread".
Seem OK?
-------------- next part --------------
2006-09-25 Michael Snyder <michael.snyder@localhost.localdomain>
* gdb.threads/linux-dp.exp: Relax patterns for remote targets.
* gdb.threads/manythreads.exp: Ditto.
* gdb.threads/pthreads.exp: Ditto.
* gdb.threads/staticthreads.exp: Ditto.
Index: linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.11
diff -p -r1.11 linux-dp.exp
*** linux-dp.exp 4 May 2005 21:21:42 -0000 1.11
--- linux-dp.exp 25 Sep 2006 22:15:51 -0000
*************** gdb_breakpoint [gdb_get_line_number "lin
*** 111,120 ****
gdb_continue_to_breakpoint "main thread's sleep"
set info_threads_ptn ""
for {set i $nthreads} {$i > 0} {incr i -1} {
! append info_threads_ptn "$i Thread .*"
}
append info_threads_ptn "\[\r\n\]+$gdb_prompt $"
! set info_threads_manager_ptn "[expr $nthreads + 1] Thread .*$info_threads_ptn"
gdb_test_multiple "info threads" "info threads 2" {
-re "$info_threads_manager_ptn" {
--- 111,120 ----
gdb_continue_to_breakpoint "main thread's sleep"
set info_threads_ptn ""
for {set i $nthreads} {$i > 0} {incr i -1} {
! append info_threads_ptn "$i \[Tt\]hread .*"
}
append info_threads_ptn "\[\r\n\]+$gdb_prompt $"
! set info_threads_manager_ptn "[expr $nthreads + 1] \[Tt\]hread .*$info_threads_ptn"
gdb_test_multiple "info threads" "info threads 2" {
-re "$info_threads_manager_ptn" {
*************** for {set i 0} {$only_five > 0 && $i < 10
*** 178,184 ****
gdb_continue_to_breakpoint "thread 5's print, pass: $i"
send_gdb "info threads\n"
gdb_expect {
! -re "\\* 5 Thread .* print_philosopher .*\r\n$gdb_prompt $" {
# Okay this time.
}
-re ".*$gdb_prompt $" {
--- 178,184 ----
gdb_continue_to_breakpoint "thread 5's print, pass: $i"
send_gdb "info threads\n"
gdb_expect {
! -re "\\* 5 \[Tt\]hread .* print_philosopher .*\r\n$gdb_prompt $" {
# Okay this time.
}
-re ".*$gdb_prompt $" {
Index: manythreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/manythreads.exp,v
retrieving revision 1.2
diff -p -r1.2 manythreads.exp
*** manythreads.exp 3 Jun 2004 22:10:56 -0000 1.2
--- manythreads.exp 25 Sep 2006 22:15:51 -0000
*************** gdb_test_multiple "" "stop threads 1" {
*** 70,76 ****
-re "\\\[\[^\]\]* exited\\\]\r\n" {
exp_continue
}
! -re "Thread \[^\n\]* executing\r\n" {
exp_continue
}
-re "Program received signal SIGINT.*$gdb_prompt $" {
--- 70,76 ----
-re "\\\[\[^\]\]* exited\\\]\r\n" {
exp_continue
}
! -re "\[Tt\]hread \[^\n\]* executing\r\n" {
exp_continue
}
-re "Program received signal SIGINT.*$gdb_prompt $" {
*************** gdb_test_multiple "" "stop threads 1" {
*** 81,87 ****
}
}
! gdb_test "info threads" ".*1 Thread.*.LWP.*"
set message "second continue"
gdb_test_multiple "continue" "second continue" {
--- 81,87 ----
}
}
! gdb_test "info threads" ".*1 \[Tt\]hread.*"
set message "second continue"
gdb_test_multiple "continue" "second continue" {
*************** gdb_test_multiple "" "stop threads 2" {
*** 104,114 ****
-re "\\\[\[^\]\]* exited\\\]\r\n" {
exp_continue
}
! -re "Thread \[^\n\]* executing\r\n" {
exp_continue
}
-re "Program received signal SIGINT.*$gdb_prompt $" {
! pass "stop threads 2"
}
}
--- 104,117 ----
-re "\\\[\[^\]\]* exited\\\]\r\n" {
exp_continue
}
! -re "\[Tt\]hread \[^\n\]* executing\r\n" {
exp_continue
}
-re "Program received signal SIGINT.*$gdb_prompt $" {
! pass "$message"
! }
! timeout {
! fail "$message (timeout)"
}
}
Index: pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthreads.exp,v
retrieving revision 1.12
diff -p -r1.12 pthreads.exp
*** pthreads.exp 4 Jun 2004 23:27:50 -0000 1.12
--- pthreads.exp 25 Sep 2006 22:15:51 -0000
*************** proc test_startup {} {
*** 172,178 ****
# We should be able to do an info threads before starting any others.
send_gdb "info threads\n"
gdb_expect {
! -re ".*Thread.*main.*$gdb_prompt $" {
pass "info threads"
}
-re "\r\n$gdb_prompt $" {
--- 172,178 ----
# We should be able to do an info threads before starting any others.
send_gdb "info threads\n"
gdb_expect {
! -re ".*\[Tt\]hread.*main.*$gdb_prompt $" {
pass "info threads"
}
-re "\r\n$gdb_prompt $" {
*************** proc test_startup {} {
*** 183,189 ****
# Extract the thread id number of main thread from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}main.*)($gdb_prompt $)"
set main_id $expect_out(1,string)
# Check that we can continue and create the first thread.
--- 183,189 ----
# Extract the thread id number of main thread from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}\[Tt\]hread${horiz}main.*)($gdb_prompt $)"
set main_id $expect_out(1,string)
# Check that we can continue and create the first thread.
*************** proc test_startup {} {
*** 195,201 ****
# Extract the thread id number of thread 1 from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread1.*)($gdb_prompt $)"
set thread1_id $expect_out(1,string)
# Check that we can continue and create the second thread,
--- 195,201 ----
# Extract the thread id number of thread 1 from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}\[Tt\]hread${horiz}thread1.*)($gdb_prompt $)"
set thread1_id $expect_out(1,string)
# Check that we can continue and create the second thread,
*************** proc test_startup {} {
*** 207,213 ****
# Extract the thread id number of thread 2 from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread2.*)($gdb_prompt $)"
set thread2_id $expect_out(1,string)
return 1
--- 207,213 ----
# Extract the thread id number of thread 2 from "info threads" output.
send_gdb "info threads\n"
! gdb_expect -re "(\[0-9\]+)(${horiz}\[Tt\]hread${horiz}thread2.*)($gdb_prompt $)"
set thread2_id $expect_out(1,string)
return 1
Index: staticthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/staticthreads.exp,v
retrieving revision 1.2
diff -p -r1.2 staticthreads.exp
*** staticthreads.exp 30 Apr 2005 19:56:47 -0000 1.2
--- staticthreads.exp 25 Sep 2006 22:15:51 -0000
*************** gdb_test "continue" " .*sem_post .*" "ha
*** 79,85 ****
set test "info threads"
gdb_test_multiple "info threads" "$test" {
! -re " Thread .*$gdb_prompt " {
pass "$test"
}
-re "$gdb_prompt " {
--- 79,85 ----
set test "info threads"
gdb_test_multiple "info threads" "$test" {
! -re " \[Tt\]hread .*$gdb_prompt " {
pass "$test"
}
-re "$gdb_prompt " {
More information about the Gdb-patches
mailing list