aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-10-26 11:18:40 +0100
committerAndrew Burgess <aburgess@redhat.com>2024-10-26 11:31:31 +0100
commit2bba46058789196c1c384896933cbc9692ef4933 (patch)
tree3555d740917b5201d566038cc32a6f1b87441630
parent5a43f7f040d45ca1bc0066019131cf71d7836cb8 (diff)
downloadgdb-2bba46058789196c1c384896933cbc9692ef4933.zip
gdb-2bba46058789196c1c384896933cbc9692ef4933.tar.gz
gdb-2bba46058789196c1c384896933cbc9692ef4933.tar.bz2
gdb/testsuite: fix test pattern after switch to -lbl matching
After commit: commit a1ccc78ea7ba8cad3ff37cbde9b5d3bba0194796 Date: Fri Oct 25 06:14:03 2024 +0200 [gdb/testsuite] Fix some test-cases for check-read1 (-lbl) I notice that gdb.base/sect-cmd.exp would sometimes fail. The problem is that by switching to line by line matching we now need to ensure that the gdb_test_multiple patterns match up to the end of the line, but don't actually include the trailing \r\n (yeah, our line by line matching is weird). We need to be especially careful anywhere '.*' is used as this can potentially match content on a subsequent line. I have replaced '.*' with '\[^\r\n\]*(?=\r\n)', matching everything up to the end of the line, but not the end of line itself, and I've made use of '(?=\r\n)' in a couple of other places to ensure we match up to the end of the line, but don't match the line terminator itself.
-rw-r--r--gdb/testsuite/gdb.base/sect-cmd.exp6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp
index 2a5758a..49a94cd 100644
--- a/gdb/testsuite/gdb.base/sect-cmd.exp
+++ b/gdb/testsuite/gdb.base/sect-cmd.exp
@@ -37,7 +37,7 @@ set section_name ""
set ok 0
gdb_test_multiple "info files" "" -lbl {
- -re "\\s+($hex) - ($hex) is (\\\$CODE\\\$|\\.text\\S*) in .*" {
+ -re "\\s+($hex) - ($hex) is (\\\$CODE\\\$|\\.text\\S*) in \[^\r\n\]*(?=\r\n)" {
if { ! $ok } {
set address1 $expect_out(1,string)
set address2 $expect_out(2,string)
@@ -64,11 +64,11 @@ if { $address1 == "" || $address2 == "" || $section_name == "" } {
set saw_section_address_line false
gdb_test_multiple "section $section_name $address1" \
"set section $section_name to original address" -lbl {
- -re ".*$address1 \- $address2 is $section_name in \[^\r\n\]*" {
+ -re "\[^\r\n\]*$address1 \- $address2 is $section_name in \[^\r\n\]*(?=\r\n)" {
set saw_section_address_line true
exp_continue
}
- -re "Section \[^\r\n\]+ not found\r\n" {
+ -re "Section \[^\r\n\]+ not found(?=\r\n)" {
fail "$gdb_test_name (saw not found marker)"
exp_continue
}