From patchwork Fri Dec 12 00:41:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 4205 Received: (qmail 26034 invoked by alias); 12 Dec 2014 00:41:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 26024 invoked by uid 89); 12 Dec 2014 00:41:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Dec 2014 00:41:40 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XzEIb-0003FE-Lz from Don_Breazeal@mentor.com for gdb-patches@sourceware.org; Thu, 11 Dec 2014 16:41:37 -0800 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.181.6; Thu, 11 Dec 2014 16:41:37 -0800 Received: by build4-lucid-cs (Postfix, from userid 1905) id E256D40DD3; Thu, 11 Dec 2014 16:41:36 -0800 (PST) From: Don Breazeal To: Subject: [PATCH] Skipping tests that use remote protocol Date: Thu, 11 Dec 2014 16:41:36 -0800 Message-ID: <1418344896-9036-1-git-send-email-donb@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes This patch introduces gdb_using_remote_protocol and gdb_using_extended_protocol. These procedures are needed to reliably determine if tests not supported for one or both of the remote protocols should be skipped. An example of the use of gdb_using_remote_protocol in gdb.base/attach.exp is included in the patch. We encountered problems here in a scenario where runtest is invoked on system A, the host is system B, and the target is system A. is_remote failed to detect that host != target. The existing methods of detecting this use procedures that don't work in all cases. In gdb.base/attach.exp, for example, it attempts to skip the test for 'target remote' by checking [is_remote target]. However, [is_remote target] checks if the target is remote relative to the "build" system, the system where runtest is executing. It doesn't check if the target is remote relative to the host, which may or may not be the same as "build". Other procedures are also used that don't really check the right thing. * isnative checks the build triplet against the target triplet. * gdb_is_target_remote and target_is_gdbserver don't differentiate between remote and extended-remote. Both require GDB to be running, which makes using them to skip a test less efficient than a procedure that uses info from the target board config file. * target_info use_gdb_stub is used in lib/gdb.exp to explicitly determine if a target is remote and not extended-remote. If we reach consensus on this approach I'll follow up with patches to convert other tests to use these procedures instead of is_remote, isnative, and so on. Thanks! --Don gdb/testsuite/ 2014-12-11 Don Breazeal * gdb.base/attach.exp: Replace call to is_remote with call to gdb_using_remote_protocol and if so, call unsupported. * lib/gdb.exp (gdb_using_remote_protocol): New proc. (gdb_using_extended_protocol): New proc. --- gdb/testsuite/gdb.base/attach.exp | 5 +++-- gdb/testsuite/lib/gdb.exp | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index 5fb5c53..fe12c7b 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -25,8 +25,9 @@ if { [istarget "hppa*-*-hpux*"] } { return 0 } -# are we on a target board -if [is_remote target] then { +# are we using 'target remote' +if { [gdb_using_remote_protocol] } { + unsupported attach.exp return 0 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a29b661..f3d2b53 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2537,6 +2537,26 @@ proc gdb_is_target_remote {} { return 0 } +# Check if we are using the remote protocol. + +proc gdb_using_remote_protocol {} { + if { [target_info exists gdb_protocol] + && [target_info gdb_protocol] == "remote" } { + return 1 + } + return 0 +} + +# Check if we are testing with the extended-remote target. + +proc gdb_using_extended_protocol {} { + if { [target_info exists gdb_protocol] + && [target_info gdb_protocol] == "extended-remote" } { + return 1 + } + return 0 +} + set compiler_info "unknown" set gcc_compiled 0 set hp_cc_compiler 0