Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix scopes check in gdb.dap/rust-slices.exp
@ 2024-07-18 12:41 Tom de Vries
  2024-07-21  0:30 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-07-18 12:41 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.dap/rust-slices.exp on aarch64-linux
(debian 12/bookworm), I run into:
...
{"request_seq": 6, "type": "response", "command": "scopes", "body": {"scopes": [{"variablesReference": 1, "name": "Locals", "presentationHint": "locals", "expensive": false, "namedVariables": 3, "line": 28, "source": {"name": "rust-slices.rs", "path": "/home/linux/gdb/binutils-gdb.git/gdb/testsuite/gdb.dap/rust-slices.rs"}}, {"variablesReference": 2, "name": "Registers", "presentationHint": "registers", "expensive": false, "namedVariables": 261, "line": 28, "source": {"name": "rust-slices.rs", "path": "/home/linux/gdb/binutils-gdb.git/gdb/testsuite/gdb.dap/rust-slices.rs"}}]}, "success": true, "seq": 20}PASS: gdb.dap/rust-slices.exp: get scopes success
FAIL: gdb.dap/rust-slices.exp: three scopes
PASS: gdb.dap/rust-slices.exp: scope is locals
PASS: gdb.dap/rust-slices.exp: locals presentation hint
PASS: gdb.dap/rust-slices.exp: three vars in scope
...

The test-case expects three scopes due to a rust compiler issue:
...
 # There are three scopes because an artificial symbol ends up in the
 # DWARF.  See https://github.com/rust-lang/rust/issues/125126.
 gdb_assert {[llength $scopes] == 3} "three scopes"
...
but it seems that the version used here (rustc 1.63.0, llvm 14.0.6) doesn't
have this issue.

Fix this by allowing two or three scopes, and changing the test name to
"two scopes".

Tested on aarch64-linux.

PR testsuite/31983
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31983
---
 gdb/testsuite/gdb.dap/rust-slices.exp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.dap/rust-slices.exp b/gdb/testsuite/gdb.dap/rust-slices.exp
index d3bd3050c16..4af8c11e684 100644
--- a/gdb/testsuite/gdb.dap/rust-slices.exp
+++ b/gdb/testsuite/gdb.dap/rust-slices.exp
@@ -59,9 +59,9 @@ set scopes [dap_check_request_and_response "get scopes" scopes \
 		[format {o frameId [i %d]} $frame_id]]
 set scopes [dict get [lindex $scopes 0] body scopes]
 
-# There are three scopes because an artificial symbol ends up in the
-# DWARF.  See https://github.com/rust-lang/rust/issues/125126.
-gdb_assert {[llength $scopes] == 3} "three scopes"
+# There may be three scopes instead of two if an artificial symbol ends up in
+# the DWARF.  See https://github.com/rust-lang/rust/issues/125126.
+gdb_assert { [llength $scopes] == 2 || [llength $scopes] == 3 } "two scopes"
 
 lassign $scopes scope ignore
 gdb_assert {[dict get $scope name] == "Locals"} "scope is locals"

base-commit: 3ca6c047a42ecf444cf08ce879ba52e5ba0a9e06
-- 
2.35.3


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

* Re: [PATCH] [gdb/testsuite] Fix scopes check in gdb.dap/rust-slices.exp
  2024-07-18 12:41 [PATCH] [gdb/testsuite] Fix scopes check in gdb.dap/rust-slices.exp Tom de Vries
@ 2024-07-21  0:30 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2024-07-21  0:30 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

On Thu, 18 Jul 2024 14:41:32 +0200
Tom de Vries <tdevries@suse.de> wrote:

> When running test-case gdb.dap/rust-slices.exp on aarch64-linux
> (debian 12/bookworm), I run into:
> ...
> {"request_seq": 6, "type": "response", "command": "scopes", "body": {"scopes": [{"variablesReference": 1, "name": "Locals", "presentationHint": "locals", "expensive": false, "namedVariables": 3, "line": 28, "source": {"name": "rust-slices.rs", "path": "/home/linux/gdb/binutils-gdb.git/gdb/testsuite/gdb.dap/rust-slices.rs"}}, {"variablesReference": 2, "name": "Registers", "presentationHint": "registers", "expensive": false, "namedVariables": 261, "line": 28, "source": {"name": "rust-slices.rs", "path": "/home/linux/gdb/binutils-gdb.git/gdb/testsuite/gdb.dap/rust-slices.rs"}}]}, "success": true, "seq": 20}PASS: gdb.dap/rust-slices.exp: get scopes success
> FAIL: gdb.dap/rust-slices.exp: three scopes
> PASS: gdb.dap/rust-slices.exp: scope is locals
> PASS: gdb.dap/rust-slices.exp: locals presentation hint
> PASS: gdb.dap/rust-slices.exp: three vars in scope
> ...
> 
> The test-case expects three scopes due to a rust compiler issue:
> ...
>  # There are three scopes because an artificial symbol ends up in the
>  # DWARF.  See https://github.com/rust-lang/rust/issues/125126.
>  gdb_assert {[llength $scopes] == 3} "three scopes"
> ...
> but it seems that the version used here (rustc 1.63.0, llvm 14.0.6) doesn't
> have this issue.
> 
> Fix this by allowing two or three scopes, and changing the test name to
> "two scopes".
> 
> Tested on aarch64-linux.
> 
> PR testsuite/31983
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31983

LGTM.

Approved-by: Kevin Buettner <kevinb@redhat.com>


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

end of thread, other threads:[~2024-07-21  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 12:41 [PATCH] [gdb/testsuite] Fix scopes check in gdb.dap/rust-slices.exp Tom de Vries
2024-07-21  0:30 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox