public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: relax filename restriction in some gdb.btrace tests
@ 2023-12-14 10:19 Guinevere Larsen
  2023-12-14 10:37 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Guinevere Larsen @ 2023-12-14 10:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

The test gdb.btrace/tailcall.exp has multiple tests that include the
filename in the output. When testing with gcc, only a relative path is
printed, but when using clang, the full file path is printed instead.
This makes most of those tests fail, with the exception of "record goto
4" which allows for more characters before the file name. The test
gdb.btrace/recod_goto.exp suffers with the same issue

This commit changes all relevant tests in both files to work like that,
so that the test stops failing with clang.
---
 gdb/testsuite/gdb.btrace/record_goto.exp | 22 ++++++++---------
 gdb/testsuite/gdb.btrace/tailcall.exp    | 30 ++++++++++++------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp
index 1817ac07f51..f7d4f5ba612 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.exp
+++ b/gdb/testsuite/gdb.btrace/record_goto.exp
@@ -80,7 +80,7 @@ gdb_test "record function-call-history /ci 1, +20" [multi_line \
   ]
 
 # let's see if we can go back in history
-gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*"
+gdb_test "record goto 19" ".*fun4 \\(\\) at .*record_goto.c:43.*"
 
 # the function call history should start at the new location
 gdb_test "record function-call-history /ci" [multi_line \
@@ -97,19 +97,19 @@ gdb_test "record instruction-history" [multi_line \
   ] "instruction-history from 19 forwards"
 
 # let's go to another place in the history
-gdb_test "record goto 27" ".*fun3 \\(\\) at record_goto.c:35.*"
+gdb_test "record goto 27" ".*fun3 \\(\\) at .*record_goto.c:35.*"
 
 # check the back trace at that location
 gdb_test "backtrace" [multi_line \
-  "#0.*fun3.*at record_goto.c:35.*" \
-  "#1.*fun4.*at record_goto.c:43.*" \
-  "#2.*main.*at record_goto.c:49.*" \
+  "#0.*fun3.*at .*record_goto.c:35.*" \
+  "#1.*fun4.*at .*record_goto.c:43.*" \
+  "#2.*main.*at .*record_goto.c:49.*" \
   "Backtrace stopped: not enough registers or memory available to unwind further" \
   ]
 
 # walk the backtrace
-gdb_test "up" ".*fun4.*at record_goto.c:43.*" "up to fun4"
-gdb_test "up" ".*main.*at record_goto.c:49.*" "up to main"
+gdb_test "up" ".*fun4.*at .*record_goto.c:43.*" "up to fun4"
+gdb_test "up" ".*main.*at .*record_goto.c:49.*" "up to main"
 
 # the function call history should start at the new location
 gdb_test "record function-call-history /ci -" [multi_line \
@@ -126,7 +126,7 @@ gdb_test "record instruction-history -" [multi_line \
   ] "instruction-history from 27 backwards"
 
 # test that we can go to the begin of the trace
-gdb_test "record goto begin" ".*main \\(\\) at record_goto.c:49.*"
+gdb_test "record goto begin" ".*main \\(\\) at .*record_goto.c:49.*"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci -" [multi_line \
@@ -143,7 +143,7 @@ gdb_test "record instruction-history -" [multi_line \
   ] "instruction-history from begin backwards"
 
 # we should get the exact same history from the first instruction
-gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*"
+gdb_test "record goto 2" ".*fun4 \\(\\) at .*record_goto.c:40.*"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci -" [multi_line \
@@ -160,7 +160,7 @@ gdb_test "record instruction-history -" [multi_line \
   ] "instruction-history from 2 backwards"
 
 # check that we can go to the end of the trace
-gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*"
+gdb_test "record goto end" ".*main \\(\\) at .*record_goto.c:50.*"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci" [multi_line \
@@ -177,7 +177,7 @@ gdb_test "record instruction-history" [multi_line \
   ] "instruction-history from end forwards"
 
 # we should get the exact same history from the second to last instruction
-gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*"
+gdb_test "record goto 39" ".*fun4 \\(\\) at .*record_goto.c:44.*"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci" [multi_line \
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index 7fbcd40c077..b2548b9ba11 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -77,35 +77,35 @@ gdb_test "record goto 4" ".*bar \\(\\) at .*tailcall.c:24\r\n.*"
 
 # check the backtrace
 gdb_test "backtrace" [multi_line \
-  "#0.*bar \\(\\) at tailcall.c:24" \
-  "#1.*foo \\(\\) at tailcall.c:29" \
-  "#2.*main \\(\\) at tailcall.c:37" \
+  "#0.*bar \\(\\) at .*tailcall.c:24" \
+  "#1.*foo \\(\\) at .*tailcall.c:29" \
+  "#2.*main \\(\\) at .*tailcall.c:37" \
   "Backtrace stopped: not enough registers or memory available to unwind further" \
   ]
 
 # walk the backtrace
-gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "up to foo"
-gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main"
-gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo"
+gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at .*tailcall.c:29\r\n.*" "up to foo"
+gdb_test "up" "#2\[^\r\n\]*main \\(\\) at .*tailcall.c:37\r\n.*" "up to main"
+gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at .*tailcall.c:29\r\n.*" "down to foo"
 
 # test stepping into and out of tailcalls.
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at .*tailcall.c:38\r\n.*" \
     "finish.1"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at .*tailcall.c:24\r\n.*" \
     "reverse-step.1"
-gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
+gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at .*tailcall.c:29\r\n.*" \
     "reverse-finish.1"
-gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at .*tailcall.c:37\r\n.*" \
     "reverse-step.2"
 gdb_test "next" "\[^\r\n\]*38.*" \
     "next.1"
-gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
+gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at .*tailcall.c:37\r\n.*" \
     "reverse-next.1"
-gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
+gdb_test "step" "\[^\r\n\]*foo \\(\\) at .*tailcall.c:29\r\n.*" \
     "step.1"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at .*tailcall.c:38\r\n.*" \
     "finish.2"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at .*tailcall.c:24\r\n.*" \
     "reverse-step.3"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at .*tailcall.c:38\r\n.*" \
     "finish.3"
-- 
2.42.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/testsuite: relax filename restriction in some gdb.btrace tests
  2023-12-14 10:19 [PATCH] gdb/testsuite: relax filename restriction in some gdb.btrace tests Guinevere Larsen
@ 2023-12-14 10:37 ` Andreas Schwab
  2023-12-14 10:49   ` Guinevere Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2023-12-14 10:37 UTC (permalink / raw)
  To: Guinevere Larsen; +Cc: gdb-patches

On Dez 14 2023, Guinevere Larsen wrote:

>  # let's see if we can go back in history
> -gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*"
> +gdb_test "record goto 19" ".*fun4 \\(\\) at .*record_goto.c:43.*"

That would allow to extend the match across multiple lines, since "."
can match a newline.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/testsuite: relax filename restriction in some gdb.btrace tests
  2023-12-14 10:37 ` Andreas Schwab
@ 2023-12-14 10:49   ` Guinevere Larsen
  0 siblings, 0 replies; 3+ messages in thread
From: Guinevere Larsen @ 2023-12-14 10:49 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

On 14/12/2023 11:37, Andreas Schwab wrote:
> On Dez 14 2023, Guinevere Larsen wrote:
>
>>   # let's see if we can go back in history
>> -gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*"
>> +gdb_test "record goto 19" ".*fun4 \\(\\) at .*record_goto.c:43.*"
> That would allow to extend the match across multiple lines, since "."
> can match a newline.
>
You're right, but since there was already one test like that (in 
gdb.btrace/tailcall.exp:76) I figured it was alright.

If you prefer, I can make a tighter regexp anyway, and 'fix' that one.

-- 
Cheers,
Guinevere Larsen
She/Her/Hers


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-14 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 10:19 [PATCH] gdb/testsuite: relax filename restriction in some gdb.btrace tests Guinevere Larsen
2023-12-14 10:37 ` Andreas Schwab
2023-12-14 10:49   ` Guinevere Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).