This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Skipping tests that use remote protocol


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

	* 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
-- 
1.8.1.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]