diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-03-30 13:26:25 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-04-27 13:56:37 +0100 |
commit | e2f620135d92f7cd670af4e524fffec7ac307666 (patch) | |
tree | 806c567979eb14373f6bd639bc9600e9a54b0818 /gdb/testsuite/gdb.stabs | |
parent | c5a5f322a4e50fbfb303874671ab541757a941cf (diff) | |
download | binutils-e2f620135d92f7cd670af4e524fffec7ac307666.zip binutils-e2f620135d92f7cd670af4e524fffec7ac307666.tar.gz binutils-e2f620135d92f7cd670af4e524fffec7ac307666.tar.bz2 |
gdb/testsuite: change newline patterns used in gdb_test
This commit makes two changes to how we match newline characters in
the gdb_test proc.
First, for the newline pattern between the command output and the
prompt, I propose changing from '[\r\n]+' to an explicit '\r\n'.
The old pattern would spot multiple newlines, and so there are a few
places where, as part of this commit, I've needed to add an extra
trailing '\r\n' to the pattern in the main test file, where GDB's
output actually includes a blank line.
But I think this is a good thing. If a command produces a blank line
then we should be checking for it, the current gdb_test doesn't do
that. But also, with the current gdb_test, if a blank line suddenly
appears in the output, this is going to be silently ignored, and I
think this is wrong, the test should fail in that case.
Additionally, the existing pattern will happily match a partial
newline. There are a strangely large number of tests that end with a
random '.' character. Not matching a literal period, but matching any
single character, this is then matching half of the trailing newline
sequence, while the \[\r\n\]+ in gdb_test is matching the other half
of the sequence. I can think of no reason why this would be
intentional, I suspect that the expected output at one time included a
period, which has since been remove, but I haven't bothered to check
on this. In this commit I've removed all these unneeded trailing '.'
characters.
The basic rule of gdb_test after this is that the expected pattern
needs to match everything up to, but not including the newline
sequence immediately before the GDB prompt. This is generally how the
proc is used anyway, so in almost all cases, this commit represents no
significant change.
Second, while I was cleaning up newline matching in gdb_test, I've
also removed the '[\r\n]*' that was added to the start of the pattern
passed to gdb_test_multiple.
The addition of this pattern adds no value. If the user pattern
matches at the start of a line then this would match against the
newline sequence. But, due to the '*', if the user pattern doesn't
match at the start of a line then this group doesn't care, it'll
happily match nothing.
As such, there's no value to it, it just adds more complexity for no
gain, so I'm removing it. No tests will need updating as a
consequence of this part of the patch.
Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.stabs')
-rw-r--r-- | gdb/testsuite/gdb.stabs/exclfwd.exp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp index e7ee938..a6e6ff8 100644 --- a/gdb/testsuite/gdb.stabs/exclfwd.exp +++ b/gdb/testsuite/gdb.stabs/exclfwd.exp @@ -40,14 +40,14 @@ set eol "\[ \t\]*\[\n\r\]+" gdb_test "ptype v1" "type = struct a {$eol int x;$eol int y;$eol -}$eol" +}" if {[test_debug_format "stabs"]} { setup_kfail "gdb/1602" *-*-* } gdb_test "ptype v2" "type = struct a {$eol const char .c;$eol -}$eol" +}" if {[test_debug_format "stabs"]} { setup_kfail "gdb/1603" *-*-* |