[v2] Minor cleanups in ada-nested.exp
Checks
Commit Message
This changes ada-nested.exp to fix a test name (the test expects three
variables but is named "two"), and to iterate over all the variables
that are found. It also adds a workaround to a problem Tom de Vries
found with an older version of GNAT -- it emits a duplicate "x".
---
gdb/testsuite/gdb.dap/ada-nested.exp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Comments
On 11/15/23 16:01, Tom Tromey wrote:
> This changes ada-nested.exp to fix a test name (the test expects three
> variables but is named "two"), and to iterate over all the variables
> that are found. It also adds a workaround to a problem Tom de Vries
> found with an older version of GNAT -- it emits a duplicate "x".
I applied the patch and get a DUPLICATE message:
...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dap/ada-nested.exp ...
DUPLICATE: gdb.dap/ada-nested.exp: check value of x
=== gdb Summary ===
# of expected passes 17
# of duplicate test names 1
...
Otherwise LGTM.
Thanks,
- Tom
> ---
> gdb/testsuite/gdb.dap/ada-nested.exp | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.dap/ada-nested.exp b/gdb/testsuite/gdb.dap/ada-nested.exp
> index 1a02f4f352e..1f425a73667 100644
> --- a/gdb/testsuite/gdb.dap/ada-nested.exp
> +++ b/gdb/testsuite/gdb.dap/ada-nested.exp
> @@ -60,13 +60,15 @@ lassign $scopes args locals _ignore
> gdb_assert {[dict get $args name] == "Arguments"} "argument scope"
> gdb_assert {[dict get $locals name] == "Locals"} "local scope"
>
> -gdb_assert {[dict get $locals namedVariables] == 3} "two locals"
> +set num_vars [dict get $locals namedVariables]
> +# Some versions of GNAT emit an extra 'x' in scope.
> +gdb_assert {$num_vars == 3 || $num_vars == 4} "correct number of locals"
>
> set num [dict get $locals variablesReference]
> set refs [lindex [dap_check_request_and_response "fetch variables" \
> "variables" \
> - [format {o variablesReference [i %d] count [i 3]} \
> - $num]] \
> + [format {o variablesReference [i %d] count [i %d]} \
> + $num $num_vars]] \
> 0]
>
> foreach var [dict get $refs body variables] {
> @@ -76,7 +78,9 @@ foreach var [dict get $refs body variables] {
> "i" {
> gdb_assert {[dict get $var value] == "1"} "check value of i"
> }
> - "x" {
> + "x" - "x #2" {
> + # Some versions of GNAT erroneously emit a duplicate 'x'.
> + # Work around it here.
> gdb_assert {[dict get $var value] == "12"} "check value of x"
> }
> "outer_arg" {
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> I applied the patch and get a DUPLICATE message:
Tom> ...
Tom> Running /data/vries/gdb/src/gdb/testsuite/gdb.dap/ada-nested.exp ...
Tom> DUPLICATE: gdb.dap/ada-nested.exp: check value of x
Oops, sorry about that.
I've fixed that & now I'm going to push this.
Will backport as well.
Tom
@@ -60,13 +60,15 @@ lassign $scopes args locals _ignore
gdb_assert {[dict get $args name] == "Arguments"} "argument scope"
gdb_assert {[dict get $locals name] == "Locals"} "local scope"
-gdb_assert {[dict get $locals namedVariables] == 3} "two locals"
+set num_vars [dict get $locals namedVariables]
+# Some versions of GNAT emit an extra 'x' in scope.
+gdb_assert {$num_vars == 3 || $num_vars == 4} "correct number of locals"
set num [dict get $locals variablesReference]
set refs [lindex [dap_check_request_and_response "fetch variables" \
"variables" \
- [format {o variablesReference [i %d] count [i 3]} \
- $num]] \
+ [format {o variablesReference [i %d] count [i %d]} \
+ $num $num_vars]] \
0]
foreach var [dict get $refs body variables] {
@@ -76,7 +78,9 @@ foreach var [dict get $refs body variables] {
"i" {
gdb_assert {[dict get $var value] == "1"} "check value of i"
}
- "x" {
+ "x" - "x #2" {
+ # Some versions of GNAT erroneously emit a duplicate 'x'.
+ # Work around it here.
gdb_assert {[dict get $var value] == "12"} "check value of x"
}
"outer_arg" {