diff options
author | Tom de Vries <tdevries@suse.de> | 2025-08-14 15:49:20 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-08-14 15:49:20 +0200 |
commit | 546ddc53ee289c4a831f10adb16c03e363437e17 (patch) | |
tree | 78195d07b4afcbc6eba87db8f6336f056720bd0d | |
parent | b3f31f8eea41213e264ddf673057d27bc9c155ea (diff) | |
download | binutils-546ddc53ee289c4a831f10adb16c03e363437e17.zip binutils-546ddc53ee289c4a831f10adb16c03e363437e17.tar.gz binutils-546ddc53ee289c4a831f10adb16c03e363437e17.tar.bz2 |
[gdb/testsuite] Disable CLI styling by default in Term::prepare_tui
On x86_64-freebsd, with test-case gdb.tui/main.exp, I ran into a failure to
match the output of the file command, for which I submitted a patch [1].
However, after switching to TERM=ansiw for bsd, I could no longer reproduce
the problem.
Investigation showed that the difference was caused by CLI styling.
A command:
...
(gdb) file <filename>
...
gives an output:
...
Reading symbols from <filename>...
(gdb)
...
On x86_64-linux, with CLI styling I get:
...
Reading symbols from ^[[32m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.tui/main/main^[[39m^[[0;10m...
...
After disabling CLI styling using "set style enabled off", I simply get:
...
Reading symbols from /data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.tui/main/main...
...
and run into the same failure as on x86_64-freebsd.
The extra csi sequence "^[[32m" causes an additional matching attempt in
Term::wait_for, and the way we're currently matching relies on this:
...
send_gdb "file [standard_output_file $testfile]\n"
gdb_assert { [Term::wait_for "Reading symbols from"] } "file command"
...
Make the TUI testsuite more stable and matching more simple by disabling CLI
styling by default, and:
- fix the resulting fallout in test-cases gdb.tui/main.exp and
gdb.tui/new-layout.exp, and
- re-enable CLI styling in the one test-case that needs it:
gdb.tui/tui-disasm-styling.exp.
Tested on x86_64-linux.
[1] https://sourceware.org/pipermail/gdb-patches/2025-June/218942.html
-rw-r--r-- | gdb/testsuite/gdb.tui/main.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/new-layout.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/tui-disasm-styling.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp index d6960c7..e49da35 100644 --- a/gdb/testsuite/gdb.tui/main.exp +++ b/gdb/testsuite/gdb.tui/main.exp @@ -43,7 +43,10 @@ if {![Term::enter_tui]} { } send_gdb "file [standard_output_file $testfile]\n" -gdb_assert { [Term::wait_for "Reading symbols from"] } "file command" +# Matching the output is difficult because it may or may not wrap. Simply +# match the resulting prompt. +gdb_assert { [Term::wait_for ""] } "file command" + Term::check_contents "show main after file" \ [string_to_regexp "|___[format %06d $nr]_$line"] diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp index f517997..914e10c 100644 --- a/gdb/testsuite/gdb.tui/new-layout.exp +++ b/gdb/testsuite/gdb.tui/new-layout.exp @@ -150,4 +150,7 @@ Term::check_box "before cmd_only: src box in src layout" 0 0 80 15 Term::command "layout cmd_only" Term::command "layout src" + +# Flush out and check the resulting src box. +Term::command "print 1" Term::check_box "after cmd_only: src box in src layout" 0 0 80 15 diff --git a/gdb/testsuite/gdb.tui/tui-disasm-styling.exp b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp index 513d787..43b8ecf 100644 --- a/gdb/testsuite/gdb.tui/tui-disasm-styling.exp +++ b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp @@ -43,6 +43,9 @@ if {![Term::enter_tui]} { return } +# Proc enter_tui switches off styling, re-enable it. +Term::command "set style enabled on" + Term::command "layout asm" Term::check_box "asm box" 0 0 80 15 diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 7b8745a..2164017 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -1013,6 +1013,10 @@ namespace eval Term { gdb_test_no_output "set tui border-kind ascii" gdb_test_no_output "maint set tui-resize-message on" + # When matching GDB output using Term::wait_for, the number of + # matching attempts in wait_for can be influenced by CLI styling. + # Disable it by default to avoid this. + gdb_test_no_output "set style enabled off" return 1 } |