From patchwork Wed Jan 14 19:24:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 4685 Received: (qmail 17706 invoked by alias); 14 Jan 2015 19:24:26 -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 17690 invoked by uid 89); 14 Jan 2015 19:24:24 -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, SPF_PASS 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; Wed, 14 Jan 2015 19:24:22 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1YBTYA-0006BV-Db from Don_Breazeal@mentor.com ; Wed, 14 Jan 2015 11:24:18 -0800 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Wed, 14 Jan 2015 11:24:18 -0800 Received: by build4-lucid-cs (Postfix, from userid 1905) id A8FC740E0A; Wed, 14 Jan 2015 11:24:17 -0800 (PST) From: Don Breazeal To: , Subject: Re: [PATCH] Skip two more attach tests when testing against stub-like targets Date: Wed, 14 Jan 2015 11:24:17 -0800 Message-ID: <1421263457-21784-1-git-send-email-donb@codesourcery.com> In-Reply-To: <54B63984.2020701@redhat.com> References: <54B63984.2020701@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes On 1/14/2015 1:40 AM, Pedro Alves wrote: > Could you make the tests use spawn_wait_for_attach too? Sure, updated patch below. --Don ------------------- This patch updates two attach tests to use utility procs for checking if the attach test should run and for launching the program to be attached, as follows: 1) Use can_spawn_for_attach instead of is_remote target 2) Use spawn_wait_for_attach instead of exec/sleep Tested (1) with i686-mingw32 host and i686-pc-linux-gnu build/target and both with x86_64 Ubuntu. gdb/testsuite/ 2015-01-14 Don Breazeal * gdb.base/attach-pie-noexec.exp: Use can_spawn_for_attach instead of checking whether the target board is remote and use spawn_wait_for_attach instead of exec/sleep. * gdb.base/attach-twice.exp: Likewise. --- gdb/testsuite/gdb.base/attach-pie-noexec.exp | 9 +++++---- gdb/testsuite/gdb.base/attach-twice.exp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp index f6aa1c8..30a2f4d 100644 --- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp +++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp @@ -13,8 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Manipulation with PID on target is not supported. -if [is_remote target] then { +if {![can_spawn_for_attach]} { return 0 } @@ -53,8 +52,10 @@ if {$arch == ""} { return 0 } -set testpid [eval exec $binfile &] -exec sleep 2 +# Start the program running and then wait for a bit, to be sure +# that it can be attached to. + +set testpid [spawn_wait_for_attach $binfile] gdb_start file delete -- $binfile diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp index 654ceca..f6a9eb6 100644 --- a/gdb/testsuite/gdb.base/attach-twice.exp +++ b/gdb/testsuite/gdb.base/attach-twice.exp @@ -13,8 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Manipulation with PID on target is not supported. -if [is_remote target] then { +if {![can_spawn_for_attach]} { return 0 } @@ -25,8 +24,10 @@ if { [prepare_for_testing ${testfile}.exp $executable] } { return -1 } -set testpid [eval exec $binfile &] -exec sleep 2 +# Start the program running and then wait for a bit, to be sure +# that it can be attached to. + +set testpid [spawn_wait_for_attach $binfile] set parentpid 0