forked from Imagelibrary/binutils-gdb
[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
This commit is contained in:
@@ -43,7 +43,10 @@ if {![Term::enter_tui]} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "file [standard_output_file $testfile]\n"
|
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" \
|
Term::check_contents "show main after file" \
|
||||||
[string_to_regexp "|___[format %06d $nr]_$line"]
|
[string_to_regexp "|___[format %06d $nr]_$line"]
|
||||||
|
|
||||||
|
|||||||
@@ -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 cmd_only"
|
||||||
|
|
||||||
Term::command "layout src"
|
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
|
Term::check_box "after cmd_only: src box in src layout" 0 0 80 15
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ if {![Term::enter_tui]} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Proc enter_tui switches off styling, re-enable it.
|
||||||
|
Term::command "set style enabled on"
|
||||||
|
|
||||||
Term::command "layout asm"
|
Term::command "layout asm"
|
||||||
Term::check_box "asm box" 0 0 80 15
|
Term::check_box "asm box" 0 0 80 15
|
||||||
|
|
||||||
|
|||||||
@@ -1013,6 +1013,10 @@ namespace eval Term {
|
|||||||
|
|
||||||
gdb_test_no_output "set tui border-kind ascii"
|
gdb_test_no_output "set tui border-kind ascii"
|
||||||
gdb_test_no_output "maint set tui-resize-message on"
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user