]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Make inferior/GDB share terminal in tests that exercise GDB/inferior reading same...
authorPedro Alves <pedro@palves.net>
Thu, 3 Jun 2021 18:39:18 +0000 (19:39 +0100)
committerPedro Alves <pedro@palves.net>
Mon, 14 Jun 2021 20:53:54 +0000 (21:53 +0100)
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

gdb/testsuite/gdb.base/annota-input-while-running.exp
gdb/testsuite/gdb.base/continue-all-already-running.exp
gdb/testsuite/gdb.base/infcall-input.exp

index 389cb644517f9006f52b18fb72a421e62de970ca..912565806e8e2887de0be7e41a68c74d47e4e8e0 100644 (file)
@@ -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 {
index de84897c766700c11607e1149a9a477a44ec19a9..caff93ab4254d903000d150c0878a28ae5c53324 100644 (file)
@@ -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
     }
index fec0eb2a4d8cf67cf4544cab53b7763314799a47..87bd049e139335a91951c87a9eec681adcf2b51c 100644 (file)
@@ -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