From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 5/FnEzJdBWK6OQAAWB0awg (envelope-from ) for ; Thu, 10 Feb 2022 13:45:06 -0500 Received: by simark.ca (Postfix, from userid 112) id 3EF6C1F3C6; Thu, 10 Feb 2022 13:45:06 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2B76C1ECEB for ; Thu, 10 Feb 2022 13:45:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8DBA73858C3A for ; Thu, 10 Feb 2022 18:45:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DBA73858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644518700; bh=JcnWNh0aMBFgQm66DoM1b+Ooqb6wpk5Tu9WGdHSZpgc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HRLZg9O7w9Ud/wNVq1hXOnw3pqdg7iUt3gN7PLGJwAS3BQPRiXUO+fzz4FvQiim7d NzuWOluku0K3lrmVKADqtLxUYPmRkoy0HNDi9kFvxAGcY0ydcO3rJ0Jj/IfPBa2j+O 8lOlknRMyw9jyRLoWDk7MyOYiHMd3s/sTx4p1L5A= 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 35FA73858D1E for ; Thu, 10 Feb 2022 18:44:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 35FA73858D1E 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-121-V6JmPSUZNvScbgsUFxP8IQ-1; Thu, 10 Feb 2022 13:44:39 -0500 X-MC-Unique: V6JmPSUZNvScbgsUFxP8IQ-1 Received: by mail-wm1-f70.google.com with SMTP id h82-20020a1c2155000000b003552c13626cso4720582wmh.3 for ; Thu, 10 Feb 2022 10:44:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JcnWNh0aMBFgQm66DoM1b+Ooqb6wpk5Tu9WGdHSZpgc=; b=40/umQ3gqVOJYmVq58w9XTcvyoWzxN0SJ+H0F8oDNWaIs3QOPYg32tUXjZbkqc8Ce5 U7gsh7ZtQ5w45Ni7XMnM9Q5TPQKp2tff/PBT2Kpf/e51dMTZD4ooBEQV81+2LS0q0RHW WMYNxrtzD85iCrPQSa3DQOufMpd96cDvm2qqtwKBOEvZ6JssM1L6bWUo1fOIKb3Adrol 4w0Y4KiLUaY3LXzQi0b1wWIa4pTAwjiR+qB55jML/fHRxCyjEj+IIXLnay/frtR0D2UT zCyAbMPH3jefffcqDKMaaE7lbCJ56csa7/4fkrlGYinJ3Io5/9Rt8uvdmH34dsyutKQ7 23mg== X-Gm-Message-State: AOAM531e/R5SrGVtvASxXLdT08LsI5dhEfiPrbQb4uqR7+bJIYPHxel8 S3DB+3bfMJUZ6o8+BCIn0r7SfVenQ+fHdEsOhneVFQNSHKDI9pRs/aUafhN00czCMlorOl+Wfpz oDQlPEd+pi2AGAunyjrfGR6C58CSgfoGgoD+zddHwl7ohx5rP4LfO8TTTVrJL7yW2YqaW1KlDwQ == X-Received: by 2002:adf:f548:: with SMTP id j8mr7230731wrp.41.1644518677733; Thu, 10 Feb 2022 10:44:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnOouxbFk6ad5HQpR+mUOLVQEqMzuMHndkCb4HScH0sX3qu0a00QAjxaeo2dDvlx5MfxeK0Q== X-Received: by 2002:adf:f548:: with SMTP id j8mr7230716wrp.41.1644518677389; Thu, 10 Feb 2022 10:44:37 -0800 (PST) Received: from localhost (92.40.179.186.threembb.co.uk. [92.40.179.186]) by smtp.gmail.com with ESMTPSA id o20sm680335wmq.21.2022.02.10.10.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 10:44:37 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH] gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test Date: Thu, 10 Feb 2022 18:44:33 +0000 Message-Id: <20220210184433.3095152-1-aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" I saw some failures in the test gdb.mi/mi-multi-commands.exp that I added recently. This 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 The failures I see only occurred when my machine was very heavily loaded. In this test I send multiple commands from dejagnu to gdb with a single send_gdb call. In a well behaving world what I want to happen is that the gdb console sees both commands arrive and echos the text of those commands. Then gdb starts processing the first command, prints the result, and then processes the second command, and prints the result. However, what I saw in my loaded environment was that only after sending the two commands, only the first command was echoed to gdb's terminal. Then gdb started processing the first command, and started to write the output. Now, mixed in with the first command output, the second command was echoed to gdb's terminal. Finally, gdb would finish printing the first command output, and would read and handle the second command. This mixing of command echoing with the first command output was causing the test matching patterns to fail. In this commit I change the command I use in the test from a CLI command to an MI command, this reduces the number of lines of output that come from the test, CLI commands sent through the MI interpreter are echoed back like this: (gdb) set $a = "FIRST COMMAND" &"set $a = \"FIRST COMMAND\"\n" ^done (gdb) While this is not the case for true MI command: (gdb) -data-evaluate-expression $a ^done,value="\"FIRST COMMAND\"" (gdb) Less output makes for simpler patterns to match against. Next, when sending two command to gdb I was previously trying to spot the output of the first command followed by the prompt with nothing between. This is not really needed, for the first command I can look for just the ^done,value="\"FIRST COMMAND\"" string, then I can start looking for the output of the second command. So long as the second pattern matches up to the gdb prompt, then I can be sure than nothing is left over in the expect buffer to muck up later matches. As to see the second command output gdb must have read in the second command, the second command output never suffers from the corruption that the first command output does. Since making this change, I've not seen a failure in this test. --- gdb/testsuite/gdb.mi/mi-multi-commands.exp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp index 767d1d0f679..12b1b482f9a 100644 --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp @@ -54,7 +54,7 @@ proc run_test { args } { set cmd "" # Create a command that is at least `i` characters long. - set first_cmd "print \$a" + set first_cmd "-data-evaluate-expression \$a" while { [string length $first_cmd] < $i } { set first_cmd " $first_cmd" } @@ -69,7 +69,7 @@ proc run_test { args } { set i [string length $first_cmd] verbose -log "length of first command is $i" - set cmd "${first_cmd}\nprint \$b\n" + set cmd "${first_cmd}\n-data-evaluate-expression \$b\n" # We need to call send_gdb ourselves here as gdb_test_multiple # will try to send each line of the command separately (breaking @@ -100,14 +100,14 @@ 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 "(&\"print \\\$\[ab\]\\\\n\")\r\n(~\"\\\$$decimal = \\\\\"FIRST COMMAND\\\\\"\[^\r\n\]+\r\n\\^done\r\n$mi_gdb_prompt)" { + -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"\r\n" { pass $gdb_test_name set seen_first_message true } } gdb_test_multiple "" "look for second command output, command length $i" -prompt "$mi_gdb_prompt" { - -re "(&\"print \\\$\[ab\]\\\\n\")\r\n(~\"\\\$$decimal = \\\\\"TEST COMPLETE\\\\\"\[^\r\n\]+\r\n\\^done\r\n$mi_gdb_prompt)" { + -re "\\^done,value=\"\\\\\"TEST COMPLETE\\\\\"\"\r\n$mi_gdb_prompt" { pass $gdb_test_name set seen_second_message true } -- 2.25.4