From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yXY7F8+Yz2r8ZAkAWB0awg (envelope-from ) for ; Wed, 14 Oct 2026 10:59:27 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 56DB41E050; Wed, 14 Oct 2026 10:59:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BDB8E1E04E for ; Wed, 14 Oct 2026 10:59:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AD9A4BA23CA for ; Wed, 14 Oct 2026 14:59:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AD9A4BA23CA Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 6216C4BA2E0F for ; Wed, 14 Oct 2026 14:58:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6216C4BA2E0F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6216C4BA2E0F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791989920; cv=none; b=rDaOH40Au2N73CB92ySJio3e/E7/VOr/6gD19ZoBBvOM2E8qbVeqBPe+Lp4c8LNDwJ7XHS3iWCaX+HrrH/N6OzYURPPneStdzgzx8qB/rd4ncJgzPTjMmfJEBL03o8RIz6ttkn28YJsYiTv4XksrfwpsRsge92zSqi8uvXihrWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791989920; c=relaxed/simple; bh=uMgyIXd28nnu5VUKFRYW+eNd400XHIz/d6zUTsSyI/E=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=jzrdfNzz4On/w42UMOb7R1nTMCSLCWifI+jL3AAIhscJ/nVBydlAATsnNiJ8vMNl+lfTlKcfxMLO8A2oG6bdlsD3nP3fljaTti/2A++nOGVZ96FxnMIxqNDpMv0GD7hXG8ig7jXLTe90nDUEjSmlvtGI9hroBAPT6pEIdKWJcdE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=J3+N+4ro; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=he1oqKMf DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6216C4BA2E0F Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 63F101FB65 for ; Wed, 14 Oct 2026 14:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1791989919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q06+UlOpSQO57MlKrXwab08l2twBevk2jGPGzdq7Rkc=; b=J3+N+4roYJ/egj8UbYlqKt4yf9d3cxiSbXUjgCBrOhxuHf9Wu7MVsngC+AY8uMr3JcbM8w NDYFQ8yWHsxHS2oo32raELEqlfm0tDAjhrsIYpdOFxnjBswBcEWB0AqaN0HdBzz2xmyhC9 6bxNdEC2dXQ4Poa7DDzY2bn4UM43jIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1791989919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q06+UlOpSQO57MlKrXwab08l2twBevk2jGPGzdq7Rkc=; b=he1oqKMfnJd3oI0l9lvsIC7x5GwtVdG5vkgjY6JyXW/U0ndZ7JNnPpfC1/0EvFnNAmmJcd b4KPPfMKtQ+St6CQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1791989919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q06+UlOpSQO57MlKrXwab08l2twBevk2jGPGzdq7Rkc=; b=J3+N+4roYJ/egj8UbYlqKt4yf9d3cxiSbXUjgCBrOhxuHf9Wu7MVsngC+AY8uMr3JcbM8w NDYFQ8yWHsxHS2oo32raELEqlfm0tDAjhrsIYpdOFxnjBswBcEWB0AqaN0HdBzz2xmyhC9 6bxNdEC2dXQ4Poa7DDzY2bn4UM43jIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1791989919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q06+UlOpSQO57MlKrXwab08l2twBevk2jGPGzdq7Rkc=; b=he1oqKMfnJd3oI0l9lvsIC7x5GwtVdG5vkgjY6JyXW/U0ndZ7JNnPpfC1/0EvFnNAmmJcd b4KPPfMKtQ+St6CQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0CF311374A for ; Wed, 14 Oct 2026 14:58:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 92gBHp6Yz2qpIgAAD6G6ig:T4 (envelope-from ) for ; Wed, 14 Oct 2026 14:58:39 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 3/7] [gdb/testsuite] Factor out small_initial in gdb.tui/tuiterm.exp Date: Wed, 14 Oct 2026 16:58:34 +0200 Message-ID: <20261014145838.3560108-4-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20261014145838.3560108-1-tdevries@suse.de> References: <20261014145838.3560108-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org There are many tests in gdb.tui/tuiterm.exp that check that the display hasn't changed by comparing it to its initial state: ... check "backspace one" { "abcdefgh" "ijklmnop" "qrstuvwx" "yz01234 " } 0 2 ... Factor out a new variable small_initial, and use it 35 times. --- gdb/testsuite/gdb.tui/tuiterm.exp | 253 ++++++------------------------ 1 file changed, 45 insertions(+), 208 deletions(-) diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp index b6330b0d6a8..f09e1514e9b 100644 --- a/gdb/testsuite/gdb.tui/tuiterm.exp +++ b/gdb/testsuite/gdb.tui/tuiterm.exp @@ -64,6 +64,14 @@ proc setup_terminal { cols rows } { } } +# Variable that represents the state of the small terminal after setup_small. +set small_initial { + "abcdefgh" + "ijklmnop" + "qrstuvwx" + "yz01234 " +} + # Most tests are fine with a small terminal. This proc initializes the terminal # with 8 columns and 4 rows, with the following content: # @@ -79,17 +87,11 @@ proc setup_terminal { cols rows } { proc setup_small {} { setup_terminal 8 4 - Term::_insert "abcdefgh" - Term::_insert "ijklmnop" - Term::_insert "qrstuvwx" - Term::_insert "yz01234" + foreach line $::small_initial { + Term::_insert [string trim $line] + } - check "check after setup" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 3 + check "check after setup" $::small_initial 7 3 } # Some tests require a larger terminal. This proc initializes the terminal with @@ -108,41 +110,21 @@ proc test_backspace {} { Term::_move_cursor 1 2 Term::_ctl_0x08 0 - check "backspace one" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "backspace one" $::small_initial 0 2 # Cursor should not move if it is already at column 0. Term::_ctl_0x08 0 - check "backspace 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "backspace 2" $::small_initial 0 2 # Cursor should wrap to previous line. Term::_ctl_0x08 1 - check "backspace 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 1 + check "backspace 3" $::small_initial 7 1 } proc test_linefeed { } { Term::_move_cursor 1 2 Term::_ctl_0x0a - check "linefeed" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 1 3 + check "linefeed" $::small_initial 1 3 } proc test_linefeed_scroll { } { @@ -160,20 +142,10 @@ proc test_linefeed_scroll { } { proc test_carriage_return { } { Term::_move_cursor 1 2 Term::_ctl_0x0d - check "carriage return 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "carriage return 1" $::small_initial 0 2 Term::_ctl_0x0d - check "carriage return 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "carriage return 2" $::small_initial 0 2 } proc test_insert_characters { } { @@ -263,228 +235,108 @@ proc test_cursor_up { } { Term::_move_cursor 2 3 Term::_csi_A - check "cursor up 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 2 + check "cursor up 1" $::small_initial 2 2 Term::_csi_A 2 - check "cursor up 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 0 + check "cursor up 2" $::small_initial 2 0 Term::_csi_A 1 - check "cursor up 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 0 + check "cursor up 3" $::small_initial 2 0 } proc test_cursor_down { } { Term::_move_cursor 1 0 Term::_csi_B - check "cursor down 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 1 1 + check "cursor down 1" $::small_initial 1 1 Term::_csi_B 2 - check "cursor down 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 1 3 + check "cursor down 2" $::small_initial 1 3 Term::_csi_B 1 - check "cursor down 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 1 3 + check "cursor down 3" $::small_initial 1 3 } proc test_cursor_forward { } { Term::_move_cursor 0 1 Term::_csi_C - check "cursor forward 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 1 1 + check "cursor forward 1" $::small_initial 1 1 Term::_csi_C 6 - check "cursor forward 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 1 + check "cursor forward 2" $::small_initial 7 1 Term::_csi_C 1 - check "cursor forward 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 1 + check "cursor forward 3" $::small_initial 7 1 } proc test_cursor_backward { } { Term::_move_cursor 7 1 Term::_csi_D - check "cursor backward 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 6 1 + check "cursor backward 1" $::small_initial 6 1 Term::_csi_D 6 - check "cursor backward 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 1 + check "cursor backward 2" $::small_initial 0 1 Term::_csi_D 1 - check "cursor backward 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 1 + check "cursor backward 3" $::small_initial 0 1 } proc test_cursor_next_line { } { Term::_move_cursor 2 0 Term::_csi_E - check "cursor next line 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 1 + check "cursor next line 1" $::small_initial 0 1 Term::_move_cursor 2 1 Term::_csi_E 2 - check "cursor next line 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 3 + check "cursor next line 2" $::small_initial 0 3 Term::_move_cursor 2 3 Term::_csi_E 1 - check "cursor next line 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 3 + check "cursor next line 3" $::small_initial 0 3 } proc test_cursor_previous_line { } { Term::_move_cursor 2 3 Term::_csi_F - check "cursor previous line 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "cursor previous line 1" $::small_initial 0 2 Term::_move_cursor 2 2 Term::_csi_F 2 - check "cursor previous line 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 0 + check "cursor previous line 2" $::small_initial 0 0 Term::_move_cursor 2 0 Term::_csi_F 1 - check "cursor previous line 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 0 + check "cursor previous line 3" $::small_initial 0 0 } proc test_horizontal_absolute { } { Term::_move_cursor 2 2 Term::_csi_G - check "cursor horizontal absolute 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "cursor horizontal absolute 1" $::small_initial 0 2 Term::_move_cursor 2 2 Term::_csi_G 4 - check "cursor horizontal absolute 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 3 2 + check "cursor horizontal absolute 2" $::small_initial 3 2 Term::_csi_G 8 - check "cursor horizontal absolute 3" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 2 + check "cursor horizontal absolute 3" $::small_initial 7 2 Term::_csi_G 9 - check "cursor horizontal absolute 4" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 7 2 + check "cursor horizontal absolute 4" $::small_initial 7 2 Term::_csi_` - check "horizontal position absolute 1" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 0 2 + check "horizontal position absolute 1" $::small_initial 0 2 } proc test_cursor_position { } { Term::_move_cursor 1 1 Term::_csi_H 3 5 - check "cursor horizontal absolute 2" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 4 2 + check "cursor horizontal absolute 2" $::small_initial 4 2 } proc test_cursor_horizontal_forward_tabulation { } { @@ -682,28 +534,13 @@ proc test_vertical_line_position_absolute { } { Term::_move_cursor 2 1 Term::_csi_d - check "default param" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 0 + check "default param" $::small_initial 2 0 Term::_csi_d 3 - check "explicit param" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 2 + check "explicit param" $::small_initial 2 2 Term::_csi_d 100 - check "try to move off-display" { - "abcdefgh" - "ijklmnop" - "qrstuvwx" - "yz01234 " - } 2 3 + check "try to move off-display" $::small_initial 2 3 } proc test_insert_line { } { -- 2.51.0