linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BlueZ PATCH 1/2] tools/mgmt-tester: Add test cases for set device id command
@ 2021-05-21  6:24 Tedd Ho-Jeong An
  2021-05-21  6:24 ` [BlueZ PATCH 2/2] tools/mgmt-tester: Add test cases for remove uuid command Tedd Ho-Jeong An
  2021-05-21  6:50 ` [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2021-05-21  6:24 UTC (permalink / raw)
  To: linux-bluetooth

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

This patch adds test cases for the Set Device ID command.
---
 tools/mgmt-tester.c | 163 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 163 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index de35008ad..e3523dcd5 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -5506,6 +5506,119 @@ static const struct generic_data adv_data_invalid_params = {
 	.expect_status = MGMT_STATUS_INVALID_PARAMS,
 };
 
+static const uint8_t set_dev_id_param_success_1[] = {
+	0x01, /* Source - 0x0001 (Bluetooth SIG) */
+	0x00,
+	0x02, /* Vendor */
+	0x00,
+	0xcd, /* Product */
+	0xab,
+	0x34,
+	0x12, /* Version */
+};
+
+static const char write_eir_set_dev_id_success_1[241] = {
+			0x00, 0x02, 0x0a, 0x00, 0x09, 0x10, 0x01, 0x00,
+			0x02, 0x00, 0xcd, 0xab, 0x34, 0x12 };
+
+static const struct generic_data set_dev_id_success_1 = {
+	.setup_settings = settings_powered_ssp,
+	.send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.send_param = set_dev_id_param_success_1,
+	.send_len = sizeof(set_dev_id_param_success_1),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_set_dev_id_success_1,
+	.expect_hci_len = sizeof(write_eir_set_dev_id_success_1),
+};
+
+static const uint8_t set_dev_id_param_success_2[] = {
+	0x02, /* Source - 0x0001 (Bluetooth SIG) */
+	0x00,
+	0x02, /* Vendor */
+	0x00,
+	0xcd, /* Product */
+	0xab,
+	0x34,
+	0x12, /* Version */
+};
+static const char write_eir_set_dev_id_success_2[241] = {
+			0x00, 0x02, 0x0a, 0x00, 0x09, 0x10, 0x02, 0x00,
+			0x02, 0x00, 0xcd, 0xab, 0x34, 0x12 };
+
+static const struct generic_data set_dev_id_success_2 = {
+	.setup_settings = settings_powered_ssp,
+	.send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.send_param = set_dev_id_param_success_2,
+	.send_len = sizeof(set_dev_id_param_success_2),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_set_dev_id_success_2,
+	.expect_hci_len = sizeof(write_eir_set_dev_id_success_2),
+};
+
+static const uint8_t set_dev_id_param_disable[8] = { 0x00 };
+
+static const struct generic_data set_dev_id_disable = {
+	.setup_settings = settings_powered_ssp,
+	.send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.send_param = set_dev_id_param_disable,
+	.send_len = sizeof(set_dev_id_param_disable),
+	.expect_status = MGMT_STATUS_SUCCESS,
+};
+
+static const struct generic_data set_dev_id_power_off_on = {
+	.setup_settings = settings_ssp,
+	.setup_send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.setup_send_param = set_dev_id_param_success_1,
+	.setup_send_len = sizeof(set_dev_id_param_success_1),
+	.send_opcode = MGMT_OP_SET_POWERED,
+	.send_param = set_powered_on_param,
+	.send_len = sizeof(set_powered_on_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_ssp_settings_param_2,
+	.expect_len = sizeof(set_ssp_settings_param_2),
+	.expect_settings_set = MGMT_SETTING_POWERED,
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_set_dev_id_success_1,
+	.expect_hci_len = sizeof(write_eir_set_dev_id_success_1),
+};
+
+static const struct generic_data set_dev_id_ssp_off_on = {
+	.setup_settings = settings_powered,
+	.setup_send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.setup_send_param = set_dev_id_param_success_1,
+	.setup_send_len = sizeof(set_dev_id_param_success_1),
+	.send_opcode = MGMT_OP_SET_SSP,
+	.send_param = set_ssp_on_param,
+	.send_len = sizeof(set_ssp_on_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_ssp_settings_param_2,
+	.expect_len = sizeof(set_ssp_settings_param_2),
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_set_dev_id_success_1,
+	.expect_hci_len = sizeof(write_eir_set_dev_id_success_1),
+};
+
+static const uint8_t set_dev_id_invalid_1[] = {
+	0x03, /* Source */
+	0x00,
+	0x02, /* Vendor */
+	0x00,
+	0xcd, /* Product */
+	0xab,
+	0x34,
+	0x12, /* Version */
+};
+
+static const struct generic_data set_dev_id_invalid_param = {
+	.setup_settings = settings_powered_ssp,
+	.send_opcode = MGMT_OP_SET_DEVICE_ID,
+	.send_param = set_dev_id_invalid_1,
+	.send_len = sizeof(set_dev_id_invalid_1),
+	.expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
 static void client_cmd_complete(uint16_t opcode, uint8_t status,
 					const void *param, uint8_t len,
 					void *user_data)
@@ -10697,5 +10810,55 @@ int main(int argc, char *argv[])
 				setup_ext_adv_params,
 				test_command_generic);
 
+	/* MGMT_OP_SET_DEVICE_ID
+	 * Using Bluetooth SIG for source.
+	 */
+	test_bredrle50("Set Device ID - Success 1",
+				&set_dev_id_success_1,
+				NULL,
+				test_command_generic);
+
+	/* MGMT_OP_SET_DEVICE_ID
+	 * Using SB Implementer's Forum for source.
+	 */
+	test_bredrle50("Set Device ID - Success 2",
+				&set_dev_id_success_2,
+				NULL,
+				test_command_generic);
+
+	/* MGMT_OP_SET_DEVICE_ID
+	 * Disable DID with disable flag for source.
+	 */
+	test_bredrle50("Set Device ID - Disable",
+				&set_dev_id_disable,
+				NULL,
+				test_command_generic);
+
+	/* MGMT_OP_SET_DEVICE_ID
+	 * Power off, set device id, and power on.
+	 * Expect Write_Extended_Inquiry with device id when power on.
+	 */
+	test_bredrle50("Set Device ID - Power off and Power on",
+				&set_dev_id_power_off_on,
+				setup_command_generic,
+				test_command_generic);
+
+	/* MGMT_OP_SET_DEVICE_ID
+	 * SSP off, set device id, and SSP on.
+	 * Expect Write_Extended_Inquiry with device id when SSP on.
+	 */
+	test_bredrle50("Set Device ID - SSP off and Power on",
+				&set_dev_id_ssp_off_on,
+				setup_command_generic,
+				test_command_generic);
+
+	/* MGMT_OP_SET_DEVICE_ID
+	 * Invalid parameter
+	 */
+	test_bredrle50("Set Device ID - Invalid Parameter",
+				&set_dev_id_invalid_param,
+				NULL,
+				test_command_generic);
+
 	return tester_run();
 }
-- 
2.26.3


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

* [BlueZ PATCH 2/2] tools/mgmt-tester: Add test cases for remove uuid command
  2021-05-21  6:24 [BlueZ PATCH 1/2] tools/mgmt-tester: Add test cases for set device id command Tedd Ho-Jeong An
@ 2021-05-21  6:24 ` Tedd Ho-Jeong An
  2021-05-21  6:50 ` [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command bluez.test.bot
  1 sibling, 0 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2021-05-21  6:24 UTC (permalink / raw)
  To: linux-bluetooth

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

This patch adds test cases for the Remove UUID command.
---
 tools/mgmt-tester.c | 143 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 143 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index e3523dcd5..973e5966f 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -2534,6 +2534,65 @@ static const struct generic_data add_uuid_mix_test_1 = {
 	.expect_hci_len = sizeof(write_eir_uuid_mix_hci),
 };
 
+static const char remove_dun_uuid_param[] = {
+			0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x03, 0x11, 0x00, 0x00 };
+
+static const char write_eir_remove_dun_hci[241] = {
+			0x00, 0x02, 0x0a, 0x00, 0x05, 0x03, 0x01, 0x11, 0x04,
+			0x11 };
+
+static const struct generic_data remove_uuid_success_1 = {
+	.send_opcode = MGMT_OP_REMOVE_UUID,
+	.send_param = remove_dun_uuid_param,
+	.send_len = sizeof(remove_dun_uuid_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_dev_class_zero_rsp,
+	.expect_len = sizeof(set_dev_class_zero_rsp),
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_remove_dun_hci,
+	.expect_hci_len = sizeof(write_eir_remove_dun_hci),
+};
+
+static const char remove_all_uuid_param[16] = { 0x00 };
+
+static const struct generic_data remove_uuid_all_success_2 = {
+	.send_opcode = MGMT_OP_REMOVE_UUID,
+	.send_param = remove_all_uuid_param,
+	.send_len = sizeof(remove_all_uuid_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_dev_class_zero_rsp,
+	.expect_len = sizeof(set_dev_class_zero_rsp),
+};
+
+static const struct generic_data remove_uuid_power_off_success_3 = {
+	.send_opcode = MGMT_OP_REMOVE_UUID,
+	.send_param = remove_dun_uuid_param,
+	.send_len = sizeof(remove_dun_uuid_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_dev_class_zero_rsp,
+	.expect_len = sizeof(set_dev_class_zero_rsp),
+};
+
+static const struct generic_data remove_uuid_power_off_on_success_4 = {
+	.send_opcode = MGMT_OP_SET_POWERED,
+	.send_param = set_powered_on_param,
+	.send_len = sizeof(set_powered_on_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_ssp_settings_param_2,
+	.expect_len = sizeof(set_ssp_settings_param_2),
+	.expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE,
+	.expect_hci_param = write_eir_remove_dun_hci,
+	.expect_hci_len = sizeof(write_eir_remove_dun_hci),
+};
+
+static const struct generic_data remove_uuid_invalid_params_1 = {
+	.send_opcode = MGMT_OP_REMOVE_UUID,
+	.send_param = add_opp_uuid_param,
+	.send_len = sizeof(add_opp_uuid_param),
+	.expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
 static const char load_link_keys_valid_param_1[] = { 0x00, 0x00, 0x00 };
 static const char load_link_keys_valid_param_2[] = { 0x01, 0x00, 0x00 };
 static const char load_link_keys_invalid_param_1[] = { 0x02, 0x00, 0x00 };
@@ -5893,6 +5952,56 @@ static void setup_multi_uuid16(const void *test_data)
 					setup_powered_callback, NULL, NULL);
 }
 
+static void setup_multi_uuid16_power_off(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	unsigned char param[] = { 0x01 };
+
+	tester_print("Adding UUIDs without powering on");
+
+	mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index,
+				sizeof(param), param, NULL, NULL, NULL);
+
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+				sizeof(add_spp_uuid_param), add_spp_uuid_param,
+				NULL, NULL, NULL);
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+				sizeof(add_dun_uuid_param), add_dun_uuid_param,
+				NULL, NULL, NULL);
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+			sizeof(add_sync_uuid_param), add_sync_uuid_param,
+			NULL, NULL, NULL);
+
+	setup_bthost();
+}
+
+static void setup_multi_uuid16_power_off_remove(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	unsigned char param[] = { 0x01 };
+
+	tester_print("Adding UUIDs without powering on and remove UUID");
+
+	mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index,
+				sizeof(param), param, NULL, NULL, NULL);
+
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+				sizeof(add_spp_uuid_param), add_spp_uuid_param,
+				NULL, NULL, NULL);
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+				sizeof(add_dun_uuid_param), add_dun_uuid_param,
+				NULL, NULL, NULL);
+	mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+			sizeof(add_sync_uuid_param), add_sync_uuid_param,
+			NULL, NULL, NULL);
+
+	mgmt_send(data->mgmt, MGMT_OP_REMOVE_UUID, data->mgmt_index,
+			sizeof(remove_dun_uuid_param), remove_dun_uuid_param,
+			NULL, NULL, NULL);
+
+	setup_bthost();
+}
+
 static void setup_multi_uuid16_2(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -9817,6 +9926,40 @@ int main(int argc, char *argv[])
 				&add_uuid_mix_test_1,
 				setup_uuid_mix, test_command_generic);
 
