Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp
@ 2026-11-03  8:29 Tom de Vries
  2026-11-20 13:28 ` Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2026-11-03  8:29 UTC (permalink / raw)
  To: gdb-patches

With a gdb 17.2 based package and test-case gdb.base/kill-during-detach.exp, I
ran into:
...
(gdb) python kill_and_detach()
FAIL: exit_p=false: checkpoint_p=false: python kill_and_detach() (timeout)
...

I didn't manage to reproduce this, but I have seen this more often.

This may either be a regular testsuite timeout, or a problem with gdb.

It could be a regular testsuite timeout.  The command that is issued:
...
def kill_and_detach():
   os.kill(inf_pid, signal.SIGKILL)
   time.sleep(1)
   gdb.execute("detach")
...
does two things (with a sleep of 1 in between) that would normally get their
own timeout window.

Let's address this by adding a timeout factor of 2.

Then there's the problem that we don't see any output after the timeout.  So
we add a simple command after the command to drain some more output.

If the problem is a testsuite timeout, the timeout factor may be sufficient to
fix this.  And if it's a gdb problem, we might get more information the next
time we run into this.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34935
---
 gdb/testsuite/gdb.base/kill-during-detach.exp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp
index f5e3a902211..27584581a9b 100644
--- a/gdb/testsuite/gdb.base/kill-during-detach.exp
+++ b/gdb/testsuite/gdb.base/kill-during-detach.exp
@@ -126,10 +126,23 @@ proc run_test { exit_p checkpoint_p } {
 	# NOTE: The 'checkpoint' system in GDB appears to be a little
 	# iffy.  This detach does seem to restore the checkpoint, but
 	# it leaves the inferior stuck in a running state.
-	gdb_test_no_output "python kill_and_detach()"
+
+	# Double the timeout, to account for the fact that we're doing two
+	# things in kill_and_detach.
+	with_timeout_factor 2 {
+	    gdb_test_no_output "python kill_and_detach()"
+	}
     } else {
-	gdb_test "python kill_and_detach()" \
-	    "\\\[Inferior $::decimal \[^\r\n\]+ detached\\\]"
+	# Double the timeout, to account for the fact that we're doing two
+	# things in kill_and_detach.
+	with_timeout_factor 2 {
+	    gdb_test "python kill_and_detach()" \
+		[subst_vars {\[Inferior $::decimal [^\r\n]+ detached\]}]
+	}
+
+	# Do a simple command to drain late output of the previous command in
+	# case it timed out.
+	gdb_test "info inferiors" "<null>.*"
     }
 }
 

base-commit: 9db3b515b964c1bbdc4d20c1202fbf27719be269
-- 
2.51.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp
  2026-11-03  8:29 [PATCH] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp Tom de Vries
@ 2026-11-20 13:28 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2026-11-20 13:28 UTC (permalink / raw)
  To: gdb-patches

On 11/3/26 9:29 AM, Tom de Vries wrote:
> With a gdb 17.2 based package and test-case gdb.base/kill-during-detach.exp, I
> ran into:
> ...
> (gdb) python kill_and_detach()
> FAIL: exit_p=false: checkpoint_p=false: python kill_and_detach() (timeout)
> ...
> 
> I didn't manage to reproduce this, but I have seen this more often.
> 
> This may either be a regular testsuite timeout, or a problem with gdb.
> 
> It could be a regular testsuite timeout.  The command that is issued:
> ...
> def kill_and_detach():
>     os.kill(inf_pid, signal.SIGKILL)
>     time.sleep(1)
>     gdb.execute("detach")
> ...
> does two things (with a sleep of 1 in between) that would normally get their
> own timeout window.
> 
> Let's address this by adding a timeout factor of 2.
> 
> Then there's the problem that we don't see any output after the timeout.  So
> we add a simple command after the command to drain some more output.
> 
> If the problem is a testsuite timeout, the timeout factor may be sufficient to
> fix this.  And if it's a gdb problem, we might get more information the next
> time we run into this.
> 

I've double-checked this using make-check-all.sh, and pushed this.

Thanks,
- Tom


> Tested on x86_64-linux.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34935
> ---
>   gdb/testsuite/gdb.base/kill-during-detach.exp | 19 ++++++++++++++++---
>   1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp
> index f5e3a902211..27584581a9b 100644
> --- a/gdb/testsuite/gdb.base/kill-during-detach.exp
> +++ b/gdb/testsuite/gdb.base/kill-during-detach.exp
> @@ -126,10 +126,23 @@ proc run_test { exit_p checkpoint_p } {
>   	# NOTE: The 'checkpoint' system in GDB appears to be a little
>   	# iffy.  This detach does seem to restore the checkpoint, but
>   	# it leaves the inferior stuck in a running state.
> -	gdb_test_no_output "python kill_and_detach()"
> +
> +	# Double the timeout, to account for the fact that we're doing two
> +	# things in kill_and_detach.
> +	with_timeout_factor 2 {
> +	    gdb_test_no_output "python kill_and_detach()"
> +	}
>       } else {
> -	gdb_test "python kill_and_detach()" \
> -	    "\\\[Inferior $::decimal \[^\r\n\]+ detached\\\]"
> +	# Double the timeout, to account for the fact that we're doing two
> +	# things in kill_and_detach.
> +	with_timeout_factor 2 {
> +	    gdb_test "python kill_and_detach()" \
> +		[subst_vars {\[Inferior $::decimal [^\r\n]+ detached\]}]
> +	}
> +
> +	# Do a simple command to drain late output of the previous command in
> +	# case it timed out.
> +	gdb_test "info inferiors" "<null>.*"
>       }
>   }
>   
> 
> base-commit: 9db3b515b964c1bbdc4d20c1202fbf27719be269


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  8:29 [PATCH] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp Tom de Vries
2026-11-20 13:28 ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox