From: Tom de Vries Date: Fri, 15 Aug 2025 12:48:10 +0000 (+0200) Subject: [gdb/testsuite] Add Term::with_term X-Git-Tag: gdb-17-branchpoint~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Add Term::with_term Add Term::with_term that allows us to override the default TERM used in tuiterm: ... Term::with_term xterm { Term::clean_restart 12 40 } ... --- diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 1d60a07be63..4ef3dc09159 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -33,6 +33,9 @@ namespace eval Term { variable _resize_count + variable _TERM + set _TERM "" + variable _alternate variable _alternate_setup set _alternate 0 @@ -1172,13 +1175,24 @@ proc Term::wait_for_line { regexp {pos ""} } { return 1 } +# In BODY, when using Term::with_tuiterm, use TERM instead of the default. + +proc Term::with_term { term body } { + save_vars { Term::_TERM } { + set Term::_TERM $term + uplevel $body + } +} + # Setup the terminal with dimensions ROWSxCOLS, TERM=ansi, and execute # BODY. proc Term::with_tuiterm {rows cols body} { global env stty_init variable _TERM save_vars {env(TERM) env(NO_COLOR) stty_init} { - if { [ishost *-*-*bsd*] } { + if { $Term::_TERM != "" } { + setenv TERM $Term::_TERM + } elseif { [ishost *-*-*bsd*] } { setenv TERM ansiw } else { setenv TERM ansi