+	/* MGMT_OP_REMOVE_UUID
+	 * Remove existing UUID.
+	 */
+	test_bredrle("Remove UUID - Success 1",
+				&remove_uuid_success_1,
+				setup_multi_uuid16, test_command_generic);
+	/* MGMT_OP_REMOVE_UUID
+	 * Remove all UUID by sending zero filled UUID
+	 */
+	test_bredrle("Remove UUID - All UUID - Success 2",
+				&remove_uuid_all_success_2,
+				setup_multi_uuid16, test_command_generic);
+	/* MGMT_OP_REMOVE_UUID
+	 * Remove UUID while powering off
+	 * Expect the 0x000000 for the class of device
+	 */
+	test_bredrle("Remove UUID - Power Off - Success 3",
+				&remove_uuid_power_off_success_3,
+				setup_multi_uuid16_power_off,
+				test_command_generic);
+	/* MGMT_OP_REMOVE_UUID
+	 * Remove UUID while powering off and then powering on
+	 */
+	test_bredrle("Remove UUID - Power Off and On - Success 4",
+				&remove_uuid_power_off_on_success_4,
+				setup_multi_uuid16_power_off_remove,
+				test_command_generic);
+	/* MGMT_OP_REMOVE_UUID
+	 * Remove UUID doesn't exist - Invalid parameter
+	 */
+	test_bredrle("Remove UUID - Not Exist - Invalid Params 1",
+				&remove_uuid_invalid_params_1,
+				setup_multi_uuid16, test_command_generic);
+
 	test_bredrle("Load Link Keys - Empty List Success 1",
 				&load_link_keys_success_test_1,
 				NULL, test_command_generic);
