public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Skip two more attach tests when testing against stub-like targets
@ 2015-01-13 22:47 Don Breazeal
  2015-01-14  9:40 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Don Breazeal @ 2015-01-13 22:47 UTC (permalink / raw)
  To: gdb-patches

This is a follow-up to Pedro's recent patch 'Skip "attach" tests when
testing against stub-like targets'
(https://sourceware.org/ml/gdb-patches/2015-01/msg00119.html).  This
patch replaces "is_remote target" with "can_spawn_for_attach" in 
two more attach tests where "attach" doesn't make sense so that they
are skipped when appropriate.

Tested with i686-mingw32 host and i686-pc-linux-gnu build/target.

OK?

Thanks
--Don

gdb/testsuite/
2015-01-13  Don Breazeal  <donb@codesourcery.com>

	* gdb.base/attach-pie-noexec.exp: Use can_spawn_for_attach
	instead of checking whether the target board is remote.
	* gdb.base/attach-twice.exp: Likewise.

---
 gdb/testsuite/gdb.base/attach-pie-noexec.exp |    3 +--
 gdb/testsuite/gdb.base/attach-twice.exp      |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
index f6aa1c8..b53d516 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 <http://www.gnu.org/licenses/>.
 
-# Manipulation with PID on target is not supported.
-if [is_remote target] then {
+if {![can_spawn_for_attach]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp
index 654ceca..eb03c92 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 <http://www.gnu.org/licenses/>.
 
-# Manipulation with PID on target is not supported.
-if [is_remote target] then {
+if {![can_spawn_for_attach]} {
     return 0
 }
 
-- 
1.7.0.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Skip two more attach tests when testing against stub-like targets
  2015-01-13 22:47 [PATCH] Skip two more attach tests when testing against stub-like targets Don Breazeal
@ 2015-01-14  9:40 ` Pedro Alves
  2015-01-14 19:24   ` Don Breazeal
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2015-01-14  9:40 UTC (permalink / raw)
  To: Don Breazeal, gdb-patches

On 01/13/2015 10:47 PM, Don Breazeal wrote:

> gdb/testsuite/
> 2015-01-13  Don Breazeal  <donb@codesourcery.com>
> 
> 	* gdb.base/attach-pie-noexec.exp: Use can_spawn_for_attach
> 	instead of checking whether the target board is remote.
> 	* gdb.base/attach-twice.exp: Likewise.

Could you make the tests use spawn_wait_for_attach too?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Skip two more attach tests when testing against stub-like targets
  2015-01-14  9:40 ` Pedro Alves
@ 2015-01-14 19:24   ` Don Breazeal
  2015-01-15  8:54     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Don Breazeal @ 2015-01-14 19:24 UTC (permalink / raw)
  To: gdb-patches, palves

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  <donb@codesourcery.com>

	* 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 <http://www.gnu.org/licenses/>.
 
-# 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 <http://www.gnu.org/licenses/>.
 
-# 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
 
-- 
1.8.1.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Skip two more attach tests when testing against stub-like targets
  2015-01-14 19:24   ` Don Breazeal
@ 2015-01-15  8:54     ` Pedro Alves
  2015-01-15 19:04       ` Breazeal, Don
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2015-01-15  8:54 UTC (permalink / raw)
  To: Don Breazeal, gdb-patches

On 01/14/2015 07:24 PM, Don Breazeal wrote:
> 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.

OK.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Skip two more attach tests when testing against stub-like targets
  2015-01-15  8:54     ` Pedro Alves
@ 2015-01-15 19:04       ` Breazeal, Don
  0 siblings, 0 replies; 5+ messages in thread
From: Breazeal, Don @ 2015-01-15 19:04 UTC (permalink / raw)
  To: Pedro Alves, Breazeal, Don, gdb-patches

On 1/15/2015 12:54 AM, Pedro Alves wrote:
> On 01/14/2015 07:24 PM, Don Breazeal wrote:
>> 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.
> 
> OK.
> 
> Thanks,
> Pedro Alves
> 
This has been pushed.
Thanks
--Don

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-15 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-13 22:47 [PATCH] Skip two more attach tests when testing against stub-like targets Don Breazeal
2015-01-14  9:40 ` Pedro Alves
2015-01-14 19:24   ` Don Breazeal
2015-01-15  8:54     ` Pedro Alves
2015-01-15 19:04       ` Breazeal, Don

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).