2015-03-28 19:53:59

by Arman Uguray

[permalink] [raw]
Subject: [PATCH v3 1/3] tools/mgmt-tester: Add new add-adv test cases

This patch adds new test cases for the Add Advertising command for the
following conditions:

- ADV_SCAN_IND, ADV_NONCONN_IND, and ADV_IND correctly configured based on the
global "connectable" setting and the instance scan response length.
- ADV_IND is used when the global "connectable" setting is "on" and instance
flags is 0.
---
tools/mgmt-tester.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 0721a64..b9be59e 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -4234,6 +4234,61 @@ static const struct generic_data add_advertising_success_12 = {
.expect_hci_len = sizeof(set_adv_data_8),
};

+static uint16_t settings_powered_le_connectable[] = {
+ MGMT_OP_SET_POWERED,
+ MGMT_OP_SET_LE,
+ MGMT_OP_SET_CONNECTABLE, 0 };
+
+static uint8_t set_connectable_off_scan_adv_param[] = {
+ 0x00, 0x08, /* min_interval */
+ 0x00, 0x08, /* max_interval */
+ 0x02, /* type */
+ 0x01, /* own_addr_type */
+ 0x00, /* direct_addr_type */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* direct_addr */
+ 0x07, /* channel_map */
+ 0x00, /* filter_policy */
+};
+
+static const struct generic_data add_advertising_success_13 = {
+ .setup_settings = settings_powered_le,
+ .send_opcode = MGMT_OP_ADD_ADVERTISING,
+ .send_param = add_advertising_param_2,
+ .send_len = sizeof(add_advertising_param_2),
+ .expect_param = advertising_instance_param,
+ .expect_len = sizeof(advertising_instance_param),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .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),
+};
+
+static const struct generic_data add_advertising_success_14 = {
+ .setup_settings = settings_powered_le,
+ .send_opcode = MGMT_OP_ADD_ADVERTISING,
+ .send_param = add_advertising_param_1,
+ .send_len = sizeof(add_advertising_param_1),
+ .expect_param = advertising_instance_param,
+ .expect_len = sizeof(advertising_instance_param),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .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),
+};
+
+static const struct generic_data add_advertising_success_15 = {
+ .setup_settings = settings_powered_le_connectable,
+ .send_opcode = MGMT_OP_ADD_ADVERTISING,
+ .send_param = add_advertising_param_1,
+ .send_len = sizeof(add_advertising_param_1),
+ .expect_param = advertising_instance_param,
+ .expect_len = sizeof(advertising_instance_param),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
+ .expect_hci_param = set_connectable_on_adv_param,
+ .expect_hci_len = sizeof(set_connectable_on_adv_param),
+};
+
static const char set_powered_off_le_settings_param[] = {
0x80, 0x02, 0x00, 0x00
};
@@ -6201,6 +6256,15 @@ int main(int argc, char *argv[])
test_bredrle("Add Advertising - Success 9 - Flag 4",
&add_advertising_success_12,
NULL, test_command_generic);
+ test_bredrle("Add Advertising - Success 10 - ADV_SCAN_IND",
+ &add_advertising_success_13,
+ NULL, test_command_generic);
+ test_bredrle("Add Advertising - Success 11 - ADV_NONCONN_IND",
+ &add_advertising_success_14,
+ NULL, test_command_generic);
+ test_bredrle("Add Advertising - Success 12 - ADV_IND",
+ &add_advertising_success_15,
+ NULL, test_command_generic);

test_bredrle("Remove Advertising - Invalid Params 1",
&remove_advertising_fail_1,
--
2.2.0.rc0.207.ga3a616c



2015-03-28 21:32:00

by Arman Uguray

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] tools/mgmt-tester: Add new add-adv test cases

Hi,