-- 
2.26.3


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

* RE: [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command
  2021-05-21  6:24 [BlueZ PATCH 1/2] tools/mgmt-tester: Add test cases for set device id command Tedd Ho-Jeong An
  2021-05-21  6:24 ` [BlueZ PATCH 2/2] tools/mgmt-tester: Add test cases for remove uuid command Tedd Ho-Jeong An
@ 2021-05-21  6:50 ` bluez.test.bot
  2021-05-21 23:53   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-05-21  6:50 UTC (permalink / raw)
  To: linux-bluetooth, hj.tedd.an

[-- 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=486249

---Test result---

Test Summary:
CheckPatch                    PASS      0.98 seconds
GitLint                       PASS      0.20 seconds
Prep - Setup ELL              PASS      40.17 seconds
Build - Prep                  PASS      0.10 seconds
Build - Configure             PASS      7.08 seconds
Build - Make                  PASS      172.77 seconds
Make Check                    PASS      9.30 seconds
Make Distcheck                PASS      203.34 seconds
Build w/ext ELL - Configure   PASS      7.13 seconds
Build w/ext ELL - Make        PASS      162.09 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: [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command
  2021-05-21  6:50 ` [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command bluez.test.bot
@ 2021-05-21 23:53   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-21 23:53 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: Tedd Ho-Jeong An

Hi Tedd,

On Fri, May 21, 2021 at 11:26 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=486249
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      0.98 seconds
> GitLint                       PASS      0.20 seconds
> Prep - Setup ELL              PASS      40.17 seconds
> Build - Prep                  PASS      0.10 seconds
> Build - Configure             PASS      7.08 seconds
> Build - Make                  PASS      172.77 seconds
> Make Check                    PASS      9.30 seconds
> Make Distcheck                PASS      203.34 seconds
> Build w/ext ELL - Configure   PASS      7.13 seconds
> Build w/ext ELL - Make        PASS      162.09 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

Applied, thanks.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2021-05-21 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-21  6:24 [BlueZ PATCH 1/2] tools/mgmt-tester: Add test cases for set device id command Tedd Ho-Jeong An
2021-05-21  6:24 ` [BlueZ PATCH 2/2] tools/mgmt-tester: Add test cases for remove uuid command Tedd Ho-Jeong An
2021-05-21  6:50 ` [BlueZ,1/2] tools/mgmt-tester: Add test cases for set device id command bluez.test.bot
2021-05-21 23:53   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).