All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting
@ 2021-06-04 17:59 Inga Stotland
  2021-06-04 18:27 ` [BlueZ,v2] " bluez.test.bot
  2021-06-04 19:29 ` [PATCH BlueZ v2] " An, Tedd
  0 siblings, 2 replies; 4+ messages in thread
From: Inga Stotland @ 2021-06-04 17:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, tedd.an, Inga Stotland

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
---
 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);
 
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,v2] tools/mgmt-tester: Fix expected HCI command accounting
  2021-06-04 17:59 [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting Inga Stotland
@ 2021-06-04 18:27 ` bluez.test.bot
  2021-06-04 19:29 ` [PATCH BlueZ v2] " An, Tedd
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-06-04 18:27 UTC (permalink / raw)
  To: linux-bluetooth, inga.stotland

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=494317

---Test result---

Test Summary:
CheckPatch                    PASS      0.28 seconds
GitLint                       PASS      0.12 seconds
Prep - Setup ELL              PASS      44.81 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      7.89 seconds
Build - Make                  PASS      193.07 seconds
Make Check                    PASS      9.48 seconds
Make Distcheck                PASS      230.13 seconds
Build w/ext ELL - Configure   PASS      7.87 seconds
Build w/ext ELL - Make        PASS      180.65 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting
  2021-06-04 17:59 [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting Inga Stotland
  2021-06-04 18:27 ` [BlueZ,v2] " bluez.test.bot
@ 2021-06-04 19:29 ` An, Tedd
  2021-06-05  0:30   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: An, Tedd @ 2021-06-04 19:29 UTC (permalink / raw)
  To: linux-bluetooth, Stotland, Inga; +Cc: luiz.dentz

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 <tedd.an@intel.com>

> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting
  2021-06-04 19:29 ` [PATCH BlueZ v2] " An, Tedd
@ 2021-06-05  0:30   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-06-05  0:30 UTC (permalink / raw)
  To: An, Tedd; +Cc: linux-bluetooth, Stotland, Inga

Hi Inga,

On Fri, Jun 4, 2021 at 12:30 PM An, Tedd <tedd.an@intel.com> 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 <tedd.an@intel.com>
>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-05  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 17:59 [PATCH BlueZ v2] tools/mgmt-tester: Fix expected HCI command accounting Inga Stotland
2021-06-04 18:27 ` [BlueZ,v2] " bluez.test.bot
2021-06-04 19:29 ` [PATCH BlueZ v2] " An, Tedd
2021-06-05  0:30   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.