This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

testsuite: Of all the timeouts provided always select the largest


Hello,

 Some targets require long time to perform certain operations.  An example 
is a hardware board (i.e. non-simulated one) driven through a serial 
interface of some kind or the target itself may be slow.  Board 
description files can provide their own timeout setting, overriding 
defaults, like the global one or the tool-specific one.  Unfortunately 
this does not apply to explicit timeouts used with gdb_expect here and 
there.  I have seen cases of test suite failures resulting from that.

 To rectify I have modified gdb_expect so that one timeout can never lower 
any other one.  A patch follows.  No regressions with the 
mipsisa32-sde-elf target using the mips-sim-sde32/-EB/-march=mips32r2 
board.  It fixes several timeouts seen with the mips-fs2-sdelib board in 
some configurations though.

2008-02-25  Maciej W. Rozycki  <macro@mips.com>

	* lib/gdb.exp (gdb_expect): Of all the timeouts provided always
	select the largest.

 OK to apply?

  Maciej

14614.diff
Index: gdb/src/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb.orig/src/gdb/testsuite/lib/gdb.exp	2007-02-13 16:40:36.000000000 +0000
+++ gdb/src/gdb/testsuite/lib/gdb.exp	2007-02-13 16:40:45.000000000 +0000
@@ -1697,34 +1697,44 @@
 
 proc gdb_expect { args } {
     if { [llength $args] == 2  && [lindex $args 0] != "-re" } {
-	set gtimeout [lindex $args 0];
+	set atimeout [lindex $args 0];
 	set expcode [list [lindex $args 1]];
     } else {
-	upvar timeout timeout;
-
 	set expcode $args;
-	if [target_info exists gdb,timeout] {
-	    if [info exists timeout] {
-		if { $timeout < [target_info gdb,timeout] } {
-		    set gtimeout [target_info gdb,timeout];
-		} else {
-		    set gtimeout $timeout;
-		}
-	    } else {
+    }
+
+    upvar timeout timeout;
+
+    if [target_info exists gdb,timeout] {
+	if [info exists timeout] {
+	    if { $timeout < [target_info gdb,timeout] } {
 		set gtimeout [target_info gdb,timeout];
+	    } else {
+		set gtimeout $timeout;
 	    }
+	} else {
+	    set gtimeout [target_info gdb,timeout];
 	}
+    }
 
+    if ![info exists gtimeout] {
+	global timeout;
+	if [info exists timeout] {
+	    set gtimeout $timeout;
+	}
+    }
+
+    if [info exists atimeout] {
+	if { ![info exists gtimeout] || $gtimeout < $atimeout } {
+	    set $gtimeout $atimeout;
+	}
+    } else {
 	if ![info exists gtimeout] {
-	    global timeout;
-	    if [info exists timeout] {
-		set gtimeout $timeout;
-	    } else {
-		# Eeeeew.
-		set gtimeout 60;
-	    }
+	    # Eeeeew.
+	    set gtimeout 60;
 	}
     }
+
     global suppress_flag;
     global remote_suppress_flag;
     if [info exists remote_suppress_flag] {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]