]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix regexp in gdb.base/style.exp
authorTom de Vries <tdevries@suse.de>
Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)
In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 66, I run into:
...
FAIL: gdb.base/style.exp: check pagination prompt styling
...
due to the test classifying this line as a bad line:
...
  $hex - $hex is .init_array in --Type <RET> for more, ...
...

This is due to a bug in this regexp:
...
    # For lines that don't match this pattern, we cannot comment on
    # where the style reset should occur, so lets just claim the line
    # is fine.
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } {
return true
    }
...
which is supposed to determine whether the line needs to contain a style
reset.

For aforementioned line, the regexp matches, so the test concludes that the
line should have a style reset, and because it hasn't, it classifies it as a
bad line.

Fix this by making the regexp more strict:
...
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } {
...

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/testsuite/gdb.base/style.exp

index 514c3e87399b898ade76b248c37b708c42423cd6..8c1bb739f5016360816cd4505de19d981f32e075 100644 (file)
@@ -859,7 +859,7 @@ proc previous_line_is_ok { str } {
     # For lines that don't match this pattern, we cannot comment on
     # where the style reset should occur, so lets just claim the line
     # is fine.
-    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } {
+    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } {
        return true
     }