Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix testing gdb.rust/modules.exp against gdbserver
@ 2017-11-16 17:23 Pedro Alves
  2017-11-16 17:51 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2017-11-16 17:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Currently several testsin gdb.rust/modules.exp fail with
 --target_board=native-gdbserver:

 Running src/gdb/testsuite/gdb.rust/modules.exp ...
 FAIL: gdb.rust/modules.exp: call f3()
 FAIL: gdb.rust/modules.exp: call self::f2()
 FAIL: gdb.rust/modules.exp: call self::super::f2()
 FAIL: gdb.rust/modules.exp: call super::f2()
 FAIL: gdb.rust/modules.exp: call self::super::super::f2()
 FAIL: gdb.rust/modules.exp: call super::super::f2()
 FAIL: gdb.rust/modules.exp: call ::f2()
 FAIL: gdb.rust/modules.exp: call extern modules::mod1::f2()

This is because these tests rely on matching inferior output.
However, when testing with gdbserver, inferior output goes to a
separate terminal instead of to gdb's terminal, and so gdb_test won't
cut it, as that is only reading from gdb's pty/gdb_spawn_id:

 (gdb) call f3()
 (gdb) FAIL: gdb.rust/modules.exp: call f3()
 call self::f2()
 (gdb) FAIL: gdb.rust/modules.exp: call self::f2()

Fix this by using gdb_test_stdio instead, which handles output coming
out of gdbserver's pty.

Also, skip the tests if the target/board doesn't support inferior I/O
at all.

gdb/ChangeLog:
2017-11-16  Pedro Alves  <palves@redhat.com>

	* gdb.rust/modules.exp: Skip tests that rely on inferior I/O if
	gdb,noinferiorio is set, and use gdb_test_stdio otherwise.
---
 gdb/testsuite/gdb.rust/modules.exp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.rust/modules.exp b/gdb/testsuite/gdb.rust/modules.exp
index a2a5804..eda981d 100644
--- a/gdb/testsuite/gdb.rust/modules.exp
+++ b/gdb/testsuite/gdb.rust/modules.exp
@@ -35,16 +35,18 @@ if {![runto ${srcfile}:$line]} {
 # https://github.com/rust-lang/rust/issues/33121
 # gdb_test "call f2()" "lambda f2"
 
-gdb_test "call f3()" "mod1::inner::innest::f3"
-gdb_test "call self::f2()" "mod1::inner::innest::f2"
-gdb_test "call self::super::f2()" "mod1::inner::f2"
-gdb_test "call super::f2()" "mod1::inner::f2"
-gdb_test "call self::super::super::f2()" "mod1::f2"
-gdb_test "call super::super::f2()" "mod1::f2"
-gdb_test "call ::f2()" "::f2"
+if ![target_info exists gdb,noinferiorio] {
+    gdb_test_stdio "call f3()" "mod1::inner::innest::f3"
+    gdb_test_stdio "call self::f2()" "mod1::inner::innest::f2"
+    gdb_test_stdio "call self::super::f2()" "mod1::inner::f2"
+    gdb_test_stdio "call super::f2()" "mod1::inner::f2"
+    gdb_test_stdio "call self::super::super::f2()" "mod1::f2"
+    gdb_test_stdio "call super::super::f2()" "mod1::f2"
+    gdb_test_stdio "call ::f2()" "::f2"
+    gdb_test_stdio "call extern modules::mod1::f2()" "mod1::f2"
+}
 gdb_test "call super::super::super::f2()" \
     "Too many super:: uses from 'modules::mod1::inner::innest'"
-gdb_test "call extern modules::mod1::f2()" "mod1::f2"
 
 gdb_test_sequence "ptype ::Generic::<::Generic<::Type> >" "" {
     "type = struct modules::Generic<modules::Generic<modules::Type>> \\("
-- 
2.5.5


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

* Re: [PATCH] Fix testing gdb.rust/modules.exp against gdbserver
  2017-11-16 17:23 [PATCH] Fix testing gdb.rust/modules.exp against gdbserver Pedro Alves
@ 2017-11-16 17:51 ` Tom Tromey
  2017-11-16 18:09   ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2017-11-16 17:51 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, Tom Tromey

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> gdb/ChangeLog:
Pedro> 2017-11-16  Pedro Alves  <palves@redhat.com>
Pedro> 	* gdb.rust/modules.exp: Skip tests that rely on inferior I/O if
Pedro> 	gdb,noinferiorio is set, and use gdb_test_stdio otherwise.

Thanks, this looks reasonable to me.

Tom


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

* Re: [PATCH] Fix testing gdb.rust/modules.exp against gdbserver
  2017-11-16 17:51 ` Tom Tromey
@ 2017-11-16 18:09   ` Pedro Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2017-11-16 18:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/16/2017 05:51 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> gdb/ChangeLog:
> Pedro> 2017-11-16  Pedro Alves  <palves@redhat.com>
> Pedro> 	* gdb.rust/modules.exp: Skip tests that rely on inferior I/O if
> Pedro> 	gdb,noinferiorio is set, and use gdb_test_stdio otherwise.
> 
> Thanks, this looks reasonable to me.

Great, pushed.

Thanks,
Pedro Alves


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

end of thread, other threads:[~2017-11-16 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16 17:23 [PATCH] Fix testing gdb.rust/modules.exp against gdbserver Pedro Alves
2017-11-16 17:51 ` Tom Tromey
2017-11-16 18:09   ` Pedro Alves

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