* [PATCH] Fix gdb.fortran "failed to extract expected results" errors
@ 2022-02-24 17:41 Keith Seitz
2022-02-25 16:40 ` Tom Tromey
0 siblings, 1 reply; 7+ messages in thread
From: Keith Seitz @ 2022-02-24 17:41 UTC (permalink / raw)
To: gdb-patches
When running the gdb.fortran tests array-slices.exp and lbound-ubound.exp,
the test suite throws several ERRORs on native-gdbserver/-m{32,64},
and native-extended-gdbsever/-m{32,64}:
[on native-extended-gdbserver/-m64]
Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/array-slices.exp ...
ERROR: failed to extract expected results
ERROR: failed to extract expected results
Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/lbound-ubound.exp ...
ERROR: failed to extract expected results for lbound
This occurs because the tests require inferior I/O which we do not have
access to while using these targets.
This patch skips these tests when running on non-native targets.
---
gdb/testsuite/gdb.fortran/array-slices.exp | 6 ++++++
gdb/testsuite/gdb.fortran/lbound-ubound.exp | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index 5a909812fe3..8f9c012e399 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -62,6 +62,12 @@ proc run_test { repack } {
return -1
}
+ # This test relies on output from the inferior and is not supported on
+ # remote targets.
+ if {![gdb_is_target_native]} {
+ return 0
+ }
+
# Avoid libc symbols, in particular the 'array' type.
gdb_test_no_output "nosharedlibrary"
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
index 51dd3818499..671b251c799 100644
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -32,6 +32,12 @@ if ![fortran_runto_main] {
return -1
}
+# This test relies on output from the inferior and is not supported on
+# remote targets.
+if {![gdb_is_target_native]} {
+ return 0
+}
+
# Avoid libc symbols, in particular the 'array' type.
gdb_test_no_output "nosharedlibrary"
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix gdb.fortran "failed to extract expected results" errors
2022-02-24 17:41 [PATCH] Fix gdb.fortran "failed to extract expected results" errors Keith Seitz
@ 2022-02-25 16:40 ` Tom Tromey
2022-02-25 16:48 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2022-02-25 16:40 UTC (permalink / raw)
To: Keith Seitz via Gdb-patches
>>>>> "Keith" == Keith Seitz via Gdb-patches <gdb-patches@sourceware.org> writes:
Keith> When running the gdb.fortran tests array-slices.exp and lbound-ubound.exp,
Keith> the test suite throws several ERRORs on native-gdbserver/-m{32,64},
Keith> and native-extended-gdbsever/-m{32,64}:
Keith> [on native-extended-gdbserver/-m64]
Keith> Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/array-slices.exp ...
Keith> ERROR: failed to extract expected results
Keith> ERROR: failed to extract expected results
Keith> Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/lbound-ubound.exp ...
Keith> ERROR: failed to extract expected results for lbound
Keith> This occurs because the tests require inferior I/O which we do not have
Keith> access to while using these targets.
Keith> This patch skips these tests when running on non-native targets.
Looks good to me.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix gdb.fortran "failed to extract expected results" errors
2022-02-25 16:40 ` Tom Tromey
@ 2022-02-25 16:48 ` Simon Marchi
2022-02-28 15:35 ` Keith Seitz
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2022-02-25 16:48 UTC (permalink / raw)
To: Tom Tromey, Keith Seitz via Gdb-patches
On 2022-02-25 11:40, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Keith> When running the gdb.fortran tests array-slices.exp and lbound-ubound.exp,
> Keith> the test suite throws several ERRORs on native-gdbserver/-m{32,64},
> Keith> and native-extended-gdbsever/-m{32,64}:
>
> Keith> [on native-extended-gdbserver/-m64]
> Keith> Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/array-slices.exp ...
> Keith> ERROR: failed to extract expected results
> Keith> ERROR: failed to extract expected results
> Keith> Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/lbound-ubound.exp ...
> Keith> ERROR: failed to extract expected results for lbound
>
> Keith> This occurs because the tests require inferior I/O which we do not have
> Keith> access to while using these targets.
>
> Keith> This patch skips these tests when running on non-native targets.
>
> Looks good to me.
>
> Tom
An alternative would be to change those tests to not rely on inferior IO.
They could perhaps save the expected outcome to a string, which GDB would
read, rather than printing it to stdout.
But, that takes some time, and most importantly, someone who knows
Fortran :). So I also think your patch is ok.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix gdb.fortran "failed to extract expected results" errors
2022-02-25 16:48 ` Simon Marchi
@ 2022-02-28 15:35 ` Keith Seitz
2022-03-03 20:02 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Keith Seitz @ 2022-02-28 15:35 UTC (permalink / raw)
To: Keith Seitz via Gdb-patches
On 2/25/22 08:48, Simon Marchi via Gdb-patches wrote:
>
>
> On 2022-02-25 11:40, Tom Tromey wrote:
>>>>>>> "Keith" == Keith Seitz via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>>
>> Keith> This patch skips these tests when running on non-native targets.
>>
>> Looks good to me.
>
> An alternative would be to change those tests to not rely on inferior IO.
>
> They could perhaps save the expected outcome to a string, which GDB would
> read, rather than printing it to stdout.
>
> But, that takes some time, and most importantly, someone who knows
> Fortran :). So I also think your patch is ok.
Oh, you got me! :-)
That's a good point, though. I will see if I can update this test, but in the
meantime, I've pushed this change. All these errors are interfering with our
Fedora CI efforts.
Thank you, Tom and Simon!
Keith
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix gdb.fortran "failed to extract expected results" errors
2022-02-28 15:35 ` Keith Seitz
@ 2022-03-03 20:02 ` Pedro Alves
2022-03-07 14:27 ` [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2022-03-03 20:02 UTC (permalink / raw)
To: Keith Seitz, Keith Seitz via Gdb-patches
On 2022-02-28 15:35, Keith Seitz via Gdb-patches wrote:
> On 2/25/22 08:48, Simon Marchi via Gdb-patches wrote:
>>
>>
>> On 2022-02-25 11:40, Tom Tromey wrote:
>>>>>>>> "Keith" == Keith Seitz via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
>>>
>>> Keith> This patch skips these tests when running on non-native targets.
>>>
>>> Looks good to me.
>>
>> An alternative would be to change those tests to not rely on inferior IO.
>>
>> They could perhaps save the expected outcome to a string, which GDB would
>> read, rather than printing it to stdout.
>>
>> But, that takes some time, and most importantly, someone who knows
>> Fortran :). So I also think your patch is ok.
>
> Oh, you got me! :-)
>
> That's a good point, though. I will see if I can update this test, but in the
> meantime, I've pushed this change. All these errors are interfering with our
> Fedora CI efforts.
>
> Thank you, Tom and Simon!
Well, the change is incorrect, because when testing with gdbserver we do have
inferior output. :-P
We're not supposed to check whether the target is native.
Instead, we're supposed to use gdb_test_stdio & gdb_skip_stdio_test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver
2022-03-03 20:02 ` Pedro Alves
@ 2022-03-07 14:27 ` Pedro Alves
2022-03-09 17:21 ` Tom Tromey
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2022-03-07 14:27 UTC (permalink / raw)
To: Keith Seitz, Keith Seitz via Gdb-patches
On 2022-03-03 20:02, Pedro Alves wrote:
> Well, the change is incorrect, because when testing with gdbserver we do have
> inferior output. :-P
>
> We're not supposed to check whether the target is native.
>
> Instead, we're supposed to use gdb_test_stdio & gdb_skip_stdio_test.
Keith mentioned he might be away this week, so I went ahead and played with this. We
can't use gdb_test_stdio here, because that maps to gdb_test, and we want gdb_test_multiple
instead. So we use inferior_spawn_id with gdb_test_multiple instead.
It took me some head scratching and staring at logs to figure out why the patch
wasn't working -- I was hitting a buglet in gdb.fortran/array-slices.f90, argh.
With that out of the way, both testcases now pass cleanly with gdbserver too.
Here's the proposed patch. Any comments?
From cb3fadb145a5ac6a2ddd5714ec17374ef5254cba Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Fri, 4 Mar 2022 17:34:18 +0000
Subject: [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against
gdbserver
gdb.fortran/array-slices.exp and gdb.fortran/lbound-ubound.exp were
recently disabled unless testing with the native target, because they
rely on inferior I/O. However, when testing against gdbserver using
the native-gdbserver/native-extended-gdbserver boards, we do have
access to inferior I/O.
The right way to check whether the board can do I/O, is via checking
the gdb,noinferiorio board variable. Switch to using that.
And then, tweak the testcases to expect output to appear in
inferior_spawn_id, instead of gdb_spawn_id. When testing against the
native target, inferior_spawn_id is the same as gdb_spawn_id. When
testing against gdbserver, it maps to gdbserver_spawn_id.
This exposed a buglet in gdb.fortran/array-slices.f90's show_1d
subroutine -- it was missing printing newline at the end of the
"Expected GDB Output" text, leading to a test timeout. All other
subroutines end with advance=yes, except this one. Fix it by using
advance=yes here too.
Change-Id: I4640729f334431cfc24b0917e7d3977b677c6ca5
---
gdb/testsuite/gdb.fortran/array-slices.exp | 30 +++++++++++++++------
gdb/testsuite/gdb.fortran/array-slices.f90 | 2 +-
gdb/testsuite/gdb.fortran/lbound-ubound.exp | 28 ++++++++++++++-----
3 files changed, 45 insertions(+), 15 deletions(-)
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index 8f9c012e399..a38276c67e4 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -35,6 +35,11 @@
if {[skip_fortran_tests]} { return -1 }
+# This test relies on output from the inferior.
+if [target_info exists gdb,noinferiorio] {
+ return -1
+}
+
standard_testfile ".f90"
load_lib fortran.exp
@@ -62,12 +67,6 @@ proc run_test { repack } {
return -1
}
- # This test relies on output from the inferior and is not supported on
- # remote targets.
- if {![gdb_is_target_native]} {
- return 0
- }
-
# Avoid libc symbols, in particular the 'array' type.
gdb_test_no_output "nosharedlibrary"
@@ -97,11 +96,19 @@ proc run_test { repack } {
set found_final_breakpoint false
set expected_result ""
set func_name ""
+ set found_prompt false
gdb_test_multiple "continue" "continue" {
+ -i $::inferior_spawn_id
+
-re ".*GDB = (\[^\r\n\]+)\r\n" {
set expected_result $expect_out(1,string)
- exp_continue
+ if {!$found_prompt} {
+ exp_continue
+ }
}
+
+ -i $::gdb_spawn_id
+
-re "! Display Element" {
set func_name "show_elem"
exp_continue
@@ -119,7 +126,14 @@ proc run_test { repack } {
exp_continue
}
-re "$gdb_prompt $" {
- # We're done.
+ set found_prompt true
+
+ if {$found_final_breakpoint
+ || ($expected_result != "" && $func_name != "")} {
+ # We're done.
+ } else {
+ exp_continue
+ }
}
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices.f90
index ff3964ffb6b..1eaee82b7b7 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.f90
+++ b/gdb/testsuite/gdb.fortran/array-slices.f90
@@ -61,7 +61,7 @@ subroutine show_1d (array)
end if
write(*, fmt="(I0)", advance="no") array (i)
end do
- write(*, fmt="(A)", advance="no") ")"
+ write(*, fmt="(A)", advance="yes") ")"
print *, "" ! Display Array Slice 1D
end subroutine show_1d
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
index 671b251c799..709b74a69e8 100644
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -32,9 +32,8 @@ if ![fortran_runto_main] {
return -1
}
-# This test relies on output from the inferior and is not supported on
-# remote targets.
-if {![gdb_is_target_native]} {
+# This test relies on output from the inferior.
+if [target_info exists gdb,noinferiorio] {
return 0
}
@@ -55,15 +54,25 @@ while { $test_count < 500 } {
set expected_lbound ""
set expected_ubound ""
+ set found_prompt false
gdb_test_multiple "continue" "continue" {
+ -i $::inferior_spawn_id
+
-re ".*LBOUND = (\[^\r\n\]+)\r\n" {
set expected_lbound $expect_out(1,string)
- exp_continue
+ if {!$found_prompt} {
+ exp_continue
+ }
}
-re ".*UBOUND = (\[^\r\n\]+)\r\n" {
set expected_ubound $expect_out(1,string)
- exp_continue
+ if {!$found_prompt} {
+ exp_continue
+ }
}
+
+ -i $::gdb_spawn_id
+
-re "! Test Breakpoint" {
set func_name "show_elem"
exp_continue
@@ -73,7 +82,14 @@ while { $test_count < 500 } {
exp_continue
}
-re "$gdb_prompt $" {
- # We're done.
+ set found_prompt true
+
+ if {$found_final_breakpoint
+ || ($expected_lbound != "" && $expected_ubound != "")} {
+ # We're done.
+ } else {
+ exp_continue
+ }
}
}
base-commit: 0daa5af85a9b5548a1bd7e8085a326162b41fd6f
--
2.26.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver
2022-03-07 14:27 ` [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver Pedro Alves
@ 2022-03-09 17:21 ` Tom Tromey
0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2022-03-09 17:21 UTC (permalink / raw)
To: Pedro Alves; +Cc: Keith Seitz, Keith Seitz via Gdb-patches
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
Pedro> Keith mentioned he might be away this week, so I went ahead and played with this. We
Pedro> can't use gdb_test_stdio here, because that maps to gdb_test, and we want gdb_test_multiple
Pedro> instead. So we use inferior_spawn_id with gdb_test_multiple instead.
Thanks.
Pedro> It took me some head scratching and staring at logs to figure out why the patch
Pedro> wasn't working -- I was hitting a buglet in gdb.fortran/array-slices.f90, argh.
Pedro> With that out of the way, both testcases now pass cleanly with gdbserver too.
Pedro> Here's the proposed patch. Any comments?
It looks fine to me.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-03-09 17:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 17:41 [PATCH] Fix gdb.fortran "failed to extract expected results" errors Keith Seitz
2022-02-25 16:40 ` Tom Tromey
2022-02-25 16:48 ` Simon Marchi
2022-02-28 15:35 ` Keith Seitz
2022-03-03 20:02 ` Pedro Alves
2022-03-07 14:27 ` [PATCH] Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver Pedro Alves
2022-03-09 17:21 ` Tom Tromey
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).