[binutils-gdb] [gdb/testsuite] Drop tclsh dependency

Tom de Vries vries@sourceware.org
Fri Sep 26 23:54:24 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=307d4c216e956a9f2b6a3354631e17d26bdf5475

commit 307d4c216e956a9f2b6a3354631e17d26bdf5475
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Sep 27 01:54:18 2025 +0200

    [gdb/testsuite] Drop tclsh dependency
    
    The test-case gdb.tui/tuiterm-2.exp uses a tcl script gdb.tcl that uses tclsh
    as its interpreter:
    ...
     #!/usr/bin/env tclsh
    ...
    
    I used tclsh because I assumed it was an existing dependency of
    dejagnu/expect, but apparently [1] that's not the case.
    
    IWBN to use some existing dependency instead.
    
    Using expect instead of tclsh also works on my system, but looking in
    /usr/bin/runtest I realized that someone might have a dejagnu setup with
    a custom expect indicated by setting an env var EXPECT.  So to find expect
    we'd have to mimic whatever runtest is doing to find expect, or do:
    ...
    $ runtest --version -v | grep "Expect binary"
    ...
    using the appropriate runtest.
    
    That sounds non-trivial and fragile, so simply use a shell script with /bin/sh
    interpreter instead.
    
    Tested on x86_64-linux.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    
    [1] https://sourceware.org/pipermail/gdb-patches/2025-September/220736.html

Diff:
---
 gdb/testsuite/gdb.tui/{gdb.tcl => gdb.sh} | 6 +++---
 gdb/testsuite/gdb.tui/tuiterm-2.exp       | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/gdb.tcl b/gdb/testsuite/gdb.tui/gdb.sh
similarity index 93%
rename from gdb/testsuite/gdb.tui/gdb.tcl
rename to gdb/testsuite/gdb.tui/gdb.sh
index ca207edb1c6..0079a3fb441 100755
--- a/gdb/testsuite/gdb.tui/gdb.tcl
+++ b/gdb/testsuite/gdb.tui/gdb.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env tclsh
+#!/bin/sh
 
 # Copyright 2025 Free Software Foundation, Inc.
 
@@ -15,6 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-puts "foo\033(%5"
+printf "foo\033(%%5"
 
-gets stdin
+read
diff --git a/gdb/testsuite/gdb.tui/tuiterm-2.exp b/gdb/testsuite/gdb.tui/tuiterm-2.exp
index 3dfbd63c5fb..9e3ddc72eef 100644
--- a/gdb/testsuite/gdb.tui/tuiterm-2.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm-2.exp
@@ -153,8 +153,8 @@ with_override Term::accept_gdb_output test_accept_gdb_output {
 }
 
 proc_with_prefix unrecognized_escape_sequence {} {
-    if { [spawn $::srcdir/$::subdir/gdb.tcl] == 0 } {
-	unsupported "cannot spawn gdb.tcl"
+    if { [spawn $::srcdir/$::subdir/gdb.sh] == 0 } {
+	unsupported "cannot spawn gdb.sh"
 	return
     }
     switch_gdb_spawn_id $spawn_id


More information about the Gdb-cvs mailing list