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.129.124]) by sourceware.org (Postfix) with ESMTPS id D2C1F3858280 for ; Tue, 25 Jul 2023 15:40:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2C1F3858280 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=1690299627; h=from:from:reply-to:subject:subject: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=hfBsRruj2UT0ETh6A2PuNfeEuSsrWciOdd1VqVbECd0=; b=HAiod90NJSTzz7d0wqMqUrEGlgk3/XUAEGEibHxm1HKeU4dGSMcmtG15O+yZDMTQGZqthp 04On2z8gIGAOhHIaUBzfxTDRk3PTbVBkB/CMR/UPtWfM39ImestFxCesMKPrKOHN2Yuy1E 3x0Szk9RxNE9Id5/ylxCraGqMZPaNDg= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-BQUDpb2fO6uvpPaSwC3uNw-1; Tue, 25 Jul 2023 11:40:26 -0400 X-MC-Unique: BQUDpb2fO6uvpPaSwC3uNw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7683da3e2a5so670820085a.3 for ; Tue, 25 Jul 2023 08:40:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690299626; x=1690904426; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hfBsRruj2UT0ETh6A2PuNfeEuSsrWciOdd1VqVbECd0=; b=K4UCotkjk40EVfOupMXMofg9fapxrc0D8ie4FctUKzAbVOiHhsnqoJ+BjCxXgZjfBo Ok46NskVuIyMlt9FMdmwqxtxVl0zECNUQ77WEapo9HnwUY/bmm0cy4r3kr/VhD/qioQX vtcXkHQ7xCLx2PuIBsu3JlpGyg7EYzzCUgFwRk3oZ9jBtKBCnK2KpHiSrFd19cEMo3EU ks/BqJR2WZyRjDYUeJCxDE3yUzS3MtP0yjoHW2vKxID6SsIe9PnXSesNGAbvve8GrAbC 750h8KI3Gx4UT5S2f9KWWV90mw7gGh7Ie+HNdV9y0srhgk44Gi5xIZlmxSvwJ+j0K8YA v2LQ== X-Gm-Message-State: ABy/qLbPTbVCfk2OWgbhxwlAo6qOcvC2DI+dd/A045m2EA+Xjw1kFa9L DN4rddMLpQ1NWBa0kHr5lJZrubVV1RktrKkXxvcW52EyKBRa4NcIdU1t43fvSY5Lgw9fmO7I9+1 hxCsQst17HnjAJkg1xWafPg== X-Received: by 2002:a05:620a:40d2:b0:768:3f41:5843 with SMTP id g18-20020a05620a40d200b007683f415843mr3628074qko.50.1690299625748; Tue, 25 Jul 2023 08:40:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlHimK9ozcI87xRN3NVtwRg3zSX9NZP29MDaA57lugwB8RtCqMO/lMiOo/8AGeeRpruAyVoZMw== X-Received: by 2002:a05:620a:40d2:b0:768:3f41:5843 with SMTP id g18-20020a05620a40d200b007683f415843mr3628055qko.50.1690299625480; Tue, 25 Jul 2023 08:40:25 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id a22-20020a05620a103600b00767765561absm3753756qkk.100.2023.07.25.08.40.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Jul 2023 08:40:25 -0700 (PDT) Message-ID: Date: Tue, 25 Jul 2023 17:40:23 +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 To: Tom de Vries , gdb-patches@sourceware.org References: <20230222091110.2995513-1-blarsen@redhat.com> From: Bruno Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,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: On 15/07/2023 14:13, Tom de Vries wrote: > 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) > ... Hi! Sorry for taking so long to respond. I'd appreciate some help in solving, if you have the time. > > 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" >> +    } This is the specific change that causes the failures. The thinking behind it was that if we receive more characters, but not the whole complete_line, we got a failure. Something like this could detect if we have a unique - but wrong - suggestion or multiple options. This way it doesn't have to go to timeout every time, because it was making clang testing take too long. Is there any other way to detect if GDB is done with the suggestion? Or can we detect that read1 is being used, so this gets special cased? -- Cheers, Bruno >>       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" >> +    } >>       } >>   } >