dejagnu
[Top][All Lists]
Advanced

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

[PATCH 1/4] Do not set `test_timeout' in `unix_load'


From: Maciej W. Rozycki
Subject: [PATCH 1/4] Do not set `test_timeout' in `unix_load'
Date: Tue, 12 Dec 2023 13:09:37 +0000 (GMT)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

The `test_timeout' global parameter is expected to be optionally set by 
a board description file and then taken into account by `unix_load' to 
override the default of 300.  However not only the procedure checks for 
the override but it sets the global parameter to the default as well if 
not present.  This might make a minuscule TCL interpreter execution time 
reduction, but seems rather awkward from the programming style's point 
of view, and may cause undesired effects if the parameter is referred 
elsewhere.

Remove the setting of the global parameter then, while retaining its 
semantics.

        * config/unix.exp (unix_load): Don't ever set `test_timeout', 
        just use it locally.
---
 config/unix.exp |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

dejagnu-unix-wait-timeout.diff
Index: dejagnu/config/unix.exp
===================================================================
--- dejagnu.orig/config/unix.exp
+++ dejagnu/config/unix.exp
@@ -38,8 +38,9 @@ proc unix_load { dest prog args } {
     set output ""
     set orig_ld_library_path ""
 
-    if {![info exists test_timeout]} {
-       set test_timeout 300
+    set wait_timeout 300
+    if {[info exists test_timeout]} {
+       set wait_timeout $test_timeout
     }
 
     if { [llength $args] > 0 } {
@@ -76,7 +77,7 @@ proc unix_load { dest prog args } {
        setenv LD_LIBRARY_PATH $ld_library_path:$orig_ld_library_path
        setenv SHLIB_PATH $ld_library_path:$orig_ld_library_path
        verbose -log "Setting LD_LIBRARY_PATH to 
$ld_library_path:$orig_ld_library_path" 2
-       verbose -log "Execution timeout is: $test_timeout" 2
+       verbose -log "Execution timeout is: $wait_timeout" 2
 
        # Prepend shell name (e.g., qemu emulator) to the command.
        if {[board_info $dest exists exec_shell]} {
@@ -88,7 +89,7 @@ proc unix_load { dest prog args } {
            set output "remote_spawn failed"
            set status -1
        } else {
-           set status [remote_wait $dest $test_timeout]
+           set status [remote_wait $dest $wait_timeout]
            set output [lindex $status 1]
            set status [lindex $status 0]
        }



reply via email to

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