[pushed,4/4,gdb/testsuite] Require use_gdb_stub == 0 where appropriate

Message ID 20211013090031.21963-4-tdevries@suse.de
State New
Headers show
Series
  • [pushed,1/4,gdb/testsuite] Remove quit in gdb.arch/i386-mpx.exp
Related show

Commit Message

Stafford Horne via Gdb-patches Oct. 13, 2021, 9 a.m.
When running with target board native-gdbserver, we run into a number of FAILs
due to use of the start command (and similar), which is not supported when
use_gdb_stub == 1.

Fix this by:
- requiring use_gdb_stub == 0 for the entire test-case, or
- guarding some tests in the test-case with use_gdb_stub == 0.

Tested on x86_64-linux.
---
 .../frame-inlined-in-outer-frame.exp          |  3 ++
 gdb/testsuite/gdb.mi/mi-async.exp             |  3 ++
 gdb/testsuite/gdb.python/python.exp           | 37 ++++++++++---------
 gdb/testsuite/gdb.reverse/insn-reverse.exp    |  3 ++
 gdb/testsuite/gdb.tui/tui-missing-src.exp     |  3 ++
 gdb/testsuite/lib/gdb.exp                     |  3 ++
 6 files changed, 35 insertions(+), 17 deletions(-)

-- 
2.26.2

Patch

diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
index f95558dffef..e19c474bb60 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
@@ -25,6 +25,9 @@ 
 # Because of (1), the test has to be written in assembly with explicit CFI
 # directives.
 
+# Check if starti command is supported.
+require use_gdb_stub 0
+
 load_lib dwarf.exp
 
 if {![dwarf2_support]} {
diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp
index d2fec08000d..1272c68922e 100644
--- a/gdb/testsuite/gdb.mi/mi-async.exp
+++ b/gdb/testsuite/gdb.mi/mi-async.exp
@@ -25,6 +25,9 @@  if { !([isnative] && [istarget *-linux*]) } then {
   return
 }
 
+# Check if start command is supported.
+require use_gdb_stub 0
+
 # The plan is for async mode to become the default but toggle for now.
 set saved_gdbflags $GDBFLAGS
 set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 7f9c2b4af7f..c36699de71d 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -539,22 +539,25 @@  gdb_test "print \$cvar3" "= void" \
 # "show commands".
 gdb_test "python gdb.execute(\"show commands\")" "$decimal  print \\\$cvar3.*"
 
-# Test that the from_tty argument to gdb.execute is effective. If
-# False, the user is not prompted for decisions such as restarting the
-# program, and "yes" is assumed. If True, the user is prompted.
-# Case 1, from_tty=False.
-gdb_test "python gdb.execute('starti', from_tty=False)" \
-    "Program stopped.*" \
-    "starti via gdb.execute, not from tty"
-
-# Case 2, from_tty=True.
-set test "starti via gdb.execute, from tty"
-set question \
-    [multi_line \
-	 {The program being debugged has been started already\.} \
-	 {Start it from the beginning\? \(y or n\) $}]
-gdb_test_multiple "python gdb.execute('starti', from_tty=True)" $test {
-    -re $question {
-	gdb_test "y" "Starting program:.*" $gdb_test_name
+# Check if starti command is supported.
+if { [use_gdb_stub] == 0 } {
+    # Test that the from_tty argument to gdb.execute is effective. If
+    # False, the user is not prompted for decisions such as restarting the
+    # program, and "yes" is assumed. If True, the user is prompted.
+    # Case 1, from_tty=False.
+    gdb_test "python gdb.execute('starti', from_tty=False)" \
+	"Program stopped.*" \
+	"starti via gdb.execute, not from tty"
+
+    # Case 2, from_tty=True.
+    set test "starti via gdb.execute, from tty"
+    set question \
+	[multi_line \
+	     {The program being debugged has been started already\.} \
+	     {Start it from the beginning\? \(y or n\) $}]
+    gdb_test_multiple "python gdb.execute('starti', from_tty=True)" $test {
+	-re $question {
+	    gdb_test "y" "Starting program:.*" $gdb_test_name
+	}
     }
 }
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp
index 47f0166a762..50b8e9c3425 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp
@@ -17,6 +17,9 @@  if ![supports_reverse] {
     return
 }
 
+# Check if start command is supported.
+require use_gdb_stub 0
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
diff --git a/gdb/testsuite/gdb.tui/tui-missing-src.exp b/gdb/testsuite/gdb.tui/tui-missing-src.exp
index 3116864ec80..c108cceaa9a 100644
--- a/gdb/testsuite/gdb.tui/tui-missing-src.exp
+++ b/gdb/testsuite/gdb.tui/tui-missing-src.exp
@@ -25,6 +25,9 @@ 
 #    layout must show the contents of f2.c.
 # 7. Going back to main() shall result in no contents again.
 
+# Check if start command is supported.
+require use_gdb_stub 0
+
 tuiterm_env
 
 standard_testfile
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 90131fe4ee7..7f02504262d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8251,6 +8251,9 @@  proc require { fn arg1 {arg2 ""} } {
 	"ensure_gdb_index $binfile -dwarf-5 != -1" {
 	    set msg "Couldn't ensure index in binfile"
 	}
+	"use_gdb_stub == 0" {
+	    set msg "Remote stub used"
+	}
 	default { set msg "$fn != $val" }
     }