]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Check spawn result in gdb.tui/tuiterm-2.exp
authorTom de Vries <tdevries@suse.de>
Fri, 26 Sep 2025 23:54:18 +0000 (01:54 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 26 Sep 2025 23:54:18 +0000 (01:54 +0200)
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

gdb/testsuite/gdb.tui/tuiterm-2.exp

index a451834b640af56e152b589213b455f5d116baba..3dfbd63c5fb2cc299d68adab8df51dd790ab8c2d 100644 (file)
@@ -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