public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix race in gdb.server/multi-ui-errors.exp Date: Wed, 24 May 2023 17:38:27 +0000 (GMT) [thread overview] Message-ID: <20230524173827.1E95C3858D39@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cbd9efbbc0414b71d47020958b5fbeff25504f15 commit cbd9efbbc0414b71d47020958b5fbeff25504f15 Author: Andrew Burgess <aburgess@redhat.com> Date: Wed May 24 17:18:52 2023 +0100 gdb/testsuite: fix race in gdb.server/multi-ui-errors.exp After this commit: commit ed32754a8c7919feffc6ddb66ff1c532e4a4d1cd Date: Thu Mar 9 10:45:03 2023 +0100 [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp for remote target I noticed the occasional failure in gdb.server/multi-ui-errors.exp, which looked like this: (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI interrupt (gdb) Program received signal SIGINT, Interrupt. 0x00007ffff7d501e7 in nanosleep () from /lib64/libc.so.6 FAIL: gdb.server/multi-ui-errors.exp: interrupt (timeout) PASS: gdb.server/multi-ui-errors.exp: interrupt arrived p server_pid $1 = 718174 (gdb) PASS: gdb.server/multi-ui-errors.exp: p server_pid This is triggered by this code in gdb.server/multi-ui-errors.exp: gdb_test "interrupt" gdb_test_multiple "" "interrupt arrived" { -re "Program received signal SIGINT, Interrupt\\.\r\n" { pass $gdb_test_name } } The problem here is that the first interrupt will trigger the prompt to be printed, and then, after some time the inferior will be interrupted. However the default pattern for gdb_test includes a '$' end anchor. If expect sees the prompt with nothing following it then everything is fine, and the test passes. However, if the interrupt is quick and so what expect sees is this: (gdb) Program received signal SIGINT, Interrupt. 0x00007ffff7d501e7 in nanosleep () from /lib64/libc.so.6 In this case the end anchor means that the gdb_test fails to match, and eventually times out. Fix this by passing -no-prompt-anchor to gdb_test. Reviewed-By: Tom de Vries <tdevries@suse.de> Diff: --- gdb/testsuite/gdb.server/multi-ui-errors.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp index af83614fe55..47ded35bc86 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.exp +++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp @@ -106,7 +106,7 @@ with_spawn_id $gdb_main_spawn_id { # Get the gdbserver PID. set gdbserver_pid 0 with_spawn_id $gdb_main_spawn_id { - gdb_test "interrupt" + gdb_test -no-prompt-anchor "interrupt" gdb_test_multiple "" "interrupt arrived" { -re "Program received signal SIGINT, Interrupt\\.\r\n" {
reply other threads:[~2023-05-24 17:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230524173827.1E95C3858D39@sourceware.org \ --to=aburgess@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).