From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5484D385AF89 for ; Wed, 26 Jul 2023 13:09:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5484D385AF89 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690376950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l/wpNnNuPeEbhVzSsdlNJoqos8OcGT88cY/TYd9Zf0o=; b=iM2hTuZPlIOWH7OpUrgzU5WCnumNToCsTpVkW/2IgekfIP+0+J6ZfAVIkv9xHlPSaAU9qp +6CGz1bonoZk+QREiaVoSgc3P7+/s1oEJ9ruaWdufvOKbX3MMAPdTemQ/1x2ma+jFSwz6E IQ02jxqymL6rRNrLKlCKgR/JcoeKiyY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-58-5PYUKq-EPBCovqDzXH_P5A-1; Wed, 26 Jul 2023 09:09:06 -0400 X-MC-Unique: 5PYUKq-EPBCovqDzXH_P5A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FAB488D06E; Wed, 26 Jul 2023 13:09:06 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1CB9154D8A0; Wed, 26 Jul 2023 13:09:05 +0000 (UTC) From: Bruno Larsen To: gdb-patches@sourceware.org Cc: tdevries@suse.de, Bruno Larsen Subject: [PATCH] gdb/testsuite: fix completion tests when using READ1 Date: Wed, 26 Jul 2023 15:04:59 +0200 Message-ID: <20230726130458.1471089-2-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: The commit a3da2e7e550c4fe79128b5e532dbb90df4d4f418 has introduced regressions when testing using the READ1 mechanism. The reason for that is the new failure path in proc test_gdb_complete_tab_unique, which looks for GDB suggesting more than what the test inputted, but not the correct answer, followed by a white space. Consider the following case: int foo(int bar, int baz); Sending the command "break foo" to GDB will return break foo(int, int) which easily fits the buffer in normal testing, so everything works, but when reading one character at a time, the test will find the partial "break foo(int, " and assume that there was a mistake, so we get a spurious FAIL. To fix these errors, this commit makes it so the relevant section is only evaluated when the test is not being run with the READ1 mechanism. --- With these changes, I only see a failure that was not introduced by my original patch, when testing gdb.ada/complete.exp due to too much output, I think. --- gdb/testsuite/lib/completion-support.exp | 30 +++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp index ea73c3bb367..9e76d7c9eb6 100644 --- a/gdb/testsuite/lib/completion-support.exp +++ b/gdb/testsuite/lib/completion-support.exp @@ -113,16 +113,28 @@ proc test_gdb_complete_tab_unique { input_line complete_line_re append_char_re } 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" + if { ![info exists ::env(READ1)] || $::env(READ1) == ""} { + 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 + } } - timeout { - fail "$test (timeout)" - set res -1 + } else { + gdb_test_multiple "" "$test" { + -re "^$complete_line_re$append_char_re$" { + pass "$test" + } + timeout { + fail "$test (timeout)" + set res -1 + } } } -- 2.41.0