From 71725dd5d82266d9214a5d359617529bd0b826d2 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sat, 27 Sep 2025 01:54:18 +0200 Subject: [PATCH] [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 [1] https://sourceware.org/pipermail/gdb-patches/2025-September/220736.html --- 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 -- 2.47.3