From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from kwanyin.sergiodj.net (kwanyin.sergiodj.net [158.69.185.54]) by sourceware.org (Postfix) with ESMTPS id 52AC8395A032 for ; Tue, 10 Mar 2020 17:14:31 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] [gdb/testsuite] Fix spawn in tuiterm.exp From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: Date: Tue, 10 Mar 2020 13:14:29 -0400 X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-testers@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-testers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2020 17:14:32 -0000 *** TEST RESULTS FOR COMMIT c8d4f6dfd9264d6ab5d14c2dde3628cc1e7dd75f *** commit c8d4f6dfd9264d6ab5d14c2dde3628cc1e7dd75f Author: Tom de Vries AuthorDate: Thu Feb 27 10:16:00 2020 +0100 Commit: Tom de Vries CommitDate: Thu Feb 27 10:16:00 2020 +0100 [gdb/testsuite] Fix spawn in tuiterm.exp 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. gdb/testsuite/ChangeLog: 2020-02-27 Tom de Vries * lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is not set. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 52c46f9e2f..2f5ab91bf8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-02-27 Tom de Vries + + * lib/tuiterm.exp (spawn): Handle case that spawn_out(slave,name) is + not set. + 2020-02-26 Aaron Merey * gdb.debuginfod: New directory for debuginfod tests. 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 }