public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@embecosm.com>
To: dejagnu@gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH DejaGNU 1/1] Support per-test execution timeout factor
Date: Tue, 12 Dec 2023 14:04:33 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.20.2312111745200.5892@tpp.orcam.me.uk> (raw)
In-Reply-To: <alpine.DEB.2.20.2312111744390.5892@tpp.orcam.me.uk>

Add support for the `test_timeout_factor' global variable letting a test 
case scale the wait timeout used for code execution.  This is useful for 
particularly slow test cases for which increasing the wait timeout 
globally would be excessive.

	* baseboards/qemu.exp (qemu_load): Handle `test_timeout_factor'.
	* 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.
	* doc/dejagnu.texi (Local configuration file): Document 
	`test_timeout_factor'.
---
 baseboards/qemu.exp |    4 ++++
 config/gdb-comm.exp |    4 ++++
 config/gdb_stub.exp |    4 ++++
 config/sim.exp      |    4 ++++
 config/unix.exp     |    4 ++++
 doc/dejagnu.texi    |   10 +++++++++-
 6 files changed, 29 insertions(+), 1 deletion(-)

dejagnu-test-timeout-factor.diff
Index: dejagnu/baseboards/qemu.exp
===================================================================
--- dejagnu.orig/baseboards/qemu.exp
+++ dejagnu/baseboards/qemu.exp
@@ -200,11 +200,15 @@ proc qemu_load { dest prog args } {
     global qemu
     global timeout
     global test_timeout
+    global test_timeout_factor
 
     set wait_timeout $timeout
     if {[info exists test_timeout]} {
 	set wait_timeout $test_timeout
     }
+    if {[info exists test_timeout_factor]} {
+	set wait_timeout [expr $wait_timeout * $test_timeout_factor]
+    }
 
     verbose -log "Executing on $dest: $prog (timeout = $wait_timeout)" 2
 
Index: dejagnu/config/gdb-comm.exp
===================================================================
--- dejagnu.orig/config/gdb-comm.exp
+++ dejagnu/config/gdb-comm.exp
@@ -254,6 +254,7 @@ proc gdb_comm_load { dest prog args } {
     global GDBFLAGS
     global gdb_prompt
     global test_timeout
+    global test_timeout_factor
     set argnames { "command-line arguments" "input file" "output file" }
 
     for { set x 0 } { $x < [llength $args] } { incr x } {
@@ -274,6 +275,9 @@ proc gdb_comm_load { dest prog args } {
     } else {
 	set testcase_timeout 300
     }
+    if {[info exists test_timeout_factor]} {
+	set testcase_timeout [expr $testcase_timeout * $test_timeout_factor]
+    }
 
     verbose -log "Executing on $dest: $prog (timeout = $testcase_timeout)" 2
 
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_factor
     global test_timeout
     global gdb_prompt
     set argnames { "command-line arguments" "input file" "output file" }
@@ -485,6 +486,9 @@ proc gdb_stub_load { dest prog args } {
     if {[info exists test_timeout]} {
 	set wait_timeout $test_timeout
     }
+    if {[info exists test_timeout_factor]} {
+	set wait_timeout [expr $wait_timeout * $test_timeout_factor]
+    }
 
     verbose -log "Executing on $dest: $prog (timeout = $wait_timeout)" 2
 
Index: dejagnu/config/sim.exp
===================================================================
--- dejagnu.orig/config/sim.exp
+++ dejagnu/config/sim.exp
@@ -60,6 +60,7 @@ proc sim_wait { dest timeout } {
 }
 
 proc sim_load { dest prog args } {
+    global test_timeout_factor
     global test_timeout
 
     set inpfile ""
@@ -82,6 +83,9 @@ proc sim_load { dest prog args } {
     } else {
 	set sim_time_limit 240
     }
+    if {[info exists test_timeout_factor]} {
+	set sim_time_limit [expr $sim_time_limit * $test_timeout_factor]
+    }
 
     set output ""
 
Index: dejagnu/config/unix.exp
===================================================================
--- dejagnu.orig/config/unix.exp
+++ dejagnu/config/unix.exp
@@ -33,6 +33,7 @@ load_lib remote.exp
 
 
 proc unix_load { dest prog args } {
+    global test_timeout_factor
     global ld_library_path
     global test_timeout
     set output ""
@@ -42,6 +43,9 @@ proc unix_load { dest prog args } {
     if {[info exists test_timeout]} {
 	set wait_timeout $test_timeout
     }
+    if {[info exists test_timeout_factor]} {
+	set wait_timeout [expr $wait_timeout * $test_timeout_factor]
+    }
 
     if { [llength $args] > 0 } {
 	set parg [lindex $args 0]
Index: dejagnu/doc/dejagnu.texi
===================================================================
--- dejagnu.orig/doc/dejagnu.texi
+++ dejagnu/doc/dejagnu.texi
@@ -1363,11 +1363,19 @@ by DejaGnu itself for cross testing, but
 to manipulate these itself.
 
 @vindex test_timeout
+@vindex test_timeout_factor
 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 120 or 300 seconds, depending on the
-communication protocol.
+communication protocol.  Additionally if @code{test_timeout_factor}
+Tcl variable has been set, then the amount of time to wait will be
+further multiplied by the value of this variable.  This multiplier
+will typically be set on a test case by test case basis though rather
+than in a configuration file, so that particularly slow test cases
+can be given a chance to complete while preventing excessive wait
+time from affecting the duration of a testsuite run if other test
+cases do fail to complete.
 
 @node Board configuration file, Remote host testing, Local configuration file, Customizing DejaGnu
 @section Board configuration file

  reply	other threads:[~2023-12-12 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 14:04 [PATCH DejaGNU/GCC 0/1] " Maciej W. Rozycki
2023-12-12 14:04 ` Maciej W. Rozycki [this message]
2023-12-12 23:02   ` [PATCH DejaGNU 1/1] " Jeff Law
2023-12-13  3:48   ` Jacob Bachmeyer
2023-12-12 14:04 ` [PATCH GCC 1/1] testsuite: Support test execution timeout factor as a keyword Maciej W. Rozycki
2023-12-12 23:03   ` Jeff Law
2024-01-03  5:15 ` [PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor Hans-Peter Nilsson
2024-01-03 16:38   ` Maciej W. Rozycki
2024-01-03 23:00     ` Richard Sandiford
2024-01-04  3:18     ` Generalizing DejaGnu timeout scaling (was: Re: [PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor) Jacob Bachmeyer
2024-01-04  4:59       ` Hans-Peter Nilsson
2024-01-05  2:27         ` Generalizing DejaGnu timeout scaling Jacob Bachmeyer
2024-01-04  4:52     ` [PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor Hans-Peter Nilsson
2024-02-01 20:18       ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.2312111745200.5892@tpp.orcam.me.uk \
    --to=macro@embecosm.com \
    --cc=dejagnu@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).