Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1524411pxj; Fri, 4 Jun 2021 17:34:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8uGL6Gkcc9Q06C1mhGBofqwuOBVNqHRuHgBUE4MLQthR/jIg2LorDGIjuH/ehOBUCIvSO X-Received: by 2002:a17:907:1112:: with SMTP id qu18mr6564166ejb.511.1622853287273; Fri, 04 Jun 2021 17:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622853287; cv=none; d=google.com; s=arc-20160816; b=Qdi84Cy4N4EwXBrLCU2U56DkLzwLomslZftsQKKqtK1WCOr68RE6BzaGVF27SqOBPK PkMWzw79kO3vMKh0pj7Mm/A85ZIyKe5C3AvJmM1M2Ia/ztAxABjRjFDkE42tB9ITrFC2 PnrrQ+kEV9RPiu0fO3g9CfbM4m6TV1MbfKCyt4amynnM6wkla5LjkqDs3I7syM7Toifk QlvI/XTybFiiGl1i8DlsMiVQK39E3mFZJuucnkhvEBz3ZolMPFA0tDWnh4ZNEqgS8u2P wyp7Z6F/yE/GhC7T4uyIs76LCYkTsdD4LehBP2gZdpfAayyuULbzCRgvGGfMJD78nQ7v BFlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WSMV+sMomjroZF0377wvSmU+pcLLvt39YLDOpyFW3Ac=; b=xItXGrRUUlt0lD5qwTrSOL9108QdJbl86x4cqjE1yUZcf3By4ZEWKscZE/5m663TOl 0xoCM5Dfi1GVusn+Lk3waRuvPzQMBYOpFyb8kF4pE5TDje/oe+7XQ8/pRRtz5Fm29Xum 6SSuvWcZ69I6H446TYIWdUmMX5dsmU6SDTrBCndUxQTxo157Wrc6Xtez9F5Bhv/hZzyv C7SwXZpQmaAKZg4Wqoz0rdZMiHouXh3+9wE/LnNUa0US6XlpDJ2RT4QKEwWRz5MqzjOA pQxWqhscVV5/djIpJR4JXPLuzVmT7HRMdIo3gn6PIc/Y1D3V5miz6nKJceuPbiLuKPMV 3/Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TXH0cX+y; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si5496064edr.251.2021.06.04.17.34.10; Fri, 04 Jun 2021 17:34:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TXH0cX+y; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbhFEAdl (ORCPT + 99 others); Fri, 4 Jun 2021 20:33:41 -0400 Received: from mail-yb1-f180.google.com ([209.85.219.180]:36816 "EHLO mail-yb1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbhFEAdk (ORCPT ); Fri, 4 Jun 2021 20:33:40 -0400 Received: by mail-yb1-f180.google.com with SMTP id s107so16106197ybi.3 for ; Fri, 04 Jun 2021 17:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WSMV+sMomjroZF0377wvSmU+pcLLvt39YLDOpyFW3Ac=; b=TXH0cX+y0stI012pk6ScmrMzc57a0ZMv4pcSzmm/E8bKQ3HShiOW5qQ7q4X2DZdwyo nsJg+UURMlD9VAmtYYjdnX+7pKFVqamAiuitZpCN0AW/kNooWkxd4WjP5vNxPXltGkth av0347xYZQpGvleeRkxxFsTzV2x1Maa/9+G1hyBVMD283xgtvUQ1b5I5uU1GKHBIis5P eIMjsKmu02i4oFfvRHoGNDJYBZordS/GNJMT7VIunVtwXfYAaYZgqB+4aYGKxm+HX5EV uRWWhOWYVmFQJbYTF1cHyCcw6iEz9JyI6cGJ3DwSaTlXWN5PX5KMampDQU9Vpwxt/f+4 C2qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WSMV+sMomjroZF0377wvSmU+pcLLvt39YLDOpyFW3Ac=; b=dxp+BXHGv3oFIBWd97U7AQaj9wzOOaTbUgnDyStu7Bi7AdKW97H2Jf9wzWa6Ez58qi R4PAG7bSe+kpKuvn9+bO9gitjw33Yn5426UH+7ucFisyLylMKb5F8+IjvwcdP3D2WIJe gNBMOwVKoARbmsOsQX5H20Yqt5aTnwUOzMFWEJs8stEjoVKr5vuPwFGZdTE46hbYIS1e ZHyrx5nJ9U3M4GTIvQIca+PIZMyw9iAexlMIUDoJ6bskGdhaH8suc7L0NZKEjhvQEqpq ePfmsYvWJuroHvaKx8NBeXnfssW6zcPIQr+SVc/0OxyEUC73VZZ2N0/KA3zL11/lOHpB lRKQ== X-Gm-Message-State: AOAM5336VEQekvYtEkhkRiZG+iHggOc58vajdeIPWd/5m9WvuYgKhgJ1 o9ziXXZ8jsEG+ygYfla46zTkHgxDO0H60pdTU4c= X-Received: by 2002:a25:4048:: with SMTP id n69mr9032893yba.91.1622853040390; Fri, 04 Jun 2021 17:30:40 -0700 (PDT) MIME-Version: 1.0 References: <20210604175913.256979-1-inga.stotland@intel.com> <5d31aebb39bc10584a71df894908e16104980985.camel@intel.com> In-Reply-To: <5d31aebb39bc10584a71df894908e16104980985.camel@intel.com> From: Luiz Augusto von Dentz Date: Fri, 4 Jun 2021 17:30:29 -0700 Message-ID: Subject: Re: [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting To: "An, Tedd" Cc: "linux-bluetooth@vger.kernel.org" , "Stotland, Inga" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Inga, On Fri, Jun 4, 2021 at 12:30 PM An, Tedd wrote: > > Hi Inga, > > On Fri, 2021-06-04 at 10:59 -0700, Inga Stotland wrote: > > This fixes test condition count in the expected HCI command > > callback. > > > > When the expected HCI opcode is detected, mark the condition > > as done. Any subsequent HCI commands are ignored. > > > > Without this fix, in couple of test cases where the expected HCI > > command is detected more than once, the test may be erroneously > > reported as a failure or prematurely declared as a success before > > waiting on an expected MGMT event condition. > > > > The test cases where this behavior is fixed: > > Remove Ext Advertising - Success 1 > > Remove Ext Advertising - Success 2 > > Reviewed-by: Tedd Ho-Jeong An > > > --- > > tools/mgmt-tester.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c > > index c5073fe2b..6109883ad 100644 > > --- a/tools/mgmt-tester.c > > +++ b/tools/mgmt-tester.c > > @@ -52,6 +52,7 @@ struct test_data { > > uint16_t mgmt_index; > > struct hciemu *hciemu; > > enum hciemu_type hciemu_type; > > + bool expect_hci_command_done; > > int unmet_conditions; > > int unmet_setup_conditions; > > int sk; > > @@ -7021,9 +7022,11 @@ static void command_hci_callback(uint16_t opcode, const void *param, > > > > tester_print("HCI Command 0x%04x length %u", opcode, length); > > > > - if (opcode != test->expect_hci_command || data->unmet_conditions <= 0) > > + if (opcode != test->expect_hci_command || data->expect_hci_command_done) > > return; > > > > + data->expect_hci_command_done = true; > > + > > if (test->expect_hci_func) > > expect_hci_param = test->expect_hci_func(&expect_hci_len); > > > > Regards, > Tedd Applied, thanks. -- Luiz Augusto von Dentz