From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85291 invoked by alias); 17 Sep 2019 15:40:21 -0000 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 Received: (qmail 85280 invoked by uid 89); 17 Sep 2019 15:40:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=Network, furthermore X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Sep 2019 15:40:19 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C54D85541; Tue, 17 Sep 2019 15:40:18 +0000 (UTC) Received: from localhost (unused-10-15-17-196.yyz.redhat.com [10.15.17.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36AA05D6A5; Tue, 17 Sep 2019 15:40:18 +0000 (UTC) From: Sergio Durigan Junior To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp References: <20190914102344.GA5471@delia> Date: Tue, 17 Sep 2019 15:40:00 -0000 In-Reply-To: <20190914102344.GA5471@delia> (Tom de Vries's message of "Sat, 14 Sep 2019 12:23:47 +0200") Message-ID: <87sgovc4ny.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00316.txt.bz2 On Saturday, September 14 2019, Tom de Vries wrote: > Hi, > > When running gdb.server/server-connect.exp I run into: > ... > FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 > FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \ > using tcp6:[::1] > FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1 > FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \ > using udp6:[::1] > ... > > The FAIL is caused by the fact that the ipv6 loopback address is not available: > ... > PASS: gdb.server/server-connect.exp: tcp6: start gdbserver > target remote tcp6:::1:2347^M > A program is being debugged already. Kill it? (y or n) y^M > tcp6:::1:2347: Network is unreachable.^M > (gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 > ... > This should be marked UNSUPPORTED rather than FAIL. > > Furthermore, the test-case takes about 4 minutes, because the 'Network is > unreachable' response is not explicitly handled in gdb_target_cmd, so instead > it runs into the timeout case. > > Fix this by handling the 'Network is unreachable' response as UNSUPPORTED. > This reduces testing time from 4 minutes to about 2 seconds. > > Tested on x86_64-linux. > > OK for trunk? Thanks for the patch. It LGTM (I can't approve it though). > Thanks, > - Tom > > [gdb/testsuite] Handle unreachable network in server-connect.exp > > gdb/testsuite/ChangeLog: > > 2019-09-14 Tom de Vries > > * lib/gdbserver-support.exp (gdb_target_cmd): Return 2 (meaning > UNSUPPORTED) for 'Network is unreachable' message. > * gdb.server/server-connect.exp: Handle gdb_target_cmd returning 2. > > --- > gdb/testsuite/gdb.server/server-connect.exp | 7 +++++-- > gdb/testsuite/lib/gdbserver-support.exp | 6 +++++- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp > index 682fdaaeeb..96d3c4215a 100644 > --- a/gdb/testsuite/gdb.server/server-connect.exp > +++ b/gdb/testsuite/gdb.server/server-connect.exp > @@ -101,10 +101,13 @@ save_vars { GDB_TEST_SOCKETHOST } { > set gdbserver_gdbport [lindex $res 1] > set test "connect to gdbserver using $sockhost" > > - if { [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0 } { > + set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] > + if { $res == 0 } { > pass $test > - } else { > + } elseif { $res == 1 } { > fail $test > + } else { > + unsupported $test > } > } > } > diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp > index ade99c0ea1..5b5140b86c 100644 > --- a/gdb/testsuite/lib/gdbserver-support.exp > +++ b/gdb/testsuite/lib/gdbserver-support.exp > @@ -42,7 +42,8 @@ > > # > # gdb_target_cmd > -# Send gdb the "target" command. Returns 0 on success, 1 on failure. > +# Send gdb the "target" command. Returns 0 on success, 1 on failure, 2 on > +# unsupported. > # If specified, then ADDITIONAL_TEXT must match the text that comes after > # the connection message in order for the procedure to succeed. > # > @@ -97,6 +98,9 @@ proc gdb_target_cmd { targetname serialport {additional_text ""} } { > # Leave it there for the test to diagnose. > return 1 > } > + -re ": Network is unreachable.\r\n.*$gdb_prompt $" { > + return 2 > + } > timeout { > send_gdb "" > break -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/