]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.python/py-source-styling-2.exp with TERM=dumb
authorTom de Vries <tdevries@suse.de>
Mon, 16 Jun 2025 13:13:25 +0000 (15:13 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 16 Jun 2025 13:13:25 +0000 (15:13 +0200)
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.

gdb/testsuite/gdb.python/py-source-styling-2.exp

index b13ee1f3d27acff2bcd7e1f89f0aa5339835437e..ebf7f326cdd2bf32025febccb7c536c3b5b3e00f 100644 (file)
@@ -32,7 +32,9 @@ if { [build_executable "failed to build" $testfile $srcfile $opts] == -1 } {
     return
 }
 
-clean_restart
+with_ansi_styling_terminal {
+    clean_restart
+}
 
 gdb_test_no_output "maint set gnu-source-highlight enabled off"
 
@@ -40,16 +42,14 @@ gdb_load $binfile
 
 require {gdb_py_module_available pygments}
 
-with_ansi_styling_terminal {
-    gdb_test_no_output "set style enabled on"
-
-    gdb_test_multiple "list $line_number" "Styling of c++ keyword try" {
-       -re -wrap "  try\r\n.*" {
-           # Unstyled.
-           fail $gdb_test_name
-       }
-       -re -wrap "" {
-           pass $gdb_test_name
-       }
+gdb_test_no_output "set style enabled on"
+
+gdb_test_multiple "list $line_number" "Styling of c++ keyword try" {
+    -re -wrap "  try\r\n.*" {
+       # Unstyled.
+       fail $gdb_test_name
+    }
+    -re -wrap "" {
+       pass $gdb_test_name
     }
 }