public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/31632] [gdb/testsuite] Connecting to wrong gdbserver during parallel testing
Date: Sat, 13 Apr 2024 09:48:26 +0000	[thread overview]
Message-ID: <bug-31632-4717-XU93b0Tdx8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31632-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31632

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I'm not sure exactly how this failure is caused, but I think making sure
test-cases run in parallel get unique portnums is a way to fix this.

The current approach is that we have:
...
global portnum
set portnum "2345"
...
and in gdbserver_start we do:
...
        # Bump the port number to avoid conflicts with hung ports.              
        incr portnum
...
which works ok for serial testing.

There there's this bit:
...
           -re "Can't (bind address|listen on socket): Address already in
use\\.\r\n" {
                verbose -log "Port $portnum is already in use."
                if ![target_info exists gdb,socketport] {
                    # Bump the port number to avoid the conflict.               
                    wait -i $expect_out(spawn_id)
                    incr portnum
                    continue
                }
            }
...
which should avoid clashes with other uses.

We can't avoid clashes completely, given that things may happen outside of the
scope of gdb testing, but we should avoid running into clashes due to parallel
gdb testing.

So, we're gonna need a unique dir that needs to be created/emptied when making
make-target check//%, and passed down using a variable say, GDB_LOCK_DIR.

Each make invocation can then check GDB_LOCK_DIR, if it doesn't exist (because
of not using make check//), create it's own and use it, and if it does, use
that one.

[ I then wonder what happens when using check// and plain check next to each
other.  But perhaps this is already unsupported/broken today. ]

Then we can track portnum in $GDB_LOCK_DIR/portnum and use
$GDB_LOCK_DIR/portnum.lock to serialize parallel access.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2024-04-13  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 13:36 [Bug testsuite/31632] New: " vries at gcc dot gnu.org
2024-04-13  9:48 ` vries at gcc dot gnu.org [this message]
2024-04-15 15:59 ` [Bug testsuite/31632] " vries at gcc dot gnu.org
2024-05-04  8:41 ` cvs-commit at gcc dot gnu.org
2024-05-04  8:46 ` vries at gcc dot gnu.org

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=bug-31632-4717-XU93b0Tdx8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).