Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] thread tests, linux/gdbserver
@ 2006-09-25 22:26 Michael Snyder
  2006-10-05 21:51 ` PING " Michael Snyder
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2006-09-25 22:26 UTC (permalink / raw)
  To: GDB Patches ML

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

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?



[-- Attachment #2: threadremote --]
[-- Type: text/plain, Size: 7532 bytes --]

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 " {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-17 20:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 22:26 [RFC] thread tests, linux/gdbserver Michael Snyder
2006-10-05 21:51 ` PING " Michael Snyder
2006-10-06 10:53   ` Mark Kettenis
2006-10-06 18:31     ` Michael Snyder
2006-10-17 15:46       ` Daniel Jacobowitz
2006-10-17 15:53         ` Daniel Jacobowitz
2006-10-17 20:08         ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox