public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] gdb/testsuite: bump duration for the whole test in do_self_tests
Date: Fri, 23 Sep 2022 10:17:59 -0400	[thread overview]
Message-ID: <20220923141801.1106678-2-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220923141801.1106678-1-simon.marchi@polymtl.ca>

When running gdb.gdb/python-helper.exp, I get some timeouts:

    continue
    Continuing.
    print 1

    FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb (timeout)

At this time, GDB is actually processing the stop and reading in some
CUs.  selftest_setup does bump the timeout, but it's not for the whole
test.

Since debugging GDB with GDB is (unfortunately) a bit slow, bump the
timeout for the whole duration of the setup and body.  On my optimized
build, the command takes just a bit more than the current timeout of 10
seconds.  But it's much slower if running the test on an unoptimized
build, so I think it's necessary to bump the timeout for that in any
case.

Change-Id: I4d38285870e76c94f9d0bfdb60648a2e7f2cfa5d
---
 gdb/testsuite/lib/selftest-support.exp | 36 ++++++--------------------
 1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 138afc0df568..2b17c539a96f 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -45,29 +45,14 @@ proc find_gdb { arg } {
 
 proc selftest_setup { executable function } {
     global gdb_prompt
-    global timeout
     global INTERNAL_GDBFLAGS
 
     # load yourself into the debugger
-    # This can take a relatively long time, particularly for testing where
-    # the executable is being accessed over a network, or where gdb does not
-    # support partial symbols for a particular target and has to load the
-    # entire symbol table.  Set the timeout to 10 minutes, which should be
-    # adequate for most environments (it *has* timed out with 5 min on a
-    # SPARCstation SLC under moderate load, so this isn't unreasonable).
-    # After gdb is started, set the timeout to 30 seconds for the duration
-    # of this test, and then back to the original value.
-
-    set oldtimeout $timeout
-    set timeout 600
-    verbose "Timeout is now $timeout seconds" 2
 
     global gdb_file_cmd_debug_info
     set gdb_file_cmd_debug_info "unset"
 
     set result [gdb_load $executable]
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
 
     if { $result != 0 } then {
 	return -1
@@ -85,9 +70,6 @@ proc selftest_setup { executable function } {
     }
 
     # run yourself
-    # It may take a very long time for the inferior gdb to start (lynx),
-    # so we bump it back up for the duration of this command.
-    set timeout 600
 
     set description "run until breakpoint at $function"
     gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
@@ -99,21 +81,14 @@ proc selftest_setup { executable function } {
         }
         -re "vfork: No more processes.*$gdb_prompt $" {
             fail "$description (out of virtual memory)"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
             return -1
         }
         -re ".*$gdb_prompt $" {
             fail "$description"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
             return -1
         }
     }
 
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
     return 0
 }
 
@@ -159,9 +134,14 @@ proc do_self_tests {function body} {
     gdb_start
     set file [remote_download host $GDB_FULLPATH $xgdb]
 
-    set result [selftest_setup $file $function]
-    if {$result == 0} then {
-	set result [uplevel $body]
+    # When debugging GDB with GDB, some operations can take a relatively long
+    # time, especially if the build is non-optimized.  Bump the timeout for the
+    # duration of the test.
+    with_timeout_factor 10 {
+	set result [selftest_setup $file $function]
+	if {$result == 0} then {
+	    set result [uplevel $body]
+	}
     }
 
     gdb_exit
-- 
2.37.3


  reply	other threads:[~2022-09-23 14:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 14:17 [PATCH 0/3] Fix gdb.gdb/python-helper.exp + cleanups Simon Marchi
2022-09-23 14:17 ` Simon Marchi [this message]
2022-09-23 14:18 ` [PATCH 2/3] gdb/testsuite: use gdb_test in gdb.gdb/python-helper.exp Simon Marchi
2022-09-23 14:18 ` [PATCH 3/3] gdb/testsuite: update field names in gdb-gdb.py.in Simon Marchi
2022-09-23 17:02 ` [PATCH 0/3] Fix gdb.gdb/python-helper.exp + cleanups Luis Machado
2022-09-23 21:35   ` Tom de Vries
2022-09-26 18:01     ` Simon Marchi
2022-09-26 18:39       ` Tom de Vries
2022-09-26 21:33         ` Simon Marchi
2022-09-27 10:34       ` Bruno Larsen
2022-09-27 10:42         ` Luis Machado

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=20220923141801.1106678-2-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.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).