[gdb/testsuite] Fix gdb.python/py-source-styling-2.exp with TERM=dumb

When running test-case gdb.python/py-source-styling-2.exp with TERM=dumb, I
get:
...
(gdb) set style enabled on^M
warning: The current terminal doesn't support styling. \
  Styled output might not appear as expected.^M
(gdb) FAIL: $exp: set style enabled on
...

Fix this by using with_ansi_styling_terminal on clean_restart.

Tested on x86_64-linux.
This commit is contained in:
Tom de Vries
2025-06-16 15:13:25 +02:00
parent 564624a452
commit 1cf1bd62c3

View File

@@ -32,7 +32,9 @@ if { [build_executable "failed to build" $testfile $srcfile $opts] == -1 } {
return return
} }
with_ansi_styling_terminal {
clean_restart clean_restart
}
gdb_test_no_output "maint set gnu-source-highlight enabled off" gdb_test_no_output "maint set gnu-source-highlight enabled off"
@@ -40,7 +42,6 @@ gdb_load $binfile
require {gdb_py_module_available pygments} require {gdb_py_module_available pygments}
with_ansi_styling_terminal {
gdb_test_no_output "set style enabled on" gdb_test_no_output "set style enabled on"
gdb_test_multiple "list $line_number" "Styling of c++ keyword try" { gdb_test_multiple "list $line_number" "Styling of c++ keyword try" {
@@ -52,4 +53,3 @@ with_ansi_styling_terminal {
pass $gdb_test_name pass $gdb_test_name
} }
} }
}