From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3460 invoked by alias); 1 Jul 2009 12:06:41 -0000 Received: (qmail 3452 invoked by uid 22791); 1 Jul 2009 12:06:40 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Jul 2009 12:06:32 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n61C6Umo021731 for ; Wed, 1 Jul 2009 08:06:30 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n61C6TbA029080; Wed, 1 Jul 2009 08:06:29 -0400 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n61C6SXZ010906; Wed, 1 Jul 2009 08:06:29 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n61C6R29011119; Wed, 1 Jul 2009 14:06:28 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n61C6R4e011118; Wed, 1 Jul 2009 14:06:27 +0200 Date: Wed, 01 Jul 2009 12:06:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: [patch] testsuite: Fix multiple runs in parallel on a single host [Re: RFC: parallelize "make check"] Message-ID: <20090701120626.GA10838@host0.dyn.jankratochvil.net> References: <20090629165708.GA30963@caradoc.them.org> <20090629211657.GA6068@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090629211657.GA6068@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.19 (2009-01-05) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00008.txt.bz2 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 * 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