dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] Use `test_timeout' consistently across protocols


From: Maciej W. Rozycki
Subject: [PATCH 3/4] Use `test_timeout' consistently across protocols
Date: Tue, 12 Dec 2023 13:09:54 +0000 (GMT)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

The `test_timeout' global parameter was added with commit 73db65f53795, 
however for the `unix' protocol only and then only in the local case.  
Update the remote case of the `unix' protocol, other protocols that use 
various timeout sources, and the `qemu' board to take any `test_timeout' 
setting into account as appropriate.  Amend the manual accordingly.

        * baseboards/qemu.exp (qemu_load): Respect global `test_timeout' 
        setting.
        * config/gdb-comm.exp (gdb_comm_load): Likewise.
        * config/gdb_stub.exp (gdb_stub_load): Likewise.
        * config/sim.exp (sim_load): Likewise.
        * config/unix.exp (unix_load): Likewise, in the remote case.
        * doc/dejagnu.texi (Local configuration file): Update 
        accordingly.
---
 baseboards/qemu.exp |    9 ++++++++-
 config/gdb-comm.exp |    5 +++--
 config/gdb_stub.exp |    9 +++++++--
 config/sim.exp      |    4 ++++
 config/unix.exp     |    2 +-
 doc/dejagnu.texi    |    3 ++-
 6 files changed, 25 insertions(+), 7 deletions(-)

dejagnu-test-timeout.diff
Index: dejagnu/baseboards/qemu.exp
===================================================================
--- dejagnu.orig/baseboards/qemu.exp
+++ dejagnu/baseboards/qemu.exp
@@ -199,7 +199,14 @@ set_board_info rcp_prog /usr/bin/scp
 proc qemu_load { dest prog args } {
     global qemu
     global timeout
-    set ret [local_exec "$qemu $prog" "" "" $timeout]
+    global test_timeout
+
+    set wait_timeout $timeout
+    if {[info exists test_timeout]} {
+       set wait_timeout $test_timeout
+    }
+
+    set ret [local_exec "$qemu $prog" "" "" $wait_timeout]
 
     if { [array size ret] == 0 } {
        return "pass"
Index: dejagnu/config/gdb-comm.exp
===================================================================
--- dejagnu.orig/config/gdb-comm.exp
+++ dejagnu/config/gdb-comm.exp
@@ -253,7 +253,7 @@ proc gdb_comm_load { dest prog args } {
     global GDB
     global GDBFLAGS
     global gdb_prompt
-    global timeout
+    global test_timeout
     set argnames { "command-line arguments" "input file" "output file" }
 
     for { set x 0 } { $x < [llength $args] } { incr x } {
@@ -267,9 +267,10 @@ proc gdb_comm_load { dest prog args } {
        return [list "untested" ""]
     }
 
-    # FIXME: The value 300 below should be a parameter.
     if {[board_info $dest exists testcase_timeout]} {
        set testcase_timeout [board_info $dest testcase_timeout]
+    } elseif {[info exists test_timeout]} {
+       set testcase_timeout $test_timeout
     } else {
        set testcase_timeout 300
     }
Index: dejagnu/config/gdb_stub.exp
===================================================================
--- dejagnu.orig/config/gdb_stub.exp
+++ dejagnu/config/gdb_stub.exp
@@ -471,6 +471,7 @@ proc gdb_stub_wait { dest timeout } {
 }
 
 proc gdb_stub_load { dest prog args } {
+    global test_timeout
     global gdb_prompt
     set argnames { "command-line arguments" "input file" "output file" }
 
@@ -480,14 +481,18 @@ proc gdb_stub_load { dest prog args } {
        }
     }
 
+    set wait_timeout 120
+    if {[info exists test_timeout]} {
+       set wait_timeout $test_timeout
+    }
+
     set result [remote_spawn $dest $prog]
 
     if { $result < 0 } {
        return [list "fail" "remote_spawn failed"]
     }
 
-    # FIXME: The value 120 should be a parameter.
-    set result [remote_wait $dest 120]
+    set result [remote_wait $dest $wait_timeout]
     set status [lindex $result 0]
     set output [lindex $result 1]
 
Index: dejagnu/config/sim.exp
===================================================================
--- dejagnu.orig/config/sim.exp
+++ dejagnu/config/sim.exp
@@ -60,6 +60,8 @@ proc sim_wait { dest timeout } {
 }
 
 proc sim_load { dest prog args } {
+    global test_timeout
+
     set inpfile ""
     if { [llength $args] > 1 } {
        if { [lindex $args 1] ne "" } {
@@ -75,6 +77,8 @@ proc sim_load { dest prog args } {
 
     if {[board_info $dest exists sim_time_limit]} {
        set sim_time_limit [board_info $dest sim_time_limit]
+    } elseif {[info exists test_timeout]} {
+       set sim_time_limit $test_timeout
     } else {
        set sim_time_limit 240
     }
Index: dejagnu/config/unix.exp
===================================================================
--- dejagnu.orig/config/unix.exp
+++ dejagnu/config/unix.exp
@@ -133,7 +133,7 @@ proc unix_load { dest prog args } {
            set remotecmd "$remotefile"
        }
 
-       set status [remote_exec $dest $remotefile $parg $inp]
+       set status [remote_exec $dest $remotefile $parg $inp "" $wait_timeout]
        remote_file $dest delete $remotefile.o $remotefile
        if { [lindex $status 0] < 0 } {
            verbose -log "Couldn't execute $prog, [lindex $status 1]" 3
Index: dejagnu/doc/dejagnu.texi
===================================================================
--- dejagnu.orig/doc/dejagnu.texi
+++ dejagnu/doc/dejagnu.texi
@@ -1366,7 +1366,8 @@ to manipulate these itself.
 The local @file{site.exp} may also set Tcl variables such as
 @code{test_timeout} which can control the amount of time (in seconds)
 to wait for a remote test to complete.  If not specified,
-@code{test_timeout} defaults to 300 seconds.
+@code{test_timeout} defaults to 120 or 300 seconds, depending on the
+communication protocol.
 
 @node Board configuration file, Remote host testing, Local configuration file, 
Customizing DejaGnu
 @section Board configuration file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]