summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2021-06-03 19:39:18 +0100
committerPedro Alves <pedro@palves.net>2021-06-14 21:53:54 +0100
commit9d5edd40e6034aeae0f063784808105c07b057fc (patch)
tree77edf503e044f4c6434d697e764cf3f39aca520b
parent8db79a51e592e9f4dad54cef3290298371d5f3f7 (diff)
downloadbinutils-gdb-9d5edd40e6034aeae0f063784808105c07b057fc.tar.gz
Make inferior/GDB share terminal in tests that exercise GDB/inferior reading same input
Some testcases exercise some aspect that only makes sense when GDB and the inferior are sharing the same terminal, meaning GDB and the inferior are reading from the same input file. This commit makes sure that continues to be tested even after GDB changed to put inferiors in their own session/terminal by default, by issuing "tty /dev/tty". The tests would fail otherwise. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * gdb.base/annota-input-while-running.exp: Issue "tty /dev/tty" before starting program. * gdb.base/continue-all-already-running.exp: Likewise. * gdb.base/infcall-input.exp: Likewise. Change-Id: Ia5f9061bf28a5e780194aa75b37b6058de0614ee
-rw-r--r--gdb/testsuite/gdb.base/annota-input-while-running.exp4
-rw-r--r--gdb/testsuite/gdb.base/continue-all-already-running.exp3
-rw-r--r--gdb/testsuite/gdb.base/infcall-input.exp12
3 files changed, 18 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/annota-input-while-running.exp b/gdb/testsuite/gdb.base/annota-input-while-running.exp
index 389cb644517..912565806e8 100644
--- a/gdb/testsuite/gdb.base/annota-input-while-running.exp
+++ b/gdb/testsuite/gdb.base/annota-input-while-running.exp
@@ -22,6 +22,10 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} {
return -1
}
+# This testcase only makes sense when GDB and the inferior are reading
+# from the same input file (aka sharing the terminal's input buffer).
+gdb_test_no_output "tty /dev/tty"
+
# Because runto_main doesn't know how to handle the prompt with annotations,
# run to main before we set the annotation level.
if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.base/continue-all-already-running.exp b/gdb/testsuite/gdb.base/continue-all-already-running.exp
index de84897c766..caff93ab425 100644
--- a/gdb/testsuite/gdb.base/continue-all-already-running.exp
+++ b/gdb/testsuite/gdb.base/continue-all-already-running.exp
@@ -20,6 +20,9 @@ standard_testfile
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
+ # This test only makes sense when GDB and the inferior are reading
+ # from the same input file / sharing the terminal.
+ append GDBFLAGS " -ex \"tty /dev/tty\""
if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/infcall-input.exp b/gdb/testsuite/gdb.base/infcall-input.exp
index fec0eb2a4d8..87bd049e139 100644
--- a/gdb/testsuite/gdb.base/infcall-input.exp
+++ b/gdb/testsuite/gdb.base/infcall-input.exp
@@ -23,10 +23,20 @@ if [target_info exists gdb,cannot_call_functions] {
continue
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+if {[build_executable "failed to compile" $testfile $srcfile debug]} {
return -1
}
+save_vars { GDBFLAGS } {
+ # This test only makes sense when GDB and the inferior are reading
+ # from the same input file / sharing the terminal. If we instead
+ # let GDB put the inferior in its own session, then while the
+ # inferior is running in the foreground, input would be redirected
+ # to the inferior, and GDB would never see that input.
+ append GDBFLAGS " -ex \"tty /dev/tty\""
+ clean_restart $binfile
+}
+
if ![runto_main] then {
fail "couldn't run to main"
return -1