]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
testsuite: skip confirmation in 'gdb_reinitialize_dir'
authorRohr, Stephan <stephan.rohr@intel.com>
Thu, 19 Sep 2024 10:55:19 +0000 (12:55 +0200)
committerStephan Rohr <stephan.rohr@intel.com>
Thu, 21 Nov 2024 08:49:39 +0000 (00:49 -0800)
Some shells automatically confirm the 'dir' command:

  (gdb) dir
  Reinitialize source path to empty? (y or n)
    [answered Y; input not from terminal]
  Source directories searched: $cdir;$cwd
  (gdb) y
  dir <...>/gdb/testsuite/gdb.base
  Undefined command: "y".  Try "help".

For example, this reprdocues in a MinGW32 environment with
'TERM=dumb'.  Skip sending 'y' if the command is already confirmed.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/lib/gdb.exp

index 5d4d9db3ea4e74fb7a75a2b9391a2a176c835655..2b27d7fc9e786d5d337714c2d9ebe4c182f5525e 100644 (file)
@@ -2238,8 +2238,10 @@ proc gdb_reinitialize_dir { subdir } {
     }
     send_gdb "dir\n"
     gdb_expect 60 {
-       -re "Reinitialize source path to empty.*y or n. " {
-           send_gdb "y\n" answer
+       -re "Reinitialize source path to empty.*y or n.(\\\s.answered Y; input not from terminal.)?" {
+           if {![info exists expect_out(1,string)]} {
+               send_gdb "y\n" answer
+           }
            gdb_expect 60 {
                -re "Source directories searched.*$gdb_prompt $" {
                    send_gdb "dir $subdir\n"