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.btrace | |
parent | c5a5f322a4e50fbfb303874671ab541757a941cf (diff) | |
download | gdb-e2f620135d92f7cd670af4e524fffec7ac307666.zip gdb-e2f620135d92f7cd670af4e524fffec7ac307666.tar.gz gdb-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.btrace')
-rw-r--r-- | gdb/testsuite/gdb.btrace/buffer-size.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.btrace/function_call_history.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.btrace/instruction_history.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.btrace/record_goto.exp | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/gdb/testsuite/gdb.btrace/buffer-size.exp b/gdb/testsuite/gdb.btrace/buffer-size.exp index e632ba5..616c7f1 100644 --- a/gdb/testsuite/gdb.btrace/buffer-size.exp +++ b/gdb/testsuite/gdb.btrace/buffer-size.exp @@ -30,8 +30,8 @@ if ![runto_main] { gdb_test_no_output "set record btrace bts buffer-size 1" gdb_test_no_output "set record btrace pt buffer-size 1" -gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is 1\.\r" -gdb_test "show record btrace pt buffer-size" "The record/replay pt buffer size is 1\.\r" +gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is 1\." +gdb_test "show record btrace pt buffer-size" "The record/replay pt buffer size is 1\." gdb_test_no_output "record btrace" gdb_test "info record" [multi_line \ diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp index e71e48f..de4cdf9 100644 --- a/gdb/testsuite/gdb.btrace/function_call_history.exp +++ b/gdb/testsuite/gdb.btrace/function_call_history.exp @@ -187,7 +187,7 @@ set expected_range [multi_line \ gdb_test "record function-call-history 4,10" $expected_range gdb_test "record function-call-history 4,+7" $expected_range gdb_test "record function-call-history 10,-7" $expected_range -gdb_test "record function-call-history 4,4" "4\tinc\r" +gdb_test "record function-call-history 4,4" "4\tinc" # set bp after fib recursion and continue set bp_location [gdb_get_line_number "bp.2" $testfile.c] diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp index 35b43d6..f6c1fae 100644 --- a/gdb/testsuite/gdb.btrace/instruction_history.exp +++ b/gdb/testsuite/gdb.btrace/instruction_history.exp @@ -69,7 +69,7 @@ gdb_test "record instruction-history 3,7" [multi_line \ "4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ + "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ ] gdb_test "record instruction-history /f 3,+5" [multi_line \ @@ -77,7 +77,7 @@ gdb_test "record instruction-history /f 3,+5" [multi_line \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ + "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ ] gdb_test "record instruction-history /p 7,-5" [multi_line \ @@ -85,7 +85,7 @@ gdb_test "record instruction-history /p 7,-5" [multi_line \ "4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ + "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ ] gdb_test "record instruction-history /pf 3,7" [multi_line \ @@ -93,10 +93,10 @@ gdb_test "record instruction-history /pf 3,7" [multi_line \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ + "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ ] -gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" +gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" # the following tests are checking the iterators # to avoid lots of regexps, we just check the number of lines that diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index 240e18f..1817ac0 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -149,7 +149,7 @@ gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*" gdb_test "record function-call-history /ci -" [multi_line \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ - "3\t fun1\tinst 5,8\r" \ + "3\t fun1\tinst 5,8" \ ] "function-call-history from 2 backwards" # check that we're filling up the context correctly @@ -173,7 +173,7 @@ gdb_test "record function-call-history /ci" [multi_line \ gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ - "40.*\r" \ + "40.*" \ ] "instruction-history from end forwards" # we should get the exact same history from the second to last instruction @@ -183,12 +183,12 @@ gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*" gdb_test "record function-call-history /ci" [multi_line \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ - "16\t fun4\tinst 39,40\r" \ + "16\t fun4\tinst 39,40" \ ] "function-call-history from 39 forwards" # check that we're filling up the context correctly gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ - "40.*\r" \ + "40.*" \ ] "instruction-history from 39 forwards" |