Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: [patch] testsuite: Fix multiple runs in parallel on a single host 	[Re: RFC: parallelize "make check"]
Date: Wed, 01 Jul 2009 12:06:00 -0000	[thread overview]
Message-ID: <20090701120626.GA10838@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20090629211657.GA6068@host0.dyn.jankratochvil.net>

On Mon, 29 Jun 2009 23:16:57 +0200, Jan Kratochvil wrote:
> On Mon, 29 Jun 2009 20:05:10 +0200, Tom Tromey wrote:
> >     gdb.base/watchpoint.exp
(This is a FSF GDB HEAD problem watchpoints are not distributed across threads.)


> >     gdb.mi/mi-file-transfer.exp, gdb.server/file-transfer.exp,

These + others get fixed by the patch below.

>  Running ../../../gdb/testsuite/gdb.server/file-transfer.exp ...
> -PASS: gdb.server/file-transfer.exp: put binary file
> -PASS: gdb.server/file-transfer.exp: get binary file
...
> +ERROR: tcl error sourcing ../../../gdb/testsuite/gdb.server/file-transfer.exp.
> +ERROR: : spawn id exp18 not open
> +    while executing
> +"expect_background -nobrace -i exp18 full_buffer { } eof {
...

It normally mostly always happens with multiple parallel testsuite runs on the
same host.  Now with the parallel check there is also a (low probability) it
would bite even during a single testsuite parallel run.

Regression tested on FSF GDB HEAD on {x86_64,i686}-fedora-linux-gnu.


Thanks,
Jan


gdb/testsuite/
2009-07-01  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/gdbserver-support.exp (gdbserver_start): Loop spawning
	gdbserver increasing $portnum if "Can't bind address" has been seen.

--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -209,26 +209,39 @@ proc gdbserver_start { options arguments } {
 
     set gdbserver [find_gdbserver]
 
-    # Export the host:port pair.
-    set gdbport $debughost$portnum
-
-    # Fire off the debug agent.
-    set gdbserver_command "$gdbserver"
-    if { $options != "" } {
-	append gdbserver_command " $options"
-    }
-    append gdbserver_command " :$portnum"
-    if { $arguments != "" } {
-	append gdbserver_command " $arguments"
-    }
-
-    set server_spawn_id [remote_spawn target $gdbserver_command]
+    # Loop till we find a free port.
+    while 1 {
+	# Export the host:port pair.
+	set gdbport $debughost$portnum
+
+	# Fire off the debug agent.
+	set gdbserver_command "$gdbserver"
+	if { $options != "" } {
+	    append gdbserver_command " $options"
+	}
+	append gdbserver_command " :$portnum"
+	if { $arguments != "" } {
+	    append gdbserver_command " $arguments"
+	}
 
-    # Wait for the server to open its TCP socket, so that GDB can connect.
-    expect {
-	-i $server_spawn_id
-	-notransfer
-	-re "Listening on" { }
+	set server_spawn_id [remote_spawn target $gdbserver_command]
+
+	# Wait for the server to open its TCP socket, so that GDB can connect.
+	expect {
+	    -i $server_spawn_id
+	    -notransfer
+	    -re "Listening on" { }
+	    -re "Can't bind address: 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
+		}
+	    }
+	}
+	break
     }
 
     # We can't just call close, because if gdbserver is local then that means


  reply	other threads:[~2009-07-01 12:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24 19:27 RFC: parallelize "make check" Tom Tromey
2009-06-25  3:15 ` Eli Zaretskii
2009-06-25 20:21   ` Tom Tromey
2009-06-26  6:53     ` Eli Zaretskii
2009-06-26 15:56       ` Tom Tromey
2009-06-27  9:13         ` Eli Zaretskii
2009-06-25 14:55 ` Joel Brobecker
2009-06-25 15:09   ` Tom Tromey
2009-06-25 22:58 ` Pedro Alves
2009-06-26  1:34   ` Daniel Jacobowitz
2009-06-26 17:45   ` Tom Tromey
2009-06-26 20:27     ` Joseph S. Myers
2009-06-26 23:41     ` Joel Brobecker
2009-06-29 16:43 ` Tom Tromey
2009-06-29 16:57   ` Daniel Jacobowitz
2009-06-29 18:05     ` Tom Tromey
2009-06-29 18:38       ` Daniel Jacobowitz
2009-06-29 21:17       ` Jan Kratochvil
2009-07-01 12:06         ` Jan Kratochvil [this message]
2009-07-06 18:39           ` [patch] testsuite: Fix multiple runs in parallel on a single host [Re: RFC: parallelize "make check"] Tom Tromey
2009-07-06 18:53             ` [patch] testsuite: Fix multiple runs in parallel on a single host Jan Kratochvil

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=20090701120626.GA10838@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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