All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] tools/mgmt-tester: Add callback routine for validating the parameter
@ 2021-04-10  6:46 Tedd Ho-Jeong An
  2021-04-10  6:46 ` [PATCH BlueZ 2/2] tools/mgmt-tester: Add param check callback for LE Set Adv Params Tedd Ho-Jeong An
  2021-04-10  7:09 ` [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2021-04-10  6:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch adds a callback routine for validating the received HCI
parameter, so it can customize to compare the parameters instead of
memcmp the full length.
---
 tools/mgmt-tester.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 1835ca079..ef37f0e03 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -280,6 +280,7 @@ struct generic_data {
 	uint16_t expect_alt_ev_len;
 	uint16_t expect_hci_command;
 	const void *expect_hci_param;
+	int (*expect_hci_param_check_func)(const void *param, uint16_t length);
 	uint8_t expect_hci_len;
 	const void * (*expect_hci_func)(uint8_t *len);
 	bool expect_pin;
@@ -6632,6 +6633,7 @@ static void command_hci_callback(uint16_t opcode, const void *param,
 	const struct generic_data *test = data->test_data;
 	const void *expect_hci_param = test->expect_hci_param;
 	uint8_t expect_hci_len = test->expect_hci_len;
+	int ret;
 
 	tester_print("HCI Command 0x%04x length %u", opcode, length);
 
@@ -6647,7 +6649,11 @@ static void command_hci_callback(uint16_t opcode, const void *param,
 		return;
 	}
 
-	if (memcmp(param, expect_hci_param, length) != 0) {
+	if (test->expect_hci_param_check_func)
+		ret = test->expect_hci_param_check_func(param, length);
+	else
+		ret = memcmp(param, expect_hci_param, length);
+	if (ret != 0) {
 		tester_warn("Unexpected HCI command parameter value:");
 		util_hexdump('>', param, length, print_debug, "");
 		util_hexdump('!', expect_hci_param, length, print_debug, "");
-- 
2.25.1


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

* [PATCH BlueZ 2/2] tools/mgmt-tester: Add param check callback for LE Set Adv Params
  2021-04-10  6:46 [PATCH BlueZ 1/2] tools/mgmt-tester: Add callback routine for validating the parameter Tedd Ho-Jeong An
@ 2021-04-10  6:46 ` Tedd Ho-Jeong An
  2021-04-10  7:09 ` [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter bluez.test.bot
  1 sibling, 0 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2021-04-10  6:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Tedd Ho-Jeong An <tedd.an@intel.com>

The interval_min and interval_max in LE Set Advertising Parameters
command are changed/updated often whenever the values are tuned in the
kernel, and it causes some tests failure.

This patch adds a parameter check callback for LE Set Advertising
Parameters command to ignore the interval_min and interval_max
parameters.
---
 tools/mgmt-tester.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index ef37f0e03..b05ae4f27 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -910,6 +910,20 @@ static uint8_t set_connectable_off_scan_adv_param[] = {
 		0x00,					/* filter_policy */
 };
 
+static int set_connectable_off_scan_adv_check_func(const void *param,
+								uint16_t length)
+{
+	const uint8_t *received = param;
+	uint8_t *expected = set_connectable_off_scan_adv_param;
+
+	/* Compare the received param with expected param, but ignore the
+	 * min_internal and max_interval since these values are turned often
+	 * in the kernel and we don't want to update the expected value every
+	 * time.
+	 */
+	return memcmp(&received[4], &expected[4], length - 4);
+}
+
 static const struct generic_data set_connectable_off_le_test_2 = {
 	.setup_settings = settings_powered_le_connectable_advertising,
 	.send_opcode = MGMT_OP_SET_CONNECTABLE,
@@ -922,6 +936,7 @@ static const struct generic_data set_connectable_off_le_test_2 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_scan_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_scan_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_scan_adv_check_func
 };
 
 static uint16_t settings_powered_le_discoverable[] = {
@@ -949,6 +964,7 @@ static const struct generic_data set_connectable_off_le_test_3 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_scan_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_scan_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_scan_adv_check_func
 };
 
 static const struct generic_data set_connectable_off_le_test_4 = {
@@ -964,6 +980,7 @@ static const struct generic_data set_connectable_off_le_test_4 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_scan_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_scan_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_scan_adv_check_func
 };
 
 static const char set_fast_conn_on_param[] = { 0x01 };
@@ -4750,6 +4767,7 @@ static const struct generic_data add_advertising_success_13 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_scan_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_scan_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_scan_adv_check_func
 };
 
 static uint8_t set_connectable_off_adv_param[] = {
@@ -4763,6 +4781,20 @@ static uint8_t set_connectable_off_adv_param[] = {
 		0x00,					/* filter_policy */
 };
 
+static int set_connectable_off_adv_check_func(const void *param,
+								uint16_t length)
+{
+	const uint8_t *received = param;
+	uint8_t *expected = set_connectable_off_adv_param;
+
+	/* Compare the received param with expected param, but ignore the
+	 * min_internal and max_interval since these values are turned often
+	 * in the kernel and we don't want to update the expected value every
+	 * time.
+	 */
+	return memcmp(&received[4], &expected[4], length - 4);
+}
+
 static const struct generic_data add_advertising_success_14 = {
 	.setup_settings = settings_powered_le,
 	.send_opcode = MGMT_OP_ADD_ADVERTISING,
@@ -4774,6 +4806,7 @@ static const struct generic_data add_advertising_success_14 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_adv_check_func
 };
 
 static const struct generic_data add_advertising_success_15 = {
@@ -4814,6 +4847,7 @@ static const struct generic_data add_advertising_success_17 = {
 	.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
 	.expect_hci_param = set_connectable_off_adv_param,
 	.expect_hci_len = sizeof(set_connectable_off_adv_param),
+	.expect_hci_param_check_func = set_connectable_off_adv_check_func
 };
 
 static const char set_powered_off_le_settings_param[] = {
-- 
2.25.1


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

* RE: [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter
  2021-04-10  6:46 [PATCH BlueZ 1/2] tools/mgmt-tester: Add callback routine for validating the parameter Tedd Ho-Jeong An
  2021-04-10  6:46 ` [PATCH BlueZ 2/2] tools/mgmt-tester: Add param check callback for LE Set Adv Params Tedd Ho-Jeong An
@ 2021-04-10  7:09 ` bluez.test.bot
  2021-04-12 17:27   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-04-10  7:09 UTC (permalink / raw)
  To: linux-bluetooth, hj.tedd.an

[-- Attachment #1: Type: text/plain, Size: 2296 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=464847

---Test result---

Test Summary:
CheckPatch                    PASS      0.54 seconds
GitLint                       PASS      0.23 seconds
Prep - Setup ELL              PASS      48.52 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      8.49 seconds
Build - Make                  PASS      204.22 seconds
Make Check                    PASS      9.82 seconds
Make Dist                     PASS      13.24 seconds
Make Dist - Configure         PASS      5.31 seconds
Make Dist - Make              PASS      85.07 seconds
Build w/ext ELL - Configure   PASS      8.76 seconds
Build w/ext ELL - Make        PASS      197.17 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 Dist - PASS
Desc: Run 'make dist' and build the distribution tarball

##############################
Test: Make Dist - Configure - PASS
Desc: Configure the source from distribution tarball

##############################
Test: Make Dist - Make - PASS
Desc: Build the source from distribution tarball

##############################
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: [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter
  2021-04-10  7:09 ` [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter bluez.test.bot
@ 2021-04-12 17:27   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-04-12 17:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Tedd Ho-Jeong An

Hi Tedd,

On Sat, Apr 10, 2021 at 12:11 AM <bluez.test.bot@gmail.com> wrote:
>
> 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=464847
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      0.54 seconds
> GitLint                       PASS      0.23 seconds
> Prep - Setup ELL              PASS      48.52 seconds
> Build - Prep                  PASS      0.11 seconds
> Build - Configure             PASS      8.49 seconds
> Build - Make                  PASS      204.22 seconds
> Make Check                    PASS      9.82 seconds
> Make Dist                     PASS      13.24 seconds
> Make Dist - Configure         PASS      5.31 seconds
> Make Dist - Make              PASS      85.07 seconds
> Build w/ext ELL - Configure   PASS      8.76 seconds
> Build w/ext ELL - Make        PASS      197.17 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 Dist - PASS
> Desc: Run 'make dist' and build the distribution tarball
>
> ##############################
> Test: Make Dist - Configure - PASS
> Desc: Configure the source from distribution tarball
>
> ##############################
> Test: Make Dist - Make - PASS
> Desc: Build the source from distribution tarball
>
> ##############################
> 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

Applied, thanks.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2021-04-12 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10  6:46 [PATCH BlueZ 1/2] tools/mgmt-tester: Add callback routine for validating the parameter Tedd Ho-Jeong An
2021-04-10  6:46 ` [PATCH BlueZ 2/2] tools/mgmt-tester: Add param check callback for LE Set Adv Params Tedd Ho-Jeong An
2021-04-10  7:09 ` [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter bluez.test.bot
2021-04-12 17:27   ` 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.