[binutils-gdb] [gdb/testsuite] Check spawn result in gdb.tui/tuiterm-2.exp

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


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

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

    [gdb/testsuite] Check spawn result in gdb.tui/tuiterm-2.exp
    
    Simon reported [1] that test-case gdb.tui/tuiterm-2.exp fails with an ERROR
    if tclsh is missing.
    
    Fix this by checking that spawning the gdb.tcl script succeeds.
    
    While we're at it, also add some missing cleanup related to the spawned process.
    
    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/tuiterm-2.exp | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/tuiterm-2.exp b/gdb/testsuite/gdb.tui/tuiterm-2.exp
index a451834b640..3dfbd63c5fb 100644
--- a/gdb/testsuite/gdb.tui/tuiterm-2.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm-2.exp
@@ -152,14 +152,17 @@ with_override Term::accept_gdb_output test_accept_gdb_output {
     }
 }
 
-with_test_prefix "Unrecognized escape sequence" {
-    spawn $srcdir/$subdir/gdb.tcl
-    switch_gdb_spawn_id  $spawn_id
+proc_with_prefix unrecognized_escape_sequence {} {
+    if { [spawn $::srcdir/$::subdir/gdb.tcl] == 0 } {
+	unsupported "cannot spawn gdb.tcl"
+	return
+    }
+    switch_gdb_spawn_id $spawn_id
 
     Term::_setup 4 20
 
-    save_vars timeout {
-	set timeout 1
+    save_vars ::timeout {
+	set ::timeout 1
 
 	set line { 0 0 20 1 }
 
@@ -178,4 +181,9 @@ with_test_prefix "Unrecognized escape sequence" {
 	    "echoed escape sequence"
     }
     Term::dump_screen
+
+    close $spawn_id
+    clear_gdb_spawn_id
 }
+
+unrecognized_escape_sequence


More information about the Gdb-cvs mailing list