From patchwork Wed Jul 26 13:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 73229 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45D7B3856968 for ; Wed, 26 Jul 2023 13:10:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45D7B3856968 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690377020; bh=l/wpNnNuPeEbhVzSsdlNJoqos8OcGT88cY/TYd9Zf0o=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ePuUAJQwYSYdG9bHWGQWbKpPXA2fGnNserROrxCxikYeKbBMhcIQhpaVXQa2qpAq3 iXZvCrhsWQ5gF4h3Whr1rUnNxA+MXkvf/dmOUGcb5mQ+LD8LbRa0iR3DKOZSekPnDz mPMmy8+8s8dr7zAULkoVtg7htG3aZSxTp0QfxdKM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 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) 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 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 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: , X-Patchwork-Original-From: Bruno Larsen via Gdb-patches From: Guinevere Larsen Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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 + } } }