From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 90BD7385802F for ; Mon, 22 May 2023 13:15:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 90BD7385802F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9EB9A21C7E; Mon, 22 May 2023 13:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684761344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GqlxfmKeNYUjU3wVw+DDch1ZnZdx9keHpDi9zEadYfY=; b=fCssVd1YrdtHcB99YxV0o8Zz+fIInwuKYJEdArwUio2D4X9KDbJ8E4YFwXlmPiOw3Cqb7V krdSyvcJeFVbQKyLDczPDGbaHrJMkZCv5kC+AXhM7t6eGt0cxm/EPXeinxE2+p4GlAFuvY KHBF62lod4//UeG5mT8k46XpsvKpKfk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684761344; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GqlxfmKeNYUjU3wVw+DDch1ZnZdx9keHpDi9zEadYfY=; b=6xN0Y3Y93W9FXaI3tWg0pd9B1RnnizodliozrujW7WFa8F6UhsBLHEinYJoHHNB/9hGCJb P1ARyYc1YUm1BiDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 887F8139F5; Mon, 22 May 2023 13:15:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EPFCIABra2RvdAAAMHmgww (envelope-from ); Mon, 22 May 2023 13:15:44 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 4/6] [gdb/testsuite] Make ansi-for-tui available in with_tuiterm Date: Mon, 22 May 2023 15:15:43 +0200 Message-Id: <20230522131545.12291-6-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230522131545.12291-1-tdevries@suse.de> References: <20230522131545.12291-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Use contrib/ansi-for-tui.sh to create a ansi-for-tui terminfo entry in cached dir build/gdb/testsuite/cache/terminfo, and make it available in proc with_tuiterm using TERMINFO. Tested on x86_64-linux. --- gdb/testsuite/lib/gdb.exp | 16 ++++++++++++++++ gdb/testsuite/lib/tuiterm.exp | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 133d914aff8..950a1073f74 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6578,6 +6578,22 @@ proc cached_file { filename txt {executable 0}} { return $filename } +# Create a dir with name DIRNAME in the cache directory. Return a list of: +# - the full directory name, and +# - 1 if a new dir was created, otherwise 0. + +proc cached_dir { dirname } { + set dirname [make_gdb_parallel_path cache $dirname] + + if { [file exists $dirname] } { + return [list $dirname 0] + } + + file mkdir $dirname + + return [list $dirname 1] +} + # Return a wrapper around gdb that prevents generating a core file. proc gdb_no_core { } { diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index e52cb3e5b6d..4c0fdc9b6df 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -801,7 +801,16 @@ namespace eval Term { # BODY. proc with_tuiterm {rows cols body} { global env stty_init - save_vars {env(TERM) stty_init} { + + set res [cached_dir terminfo] + set terminfo [lindex $res 0] + set dir_created [lindex $res 1] + if { $dir_created } { + exec $::srcdir/../contrib/ansi-for-tui.sh -o $terminfo + } + + save_vars {env(TERM) env(TERMINFO) stty_init} { + setenv TERMINFO $terminfo setenv TERM ansi _setup $rows $cols -- 2.35.3