This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Skip a few tests on targets that can't use the "run" commmand.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=300b6685f17cae131166eaf2fcafe10dab06466b

commit 300b6685f17cae131166eaf2fcafe10dab06466b
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Oct 12 18:20:25 2017 +0100

    Skip a few tests on targets that can't use the "run" commmand.
    
    These tests want to use raw "run", so skip them on targets that can't
    do that.
    
    Also adds a small utility procedure that clearly conveys intent instead of
    explicitly checking use_gdb_stub in the testcases.
    
    This makes sure these testcases continue to be skipped with
    --target_board=native-gdbserver once that board stops setting
    is_remote.
    
    gdb/testsuite/ChangeLog:
    2017-10-13  Pedro Alves  <palves@redhat.com>
    
    	* lib/gdb.exp (target_can_use_run_cmd): New procedure.
    	* gdb.base/annota1.exp: Use it instead of is_remote.
    	* gdb.base/annota3.exp: Use it instead of is_remote.
    	* gdb.cp/annota2.exp: Use it instead of is_remote.
    	* gdb.cp/annota3.exp: Use it instead of is_remote.
    	* gdb.multi/bkpt-multi-exec.exp: Use it instead of is_remote.

Diff:
---
 gdb/testsuite/ChangeLog                     |  9 +++++++++
 gdb/testsuite/gdb.base/annota1.exp          |  8 +++-----
 gdb/testsuite/gdb.base/annota3.exp          |  8 +++-----
 gdb/testsuite/gdb.cp/annota2.exp            |  8 +++-----
 gdb/testsuite/gdb.cp/annota3.exp            |  8 +++-----
 gdb/testsuite/gdb.multi/bkpt-multi-exec.exp |  2 +-
 gdb/testsuite/lib/gdb.exp                   | 13 +++++++++++++
 7 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e6fc382..fd604c6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,14 @@
 2017-10-13  Pedro Alves  <palves@redhat.com>
 
+	* lib/gdb.exp (target_can_use_run_cmd): New procedure.
+	* gdb.base/annota1.exp: Use it instead of is_remote.
+	* gdb.base/annota3.exp: Use it instead of is_remote.
+	* gdb.cp/annota2.exp: Use it instead of is_remote.
+	* gdb.cp/annota3.exp: Use it instead of is_remote.
+	* gdb.multi/bkpt-multi-exec.exp: Use it instead of is_remote.
+
+2017-10-13  Pedro Alves  <palves@redhat.com>
+
 	* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
 	(test_num_test_vars, run_and_count_vars, find_env)
 	(test_set_unset_env, test_inherit_env_var): New procedures.
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index dd02bb4..bb3dc2f 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -16,12 +16,10 @@
 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
 
 
-# are we on a target board? If so, don't run these tests.
-# note: this is necessary because we cannot use runto_main (which would
-# work for remote targets too) because of the different prompt we get
-# when using annotation level 2.
+# This testcase cannot use runto_main because of the different prompt
+# we get when using annotation level 2.
 #
-if [is_remote target] then {
+if ![target_can_use_run_cmd] {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
index ceb1682..5a971f0 100644
--- a/gdb/testsuite/gdb.base/annota3.exp
+++ b/gdb/testsuite/gdb.base/annota3.exp
@@ -16,12 +16,10 @@
 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
 
 
-# are we on a target board? If so, don't run these tests.
-# note: this is necessary because we cannot use runto_main (which would
-# work for remote targets too) because of the different prompt we get
-# when using annotation level 2.
+# This testcase cannot use runto_main because of the different prompt
+# we get when using annotation level 2.
 #
-if [is_remote target] then {
+if ![target_can_use_run_cmd] {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index a00161d..78e8795 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -29,12 +29,10 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
     return -1
 }
 
-# are we on a target board? If so, don't run these tests.
-# note: this is necessary because we cannot use runto_main (which would
-# work for remote targets too) because of the different prompt we get
-# when using annotation level 2.
+# This testcase cannot use runto_main because of the different prompt
+# we get when using annotation level 2.
 #
-if [is_remote target] then {
+if ![target_can_use_run_cmd] {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index 4215e76..3141251 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -29,12 +29,10 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
     return -1
 }
 
-# are we on a target board? If so, don't run these tests.
-# note: this is necessary because we cannot use runto_main (which would
-# work for remote targets too) because of the different prompt we get
-# when using annotation level 2.
+# This testcase cannot use runto_main because of the different prompt
+# we get when using annotation level 2.
 #
-if [is_remote target] then {
+if ![target_can_use_run_cmd] {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
index dba6697..d68b92f 100644
--- a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
+++ b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
@@ -13,7 +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/>.
 
-if { [is_remote target] || ![isnative] } then {
+if ![target_can_use_run_cmd] {
     continue
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 9d8296a..548cb06 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -226,6 +226,19 @@ proc delete_breakpoints {} {
     }
 }
 
+# Returns true iff the target supports using the "run" command.
+
+proc target_can_use_run_cmd {} {
+    if [target_info exists use_gdb_stub] {
+	# In this case, when we connect, the inferior is already
+	# running.
+	return 0
+    }
+
+    # Assume yes.
+    return 1
+}
+
 # Generic run command.
 #
 # The second pattern below matches up to the first newline *only*.


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