From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id m/qABIWNsmQwnCIAWB0awg (envelope-from ) for ; Sat, 15 Jul 2023 08:13:57 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BgSofXUb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 054101E00F; Sat, 15 Jul 2023 08:13:56 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.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 D76AD1E00F for ; Sat, 15 Jul 2023 08:13:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 273163858430 for ; Sat, 15 Jul 2023 12:13:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 273163858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689423234; bh=JxqJJ2UXJovgpokKR2AUpPzUwZrsNVdPN7QKHQeViC8=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=BgSofXUb9G1E9OX3ZtaQ9DI/pZM+E8w60tfqVTfUOUtRUvnV0KHH2aOta4yqFs0Du uNOpZueeGXbH4KGzFnuRW0tOVWzbKQrsKgV/9GWTiaOYKzNQjejxEBNESS0PnEk0o/ N0b5l1lUesLg1vwZoWh5WBJBhGNoayoSF0dTores= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id C63B63858D35 for ; Sat, 15 Jul 2023 12:13:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C63B63858D35 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 CDEED21F50; Sat, 15 Jul 2023 12:13:32 +0000 (UTC) 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 8BE00138F3; Sat, 15 Jul 2023 12:13:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id K/JPHmyNsmRXfQAAMHmgww (envelope-from ); Sat, 15 Jul 2023 12:13:32 +0000 Message-ID: Date: Sat, 15 Jul 2023 14:13:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] gdb/testsuite: Improve testing of GDB's completion functions Content-Language: en-US To: Bruno Larsen , gdb-patches@sourceware.org References: <20230222091110.2995513-1-blarsen@redhat.com> In-Reply-To: <20230222091110.2995513-1-blarsen@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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, NICE_REPLY_A, 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2/22/23 10:11, Bruno Larsen via Gdb-patches wrote: > When looking at some failures of gdb.linespec/cp-completion-aliases.exp, > I noticed that when a completion test will fail, it always fails with a > timeout. This is because most completion tests use gdb_test_multiple > and only add a check for the correct output. This commit adds new > options for both, tab and command completion. > > For command completion, the new option will check if the prompt was > printed, and fail in this case. This is enough to know that the test has > failed because the check comes after the PASS path. For tab completion, > we have to check if GDB outputted more than just the input line, because > sometimes GDB would have printed a partial line before finishing with > the correct completion. This causes quite a few regressions with check-read1. For instance: ... (gdb) break baz(int, FAIL: gdb.cp/cpcompletion.exp: tab complete "break baz(int" double) Quit^M (gdb) ... Thanks, - Tom > --- > gdb/testsuite/lib/completion-support.exp | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp > index bf9c5ad352c..275f8874f15 100644 > --- a/gdb/testsuite/lib/completion-support.exp > +++ b/gdb/testsuite/lib/completion-support.exp > @@ -94,6 +94,9 @@ proc test_gdb_complete_tab_none { line } { > -re "^$line_re$completion::bell_re$" { > pass "$test" > } > + -re "$line_re\[^ \]+ $" { > + fail "$test" > + } > } > > clear_input_line $test > @@ -108,11 +111,15 @@ proc test_gdb_complete_tab_unique { input_line complete_line_re append_char_re } > > set test "tab complete \"$input_line\"" > send_gdb "$input_line\t" > + set partial_complete [string_to_regexp $input_line] > set res 1 > gdb_test_multiple "" "$test" { > -re "^$complete_line_re$append_char_re$" { > pass "$test" > } > + -re "$partial_complete\[^ \]+ $" { > + fail "$test" > + } > timeout { > fail "$test (timeout)" > set res -1 > @@ -164,6 +171,9 @@ proc test_gdb_complete_tab_multiple { input_line add_completed_line \ > } > } > } > + -re "${maybe_bell}\r\n.+\r\n$gdb_prompt $" { > + fail "$test" > + } > } > } > } > @@ -191,6 +201,9 @@ proc test_gdb_complete_cmd_unique { input_line complete_line_re } { > -re "^$cmd_re\r\n$complete_line_re\r\n$gdb_prompt $" { > pass $test > } > + -re "$gdb_prompt $" { > + fail "$test" > + } > } > } > > @@ -217,6 +230,9 @@ proc test_gdb_complete_cmd_multiple { cmd_prefix completion_word completion_list > -re "^$cmd_re\r\n$expected_re$gdb_prompt $" { > pass $test > } > + -re "$gdb_prompt $" { > + fail "$test" > + } > } > } >