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 71E2F3858C50 for ; Wed, 23 Mar 2022 14:48:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71E2F3858C50 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-44-ZUJembjaPqmtAVv12VMQdg-1; Wed, 23 Mar 2022 10:48:09 -0400 X-MC-Unique: ZUJembjaPqmtAVv12VMQdg-1 Received: by mail-wm1-f70.google.com with SMTP id v184-20020a1cacc1000000b0038a12dbc23bso2897185wme.5 for ; Wed, 23 Mar 2022 07:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=CaTOGT5UMU/qjIAUdd9tX+Hy1txcAI52PtBkNLtrlrM=; b=D9nUjTjwPhQXm+DqTkr92F72MTCRbPkGTNXFVyY5MmGCQprHRORNPLSviYHKQKyqNs TX7aIXumngKNckb9bqacYDj+hZPwql6DpSlZGylIf5qUcqFc3L50/Xhmo2mkqx9osKbw 8tIIboixWVO0grPHL/g8nQo1yruHLjgvrRu+H5hngnjzIUSgL2iJKONEw/68YCUbAoYA PcgDfquHXw8bu0JphzhYT5Hgvfsui7jPFGYPuc6PKJ1mZfe2V6goi6WXFlCT5ibBXk26 nK+ay5kf0zRqXOoTWew3H8xUUPAvKATmSm58O0Dr3eDy3YInyNnVVH0pcauPCQvQ6jwx +eLQ== X-Gm-Message-State: AOAM531vsqYkkby99zFg44pwhEBv7jWe+65y9Kx1QrkhU61QD5l5f/bE JD8ZABxacdjncUQJkqedJDvTxApkcA0WxvLiS7LaKK+eU6HNVzIrAkIXKatwV2v3qR7n4/s8F1P +pA7wna7SalDzBI32Tq+Gjw== X-Received: by 2002:a5d:6546:0:b0:203:f121:298c with SMTP id z6-20020a5d6546000000b00203f121298cmr113638wrv.427.1648046888281; Wed, 23 Mar 2022 07:48:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLDLmkBx+/YD6OYqKsZCop6Bdd9O4SgpFyrdlrs7Abtgs3pD5l+rhK2N/1gEtNYGNt6AVpOQ== X-Received: by 2002:a5d:6546:0:b0:203:f121:298c with SMTP id z6-20020a5d6546000000b00203f121298cmr113620wrv.427.1648046888033; Wed, 23 Mar 2022 07:48:08 -0700 (PDT) Received: from localhost (host109-158-45-15.range109-158.btcentralplus.com. [109.158.45.15]) by smtp.gmail.com with ESMTPSA id l10-20020a05600002aa00b0020414b4e75fsm75510wry.85.2022.03.23.07.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 07:48:07 -0700 (PDT) From: Andrew Burgess To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp In-Reply-To: <10858fef-c04d-d67f-7fd4-6dbbd9b1d126@palves.net> References: <20220322110309.3831447-1-aburgess@redhat.com> <10858fef-c04d-d67f-7fd4-6dbbd9b1d126@palves.net> Date: Wed, 23 Mar 2022 14:48:05 +0000 Message-ID: <87lex0sp22.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 23 Mar 2022 14:48:12 -0000 Pedro Alves writes: > On 2022-03-22 11:03, Andrew Burgess via Gdb-patches wrote: >> The gdb.mi/mi-multi-commands.exp test was added in commit: >> >> commit d08cbc5d3203118da5583296e49273cf82378042 >> Date: Wed Dec 22 12:57:44 2021 +0000 >> >> gdb: unbuffer all input streams when not using readline >> >> And then tweaked in commit: >> >> commit 144459531dd68a1287905079aaa131b777a8cc82 >> Date: Mon Feb 7 20:35:58 2022 +0000 >> >> gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test >> >> The second of these commits was intended to address periodic test >> failures that I was seeing, and this change did fix some problems, >> but, unfortunately, introduced other issues. >> >> The problem is that the test relies on sending two commands to GDB in >> a single write. As the characters that make these two commands arrive >> they are echoed to GDB's console. However, there is a race between >> how quickly the characters are echoed and how quickly GDB decides to >> act on the incoming commands. >> >> Usually, both commands are echoed in full before GDB acts on the first >> command, but sometimes this is not the case, and GDB can execute the >> first command before both commands are fully echoed to the console. >> In this case, the output of the first command will be mixed in with >> the echoing of the second command. >> >> This mixing of the command echoing and the first command output is >> what was causing failures in the original version of the test. >> >> The second commit relaxed the expected output pattern a little, but >> was still susceptible to failures, so this commit further relaxes the >> pattern. >> >> Now, we look for the first command output with no regard to what is >> before, or after the command. Then we look for the fist mi prompt to > > fist -> first > >> indicate that the first command has completed. >> >> I believe that this change should make the test more stable than it >> was before. >> --- >> gdb/testsuite/gdb.mi/mi-multi-commands.exp | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp >> index 12b1b482f9a..22b0ccf9aaa 100644 >> --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp >> +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp >> @@ -100,9 +100,12 @@ proc run_test { args } { >> set seen_second_message false >> >> gdb_test_multiple "" "look for first command output, command length $i" -prompt "$mi_gdb_prompt" { >> - -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"\r\n" { >> + -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" { >> pass $gdb_test_name >> set seen_first_message true >> + exp_continue >> + } >> + -re "\r\n$mi_gdb_prompt" { >> } > > Should move the "pass" to the mi_gdb_prompt match too, otherwise if the prompt match ever fails, > then as is this results in a PASS and then, say, a "FAIL ... (timeout)" for the same test. > > IIUC, should make the pass conditional on seen_first_message too: > > -re "\r\n$mi_gdb_prompt" { > gdb_assert $seen_first_message $gdb_test_message > } Thanks, I made these changes, and pushed this patch. Andrew