From patchwork Fri May 26 13:02:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 70161 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 060C53857020 for ; Fri, 26 May 2023 13:03:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 060C53857020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685106202; bh=hzal/mIYZWn2ABpeNvRwAMy5azjQ9xl9SNP7DCSZAt8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ro5NfhJhtIxUN9bXV++oBS5aCbR51D5EH+bmXdFmxWf5GNvlpsFVaz77NDoLarSnf EZZKqe331o6aASC05UV1YHDLRaYDmx9lrKM514LKHrZyVl0ah8kD1X/b3LADUmSPSj pF/TsVhYQ1svzo6j2CI9n6uLdO5P/F17dN6C3baw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 670FA3858C2C for ; Fri, 26 May 2023 13:02:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 670FA3858C2C Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 9EA6421A14 for ; Fri, 26 May 2023 13:02:48 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 8B68E13684 for ; Fri, 26 May 2023 13:02:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id V0kiIPitcGRHYAAAGKfGzw (envelope-from ) for ; Fri, 26 May 2023 13:02:48 +0000 To: gdb-patches@sourceware.org Subject: [pushed 1/3] [gdb/testsuite] Fix reverse attribute in tuiterm Date: Fri, 26 May 2023 15:02:58 +0200 Message-Id: <20230526130300.20974-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I noticed in proc Term::_csi_m arguments that while parameters 7 and 27 are supposed to set the reverse attribute to 1 and 0, in fact it's set to 1 in both cases: ... 7 { set _attrs(reverse) 1 } ... 27 { set _attrs(reverse) 1 } ... Fix this and add a regression test in gdb.tui/tuiterm.exp. Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/tuiterm.exp | 36 +++++++++++++++++++++++++++++++ gdb/testsuite/lib/tuiterm.exp | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) base-commit: 86b96a79b81fa6fcbb3e136d8c720c4aa6df8eda diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp index 6cc6c628e73..ff0a3ac48ad 100644 --- a/gdb/testsuite/gdb.tui/tuiterm.exp +++ b/gdb/testsuite/gdb.tui/tuiterm.exp @@ -676,6 +676,40 @@ proc test_insert_line { } { } 2 0 } +proc test_attrs {} { + foreach { attr vals } { + reverse { + 7 1 + 27 0 + } + underline { + 4 1 + 24 0 + } + intensity { + 1 bold + 2 dim + 22 normal + } + } { + setup_terminal 8 1 + set re "" + foreach { arg val } $vals { + Term::_insert "a" + Term::_csi_m $arg + append re "a<$attr:$val>" + } + + Term::_insert "a" + append re "a" + + set re "^$re *$" + + set line [Term::get_line_with_attrs 0] + gdb_assert { [regexp $re $line] } "attribute: $attr" + } +} + # Run proc TEST_PROC_NAME with a "small" terminal. proc run_one_test_small { test_proc_name } { @@ -727,3 +761,5 @@ foreach_with_prefix test { } { run_one_test_large $test } + +test_attrs diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 5c0be85ee73..49ce79558c6 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -590,7 +590,7 @@ namespace eval Term { set _attrs(underline) 0 } 27 { - set _attrs(reverse) 1 + set _attrs(reverse) 0 } 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 { set _attrs(fg) $item