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 C63B63858D35 for ; Sat, 15 Jul 2023 12:13:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C63B63858D35 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 CDEED21F50; Sat, 15 Jul 2023 12:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689423212; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JxqJJ2UXJovgpokKR2AUpPzUwZrsNVdPN7QKHQeViC8=; b=rxmcfedfhhv8I06cY4LOvFCTuZbdKI8ibsm6AwhCBxLc26+UMjA4PngwAVOAlRuVhFnr46 th7YcTdASUrY113hMFwqy2NxFEh7di+6BO7ZzR8blZ07xIb2uTueDRrv3gSOXzO2JNAvRL 5gLl8ooU6cYXUBSqN6th2vj9zIaRAu0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689423212; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JxqJJ2UXJovgpokKR2AUpPzUwZrsNVdPN7QKHQeViC8=; b=U/PWNHUCP7SmAGuCsDdDlzhOBpKZVryC+mAWWb1g/AEHXGMzWahS6Lbm8pWFeWFfW3+3H7 cg+ujAdlIB4ZkmCA== 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> From: Tom de Vries 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 List-Id: 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" > + } > } > } >