> On Sat, Mar 28, 2015 at 12:53 PM, Arman Uguray <[email protected]> wrote:
> This patch adds new test cases for the Add Advertising command for the
> following conditions:
>
> - ADV_SCAN_IND, ADV_NONCONN_IND, and ADV_IND correctly configured based on the
> global "connectable" setting and the instance scan response length.
> - ADV_IND is used when the global "connectable" setting is "on" and instance
> flags is 0.
> ---
> tools/mgmt-tester.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
> index 0721a64..b9be59e 100644
> --- a/tools/mgmt-tester.c
> +++ b/tools/mgmt-tester.c
> @@ -4234,6 +4234,61 @@ static const struct generic_data add_advertising_success_12 = {
> .expect_hci_len = sizeof(set_adv_data_8),
> };
>
> +static uint16_t settings_powered_le_connectable[] = {
> + MGMT_OP_SET_POWERED,
> + MGMT_OP_SET_LE,
> + MGMT_OP_SET_CONNECTABLE, 0 };
> +
> +static uint8_t set_connectable_off_scan_adv_param[] = {
> + 0x00, 0x08, /* min_interval */
> + 0x00, 0x08, /* max_interval */
> + 0x02, /* type */
> + 0x01, /* own_addr_type */
> + 0x00, /* direct_addr_type */
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* direct_addr */
> + 0x07, /* channel_map */
> + 0x00, /* filter_policy */
> +};
> +
> +static const struct generic_data add_advertising_success_13 = {
> + .setup_settings = settings_powered_le,
> + .send_opcode = MGMT_OP_ADD_ADVERTISING,
> + .send_param = add_advertising_param_2,
> + .send_len = sizeof(add_advertising_param_2),
> + .expect_param = advertising_instance_param,
> + .expect_len = sizeof(advertising_instance_param),
> + .expect_status = MGMT_STATUS_SUCCESS,
> + .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),
> +};
> +
> +static const struct generic_data add_advertising_success_14 = {
> + .setup_settings = settings_powered_le,
> + .send_opcode = MGMT_OP_ADD_ADVERTISING,
> + .send_param = add_advertising_param_1,
> + .send_len = sizeof(add_advertising_param_1),
> + .expect_param = advertising_instance_param,
> + .expect_len = sizeof(advertising_instance_param),
> + .expect_status = MGMT_STATUS_SUCCESS,
> + .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),
> +};
> +
> +static const struct generic_data add_advertising_success_15 = {
> + .setup_settings = settings_powered_le_connectable,
> + .send_opcode = MGMT_OP_ADD_ADVERTISING,
> + .send_param = add_advertising_param_1,
> + .send_len = sizeof(add_advertising_param_1),
> + .expect_param = advertising_instance_param,
> + .expect_len = sizeof(advertising_instance_param),
> + .expect_status = MGMT_STATUS_SUCCESS,
> + .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
> + .expect_hci_param = set_connectable_on_adv_param,
> + .expect_hci_len = sizeof(set_connectable_on_adv_param),
> +};
> +
> static const char set_powered_off_le_settings_param[] = {
> 0x80, 0x02, 0x00, 0x00
> };
> @@ -6201,6 +6256,15 @@ int main(int argc, char *argv[])
> test_bredrle("Add Advertising - Success 9 - Flag 4",
> &add_advertising_success_12,
> NULL, test_command_generic);
> + test_bredrle("Add Advertising - Success 10 - ADV_SCAN_IND",
> + &add_advertising_success_13,
> + NULL, test_command_generic);
> + test_bredrle("Add Advertising - Success 11 - ADV_NONCONN_IND",
> + &add_advertising_success_14,
> + NULL, test_command_generic);
> + test_bredrle("Add Advertising - Success 12 - ADV_IND",
> + &add_advertising_success_15,
> + NULL, test_command_generic);
>
> test_bredrle("Remove Advertising - Invalid Params 1",
> &remove_advertising_fail_1,
> --
> 2.2.0.rc0.207.ga3a616c
>

The 3 patches in this series have been applied.

Thanks,
Arman

2015-03-28 19:54:01

by Arman Uguray

[permalink] [raw]
Subject: [PATCH v3 3/3] doc/test-coverage.txt: Update mgmt-tester test count

---
doc/test-coverage.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/test-coverage.txt b/doc/test-coverage.txt
index 268d310..ef84b0d 100644
--- a/doc/test-coverage.txt
+++ b/doc/test-coverage.txt
@@ -40,7 +40,7 @@ Automated end-to-end testing

Application Count Description
-------------------------------------------
-mgmt-tester 274 Kernel management interface testing
+mgmt-tester 279 Kernel management interface testing
l2cap-tester 27 Kernel L2CAP implementation testing
rfcomm-tester 9 Kernel RFCOMM implementation testing
smp-tester 5 Kernel SMP implementation testing
@@ -48,7 +48,7 @@ sco-tester 8 Kernel SCO implementation testing
gap-tester 1 Daemon D-Bus API testing
hci-tester 14 Controller hardware testing
-----
- 338
+ 343


Android end-to-end testing
--
2.2.0.rc0.207.ga3a616c


2015-03-28 19:54:00

by Arman Uguray

[permalink] [raw]
Subject: [PATCH v3 2/3] tools/mgmt-tester: Test cases for connectable state change

This patch adds test cases for correctly updating the advertising type
when the global connectable setting changes.
---
tools/mgmt-tester.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index b9be59e..5b11cb7 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -4289,6 +4289,33 @@ static const struct generic_data add_advertising_success_15 = {
.expect_hci_len = sizeof(set_connectable_on_adv_param),
};

+static const char set_connectable_settings_param_3[] = {
+ 0x83, 0x02, 0x00, 0x00 };
+
+static const struct generic_data add_advertising_success_16 = {
+ .send_opcode = MGMT_OP_SET_CONNECTABLE,
+ .send_param = set_connectable_on_param,
+ .send_len = sizeof(set_connectable_on_param),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .expect_param = set_connectable_settings_param_3,
+ .expect_len = sizeof(set_connectable_settings_param_3),
+ .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
+ .expect_hci_param = set_connectable_on_adv_param,
+ .expect_hci_len = sizeof(set_connectable_on_adv_param),
+};
+
+static const struct generic_data add_advertising_success_17 = {
+ .send_opcode = MGMT_OP_SET_CONNECTABLE,
+ .send_param = set_connectable_off_param,
+ .send_len = sizeof(set_connectable_off_param),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .expect_param = set_le_settings_param_2,
+ .expect_len = sizeof(set_le_settings_param_2),
+ .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),
+};
+
static const char set_powered_off_le_settings_param[] = {
0x80, 0x02, 0x00, 0x00
};
@@ -4779,6 +4806,45 @@ static void setup_add_advertising(const void *test_data)
NULL, NULL);
}

