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 CE9ED3857347 for ; Tue, 15 Aug 2023 07:05:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE9ED3857347 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=1692083154; 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=+HBGSMw7eFphA5+Qe2y5fl9R/6tqGw3pky0WPQbJq+I=; b=V66s74psQ+bMhsTe5sup35un8qfK7f6nOdirr73ev8Y+1w976nMmAfE2BZasdsBAGhCZCp i5jTX5ArnTnV3RdfZiD8EMua2Q0K+jRThObwAvivQzAmMaVDafbMIBudgMfMp8SU4O3oTn L342/lYp3xvwZ5vnG3PQfctwsh1m5oQ= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-ySz-muLCPiy9ajwlmBy9xA-1; Tue, 15 Aug 2023 03:05:53 -0400 X-MC-Unique: ySz-muLCPiy9ajwlmBy9xA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a355cf318so331810666b.2 for ; Tue, 15 Aug 2023 00:05:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692083151; x=1692687951; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+HBGSMw7eFphA5+Qe2y5fl9R/6tqGw3pky0WPQbJq+I=; b=C0etrN2fcz7yHkRexRk34ns4pT73/dNOm2Ozec7+6DKD1rrevxQ8FBYehf1sqUDtx9 DlwUMQEJNE2/W2zqqPf+E5riv4qrAqk3RCM4F6/UslMJIkAyWFlyYil6hdosUkMV8j5n wAFiwtgFWOWMdBy4S26Ag6yOgXNTx2XEQN7lPwvgYkVxDyJoTWju5rLvK9Da86ISOSGP igKeuQxRpWe8NEe39BIf8RBX8sCeh9hkYEUW861sj5Zfk5Z6eynJZy23gsPtdmj/PjlK 5bjOC9AMX66S6Q1d6QceNM8mn/PohEm92K8GPam+kX7WPA1rZmLWHssWuZr3vF0Qyyi3 7Bbw== X-Gm-Message-State: AOJu0YxcB9m9X40nKaIKxBtw6edM2+1DkijoYOOTCVb5v3XF9C+7IZu1 SxHP7gBDgJnJQ07LDrfUAR7Eg/00+D9CEOpVbH5lrCwjoakV/l3wa28YLt1DFTv2GwJt25+uT08 bWIKrmBfeoaUTNAf6ojmxzJ8Q80dsZw== X-Received: by 2002:a17:906:3044:b0:994:580c:5049 with SMTP id d4-20020a170906304400b00994580c5049mr9322148ejd.5.1692083151555; Tue, 15 Aug 2023 00:05:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNor5RRRQfbAjCmrO4wb/wHIM4ysQka+RLWAi/0FW5qVGIMRMbYhm0sjXfuZ11kkSyqnhgug== X-Received: by 2002:a17:906:3044:b0:994:580c:5049 with SMTP id d4-20020a170906304400b00994580c5049mr9322131ejd.5.1692083151243; Tue, 15 Aug 2023 00:05:51 -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 k21-20020a170906971500b0098de7d28c34sm6649960ejx.193.2023.08.15.00.05.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Aug 2023 00:05:50 -0700 (PDT) Message-ID: <8760aace-e3c2-3df7-b8d5-22a7162bf801@redhat.com> Date: Tue, 15 Aug 2023 09:05:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.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> <6a1ecf4a-8d8e-b993-ddf8-0d8863aeba74@suse.de> From: Guinevere Larsen In-Reply-To: <6a1ecf4a-8d8e-b993-ddf8-0d8863aeba74@suse.de> 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=-9.0 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 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/08/2023 07:45, Tom de Vries wrote: > On 7/25/23 17:40, Bruno Larsen wrote: >> 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? >> > > The purpose of read1 is to reliably exercise FAILs in the test-suite, > that are otherwise only occasionally occurring (see also "Race > detection" in gdb/testsuite/README). > > It's typically a test-case problem where it passes or fails depending > on how fast the input arrives. > > When read1 finds such a FAIL, we want to fix it because we want > deterministic results. > > So, I'd say the relevant question is: did the change make the related > test-cases racy, and does special casing try to hide the race? > Yeah, I spoke to Andrew off-list and he explained this to me. The test itself wasn't racy on a light machine, but could be if it was under heavy load or if the expected output was too big. I have sent a v2 that fixes this without special casing: https://sourceware.org/pipermail/gdb-patches/2023-August/201361.html -- Cheers, Guinevere Larsen She/Her/Hers