Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Fix spawn in tuiterm.exp
@ 2020-02-27  9:17 Tom de Vries
  2020-02-27 16:49 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2020-02-27  9:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Hi,

When running gdb.stabs/weird.exp by itself it passes, but if we run a gdb.tui
test before it, we get:
...
$ make check RUNTESTFLAGS="gdb.stabs/weird.exp gdb.tui/basic.exp"
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.tui/basic.exp ...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.stabs/weird.exp ...
ERROR: Couldn't make test case. -1 {spawn failed}
...

In more detail, using -v:
...
Executing on build: sed  -f aout.sed weird.def weird.s (timeout = 300)
builtin_spawn [open ...]^M
pid is 19060 19061 -19060 -19061
spawn -open file10 failed, 1 can't read "spawn_out(slave,name)": \
  no such variable, can't read "spawn_out(slave,name)": no such variable
    while executing
"set gdb_spawn_name $spawn_out(slave,name)"
    (procedure "spawn" line 5)
    invoked from within
"spawn -ignore SIGHUP -leaveopen file10"
    invoked from within
"catch "spawn -ignore SIGHUP -leaveopen $id" result2"
ERROR: Couldn't make test case. -1 {spawn failed}
...

When running the gdb.tui test, spawn gets renamed to a local version from
lib/tuiterm.exp.  The local version calls expect's spawn, and then makes the
local spawn_out(slave,name) variable accessible in the global variable
gdb_spawn_name.

However, the weird.exp test-case uses remote_exec build, which ends up using
local_exec, which given that there's input/output redirection uses open:
...
    set result [catch {open "| ${commandline} $inp |& tee $outpf" RDONLY} id]
...
followed by spawn using the -leaveopen option:
...
    set result [catch "spawn -ignore SIGHUP -leaveopen $id" result2]
...
which apparently has the effect that spawn_out(slave,name) is not set.

Fix this in the lib/tuiterm.exp local spawn proc by detecting the case that
spawn_out(slave,name) is not set, and handling it accordingly.

Tested gdb.stabs/weird.exp and gdb.tui/*.exp on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix spawn in tuiterm.exp

gdb/testsuite/ChangeLog:

2020-02-27  Tom de Vries  <tdevries@suse.de>

	* lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is
	not set.

---
 gdb/testsuite/lib/tuiterm.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index da5580324a..7505821a85 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -24,7 +24,11 @@ proc spawn {args} {
     set result [uplevel builtin_spawn $args]
     global gdb_spawn_name
     upvar spawn_out spawn_out
-    set gdb_spawn_name $spawn_out(slave,name)
+    if { [info exists spawn_out] } {
+	set gdb_spawn_name $spawn_out(slave,name)
+    } else {
+	unset gdb_spawn_name
+    }
     return $result
 }
 


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

* Re: [committed][gdb/testsuite] Fix spawn in tuiterm.exp
  2020-02-27  9:17 [committed][gdb/testsuite] Fix spawn in tuiterm.exp Tom de Vries
@ 2020-02-27 16:49 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2020-02-27 16:49 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Tom Tromey

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> 2020-02-27  Tom de Vries  <tdevries@suse.de>

Tom> 	* lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is
Tom> 	not set.

Thank you for doing this.

Tom


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

end of thread, other threads:[~2020-02-27 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27  9:17 [committed][gdb/testsuite] Fix spawn in tuiterm.exp Tom de Vries
2020-02-27 16:49 ` Tom Tromey

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