From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GBGkLSiKmmEyUQAAWB0awg (envelope-from ) for ; Sun, 21 Nov 2021 13:04:24 -0500 Received: by simark.ca (Postfix, from userid 112) id B8F641F0CE; Sun, 21 Nov 2021 13:04:24 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 428ED1EDF0 for ; Sun, 21 Nov 2021 13:04:24 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB79F3858438 for ; Sun, 21 Nov 2021 18:04:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB79F3858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637517863; bh=ZfbAHscBq3EYMqcRqftScC7wlxwBd89QpYOprtO6CIc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cfH0nmlNjrnoVPe3MRt7AsibBjh5ZYJzHe6w2HJiq7t+2ZsY+v7lpeUEBPYse5DEi QrxKk9WGXFgK51bCbZ89ziVkMzcRadHNCcHTuQ3nNSdAC8otkbYFgVC2t8xWg5a8tv HoYmiIEXDavCqLv62Eh3Ppc7XfbGBXoHIr68LScQ= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id BA8123858428 for ; Sun, 21 Nov 2021 17:57:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA8123858428 Received: from Plymouth.lan (unknown [IPv6:2a02:390:9086:0:e409:90b0:99cc:9f98]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 88CCF854FA; Sun, 21 Nov 2021 17:57:42 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 15/29] gdb/testsuite: Remove duplicates from gdb.base/complete-empty.exp Date: Sun, 21 Nov 2021 17:56:22 +0000 Message-Id: <20211121175636.779325-16-lsix@lancelotsix.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211121175636.779325-1-lsix@lancelotsix.com> References: <20211121175636.779325-1-lsix@lancelotsix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Sun, 21 Nov 2021 17:57:43 +0000 (UTC) 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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" When I run the testsuite, I have: Running .../gdb/testsuite/gdb.base/complete-empty.exp ... DUPLICATE: gdb.base/complete-empty.exp: empty-input-line: cmd complete "" This comes from how test_gdb_complete_unique works (more specifically, how test_gdb_complete_unique_re works). In this proc we can see: # Trim INPUT_LINE and COMPLETE LINE, for the case we're completing # a command with leading whitespace. Leading command whitespace # is discarded by GDB. set input_line [string trimleft $input_line] set expected_output_re [string trimleft $complete_line_re] This test is trying to test how a buffer containing no commands is completed. A buffer containing no command can be an empty buffer (first scenario tested) or a buffer containing only white spaces. Given the behavior of the test procedure described above (required because the 'complete' command will trim anyway), our second test (buffer containing only white spaces) is turned into the first test case (empty buffer), leading to the DUPLICATE warning. I see two options to solve this: 1) Only test the tab-based completion for the test case with leading white spaces. 2) Run the test with a prefix the second time we test an empty buffer, so it is registered under a different name. I went for the first option which seems cleaner. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/complete-empty.exp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/complete-empty.exp b/gdb/testsuite/gdb.base/complete-empty.exp index 4620ec2adc9..60f8e3f1a9e 100644 --- a/gdb/testsuite/gdb.base/complete-empty.exp +++ b/gdb/testsuite/gdb.base/complete-empty.exp @@ -42,7 +42,17 @@ proc_with_prefix empty-input-line {} { test_gdb_complete_unique "" "!" " " 1 # Same, but with some leading whitespace. - test_gdb_complete_unique " " " !" " " 1 + + # This scenario is only tested using tab-completion and not the 'complete' + # command (as test_gdb_complete_tab_unique would do). This is due to the + # fact that GDB will in fine trim its input (producing a trimmed output). + # Knowing that the testing framework trims the input and expected output, + # turning this test case into the one we just did above. + if { [readline_is_used] } { + if { [test_gdb_complete_tab_unique " " " !" " "] == -1 } { + return -1 + } + } } proc test_driver {} { -- 2.33.1