+static void setup_add_advertising_connectable(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct mgmt_cp_add_advertising *cp;
+ unsigned char adv_param[sizeof(*cp) + 6];
+ unsigned char param[] = { 0x01 };
+
+ tester_print("Adding advertising instance while unpowered");
+
+ cp = (struct mgmt_cp_add_advertising *) adv_param;
+ memset(cp, 0, sizeof(*cp));
+
+ cp->instance = 1;
+ cp->adv_data_len = 6;
+ cp->data[0] = 0x05;
+ cp->data[1] = 0x08;
+ cp->data[2] = 't';
+ cp->data[3] = 'e';
+ cp->data[4] = 's';
+ cp->data[5] = 't';
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_LE, data->mgmt_index,
+ sizeof(param), &param,
+ NULL, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index,
+ sizeof(param), &param,
+ NULL, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_CONNECTABLE, data->mgmt_index,
+ sizeof(param), &param,
+ NULL, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_ADD_ADVERTISING, data->mgmt_index,
+ sizeof(adv_param), adv_param,
+ setup_add_advertising_callback,
+ NULL, NULL);
+}
+
static void setup_add_advertising_timeout(const void *test_data)
{
struct test_data *data = tester_get_data();
@@ -6265,6 +6331,14 @@ int main(int argc, char *argv[])
test_bredrle("Add Advertising - Success 12 - ADV_IND",
&add_advertising_success_15,
NULL, test_command_generic);
+ test_bredrle("Add Advertising - Success 13 - connectable -> on",
+ &add_advertising_success_16,
+ setup_add_advertising,
+ test_command_generic);
+ test_bredrle("Add Advertising - Success 14 - connectable -> off",
+ &add_advertising_success_17,
+ setup_add_advertising_connectable,
+ test_command_generic);

test_bredrle("Remove Advertising - Invalid Params 1",
&remove_advertising_fail_1,
--
2.2.0.rc0.207.ga3a616c