public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Fix gdb.base/readline.exp with stub-termcap
Date: Sat, 29 Apr 2023 10:48:00 +0200	[thread overview]
Message-ID: <20230429084800.25207-1-tdevries@suse.de> (raw)

When doing a build which uses stub-termcap, we run into:
...
(gdb) set width 7
<b) FAIL: gdb.base/readline.exp: set width 7 (timeout)
...

Since readline can't detect very basic terminal support, it falls back on
horizontal scrolling.

Fix this by detecting the horizontal scrolling case, and skipping the
subsequent test.

Tested on x86_64-linux.

PR testsuite/30400
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30400
---
 gdb/testsuite/gdb.base/readline.exp | 57 ++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index 87225273c25..e00ed088282 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -219,31 +219,44 @@ save_vars { env(TERM) } {
 	set char_total 4500
 	set char_sent 0
 
-	# Adjust the terminal width.
-	gdb_test_no_output "set width 7"
-
-	# Send the command prefix, then lots of additional characters
-	# that create a really long command that wraps over multiple
-	# lines.
-	send_gdb "help X"
-	gdb_test_multiple "" "send long command to GDB" {
-	    -re "X" {
-		incr char_sent
-		if {$char_sent <= $char_total} {
-		    send_gdb "X"
-		    exp_continue
-		}
+	# Adjust the terminal width.  Detect horizontal scrolling, which
+	# happens with stub-termcap.c.
+	set horizontal_scrolling 0
+	set cmd "set width 7"
+	gdb_test_multiple $cmd "" {
+	    -re "^$cmd\r\n$gdb_prompt $" {
+		pass $gdb_test_name
 	    }
-	    -re "\[ \b\r\n\]" {
-		exp_continue
+	    -re "^$cmd\r\n<b\\) $" {
+		set horizontal_scrolling 1
+		pass $gdb_test_name
 	    }
 	}
 
-	# Send the final newline so that GDB will process the command.
-	# Check GDB returns a suitable error.
-	send_gdb "\n"
-	gdb_test "" \
-	    "Undefined command: \"X+\"\\.  Try \"help\"\\." \
-	    "All the characters transferred"
+	if { !$horizontal_scrolling } {
+	    # Send the command prefix, then lots of additional characters
+	    # that create a really long command that wraps over multiple
+	    # lines.
+	    send_gdb "help X"
+	    gdb_test_multiple "" "send long command to GDB" {
+		-re "X" {
+		    incr char_sent
+		    if {$char_sent <= $char_total} {
+			send_gdb "X"
+			exp_continue
+		    }
+		}
+		-re "\[ \b\r\n\]" {
+		    exp_continue
+		}
+	    }
+
+	    # Send the final newline so that GDB will process the command.
+	    # Check GDB returns a suitable error.
+	    send_gdb "\n"
+	    gdb_test "" \
+		"Undefined command: \"X+\"\\.  Try \"help\"\\." \
+		"All the characters transferred"
+	}
     }
 }

base-commit: e0f4b3ec5f36ff90dbea21aab2190fb4565ca67b
-- 
2.35.3


                 reply	other threads:[~2023-04-29  8:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230429084800.25207-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).