From fbdcba42176e9f76c1d9e898347c91abd8b86df1 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Tue, 12 Dec 2023 13:09:54 +0000 Subject: Use `test_timeout' consistently across protocols 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(-) diff --git a/baseboards/qemu.exp b/baseboards/qemu.exp index 193a759..0cd96bf 100644 --- a/baseboards/qemu.exp +++ b/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" diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp index 909bb69..21893dc 100644 --- a/config/gdb-comm.exp +++ b/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 } diff --git a/config/gdb_stub.exp b/config/gdb_stub.exp index 6ad22a1..be1369a 100644 --- a/config/gdb_stub.exp +++ b/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] diff --git a/config/sim.exp b/config/sim.exp index 520a2c0..ed5f67b 100644 --- a/config/sim.exp +++ b/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 } diff --git a/config/unix.exp b/config/unix.exp index a3b1a10..b359b8b 100644 --- a/config/unix.exp +++ b/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 diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index f7a6e4c..17f32b7 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -1372,7 +1372,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 -- cgit v1.1