* [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach
@ 2022-11-04 15:57 Lancelot SIX
2022-11-04 16:10 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Lancelot SIX @ 2022-11-04 15:57 UTC (permalink / raw)
To: gdb-patches; +Cc: lsix, Lancelot SIX
One test name in gdb.base/dlmopen.exp changes from run to run
since it includes a process id:
PASS: gdb.base/dlmopen.exp: attach 3442682
This is not convenient do diff gdb.sum files to compare test runs.
Fix by using gdb_attach helper function to handle attaching to the
process as it produce a constant test name.
While at it also check gdb_attach's return value to only run the
rest of the test if the attach was successful.
---
gdb/testsuite/gdb.base/dlmopen.exp | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp
index a80db75f9ac..9a2c9d78636 100644
--- a/gdb/testsuite/gdb.base/dlmopen.exp
+++ b/gdb/testsuite/gdb.base/dlmopen.exp
@@ -159,16 +159,16 @@ set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
# Attach.
-gdb_test "attach $testpid" "Attaching to program.*, process $testpid.*"
+if { [gdb_attach $testpid] } {
+ with_test_prefix "attach" {
+ # Remove the pause. We no longer need it.
+ gdb_test "print wait_for_gdb = 0" "\\\$1 = 0"
-with_test_prefix "attach" {
- # Remove the pause. We no longer need it.
- gdb_test "print wait_for_gdb = 0" "\\\$1 = 0"
+ # Set the same breakpoints again. This time, however, we do not allow the
+ # breakpoint to be pending since the library has already been loaded.
+ gdb_breakpoint $srcfile_lib:$bp_inc
+ gdb_breakpoint $srcfile:$bp_main
- # Set the same breakpoints again. This time, however, we do not allow the
- # breakpoint to be pending since the library has already been loaded.
- gdb_breakpoint $srcfile_lib:$bp_inc
- gdb_breakpoint $srcfile:$bp_main
-
- test_dlmopen
+ test_dlmopen
+ }
}
base-commit: b0119424d19afcf80997ad5f3128d7ec68e1fafa
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach
2022-11-04 15:57 [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach Lancelot SIX
@ 2022-11-04 16:10 ` Simon Marchi
2022-11-04 16:13 ` Lancelot SIX
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-11-04 16:10 UTC (permalink / raw)
To: Lancelot SIX, gdb-patches; +Cc: lsix
On 11/4/22 11:57, Lancelot SIX via Gdb-patches wrote:
> One test name in gdb.base/dlmopen.exp changes from run to run
> since it includes a process id:
>
> PASS: gdb.base/dlmopen.exp: attach 3442682
>
> This is not convenient do diff gdb.sum files to compare test runs.
>
> Fix by using gdb_attach helper function to handle attaching to the
> process as it produce a constant test name.
>
> While at it also check gdb_attach's return value to only run the
> rest of the test if the attach was successful.
> ---
> gdb/testsuite/gdb.base/dlmopen.exp | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp
> index a80db75f9ac..9a2c9d78636 100644
> --- a/gdb/testsuite/gdb.base/dlmopen.exp
> +++ b/gdb/testsuite/gdb.base/dlmopen.exp
> @@ -159,16 +159,16 @@ set test_spawn_id [spawn_wait_for_attach $binfile]
> set testpid [spawn_id_get_pid $test_spawn_id]
>
> # Attach.
> -gdb_test "attach $testpid" "Attaching to program.*, process $testpid.*"
> +if { [gdb_attach $testpid] } {
> + with_test_prefix "attach" {
> + # Remove the pause. We no longer need it.
> + gdb_test "print wait_for_gdb = 0" "\\\$1 = 0"
I would prefer doing an early return:
if { ![gdb_attach $testpid] } {
return
}
... just because it keeps the following code at the original column.
But regardless:
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach
2022-11-04 16:10 ` Simon Marchi
@ 2022-11-04 16:13 ` Lancelot SIX
0 siblings, 0 replies; 3+ messages in thread
From: Lancelot SIX @ 2022-11-04 16:13 UTC (permalink / raw)
To: Simon Marchi, gdb-patches; +Cc: lsix
Hi,
Thanks for the review.
>
> I would prefer doing an early return:
>
> if { ![gdb_attach $testpid] } {
> return
> }
>
> ... just because it keeps the following code at the original column.
I'll change this and push the patch shortly.
> But regardless:
>
> Approved-By: Simon Marchi <simon.marchi@efficios.com>
>
> Simon
Best,
Lancelot.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-04 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 15:57 [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach Lancelot SIX
2022-11-04 16:10 ` Simon Marchi
2022-11-04 16:13 ` Lancelot SIX
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).