diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2024-08-12 17:32:44 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-08-12 17:32:44 +0200 |
commit | 250f1bbaf33e25da8b6beaf2e0e8a46c46127b1b (patch) | |
tree | 5352e63ed8fc5e73e7805aba90e3e4db74f6e21b /gdb | |
parent | 37ef6d976a777f186568f2b629f04a6bd9706ed7 (diff) | |
download | gdb-250f1bbaf33e25da8b6beaf2e0e8a46c46127b1b.zip gdb-250f1bbaf33e25da8b6beaf2e0e8a46c46127b1b.tar.gz gdb-250f1bbaf33e25da8b6beaf2e0e8a46c46127b1b.tar.bz2 |
[gdb/testsuite] Fix gdb.tui/wrap-line.exp with wrapping disabled
There are a couple of ways that readline wrapping can be disabled:
- using "set horizontal-scroll-mode on" in INPUTRC,
- using a TERM setting like TERM=dumb, and
- building gdb with stub-termcap.
Using a trigger patch in default_gdb_init that adds
"set horizontal-scroll-mode on" to INPUTRC:
...
- setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"]
+ setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off\nset horizontal-scroll-mode on"]
...
we can easily reproduce a failure in gdb.tui/wrap-line.exp mentioned in
PR testsuite/31201 (which was reported for the stub-termcap case):
...
WARNING: timeout in accept_gdb_output
Screen Dump (size 50 columns x 24 rows, cursor at column 34, row 1):
0 Quit
1 <89012345678901234567890123456789W
2
...
23
FAIL: gdb.tui/wrap-line.exp: width-hard-coded: cli: wrap
...
Fix this by accepting the horizontal-scroll-mode style output. We do
this only when in CLI mode though, when in TUI wrapping works as before
because it doesn't rely on readline.
Tested on x86_64-linux.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31201
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.tui/wrap-line.exp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.tui/wrap-line.exp b/gdb/testsuite/gdb.tui/wrap-line.exp index 9cddcf1..d3020bf 100644 --- a/gdb/testsuite/gdb.tui/wrap-line.exp +++ b/gdb/testsuite/gdb.tui/wrap-line.exp @@ -50,7 +50,7 @@ proc fill_line { width } { } # Test wrapping. -proc test_wrap { wrap_width } { +proc test_wrap { wrap_width tui } { # Generate a prompt and parse it. send_gdb "\003" gdb_assert { [Term::wait_for "(^|$::gdb_prompt )$::re_control_c"] } "start line" @@ -65,12 +65,31 @@ proc test_wrap { wrap_width } { send_gdb "W" # Check that the wrap occurred at the expected location. - gdb_assert { [Term::wait_for_region_contents 0 0 $::cols $::lines \ - "$::gdb_prompt $str$space\r\nW"] } "wrap" + set re_wrap \ + [multi_line \ + "$::gdb_prompt $str$space" \ + "W"] + set re_no_wrap \ + [multi_line \ + "" \ + "<.*W"] + if { $tui } { + set re $re_wrap + } else { + set re ($re_wrap|$re_no_wrap) + } + gdb_assert { [Term::wait_for_region_contents 0 0 $::cols $::lines $re] } "wrap" # Generate a prompt and parse it. send_gdb "\003" - gdb_assert { [Term::wait_for "^W$::re_control_c"] } "prompt after wrap" + set re_wrap W$::re_control_c + set re_no_wrap <.*W$::re_control_c + if { $tui } { + set re $re_wrap + } else { + set re ($re_wrap|$re_no_wrap) + } + gdb_assert { [Term::wait_for ^$re] } "prompt after wrap" } # Test wrapping in both CLI and TUI. @@ -107,7 +126,7 @@ proc test_wrap_cli_tui { auto_detected_width } { with_test_prefix cli { set wrap_width $readline_width - test_wrap $wrap_width + test_wrap $wrap_width 0 } with_test_prefix tui { @@ -126,7 +145,7 @@ proc test_wrap_cli_tui { auto_detected_width } { # for wrapping from curses. set wrap_width $::cols - test_wrap $wrap_width + test_wrap $wrap_width 1 } } |