OSDN Git Service

tools: Add partial UUID-32 test case to mgmt-tester
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 24 Jan 2013 17:36:48 +0000 (19:36 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 24 Jan 2013 17:36:48 +0000 (19:36 +0200)
tools/mgmt-tester.c

index b69b131..5e4138e 100644 (file)
@@ -961,7 +961,37 @@ static const char write_eir_uuid32_multi_hci[] = { 0x00,
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
+static const char write_eir_uuid32_multi_hci_2[] = { 0x00,
+                       0x02, 0x0a, 0x00, 0xe9, 0x04, 0xff, 0xff, 0xff,
+                       0xff, 0xfe, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff,
+                       0xff, 0xfc, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff,
+                       0xff, 0xfa, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff,
+                       0xff, 0xf8, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff,
+                       0xff, 0xf6, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff,
+                       0xff, 0xf4, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff,
+                       0xff, 0xf2, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff,
+                       0xff, 0xf0, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff,
+                       0xff, 0xee, 0xff, 0xff, 0xff, 0xed, 0xff, 0xff,
+                       0xff, 0xec, 0xff, 0xff, 0xff, 0xeb, 0xff, 0xff,
+                       0xff, 0xea, 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff,
+                       0xff, 0xe8, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff,
+                       0xff, 0xe6, 0xff, 0xff, 0xff, 0xe5, 0xff, 0xff,
+                       0xff, 0xe4, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff,
+                       0xff, 0xe2, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff,
+                       0xff, 0xe0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff,
+                       0xff, 0xde, 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff,
+                       0xff, 0xdc, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff,
+                       0xff, 0xda, 0xff, 0xff, 0xff, 0xd9, 0xff, 0xff,
+                       0xff, 0xd8, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff,
+                       0xff, 0xd6, 0xff, 0xff, 0xff, 0xd5, 0xff, 0xff,
+                       0xff, 0xd4, 0xff, 0xff, 0xff, 0xd3, 0xff, 0xff,
+                       0xff, 0xd2, 0xff, 0xff, 0xff, 0xd1, 0xff, 0xff,
+                       0xff, 0xd0, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff,
+                       0xff, 0xce, 0xff, 0xff, 0xff, 0xcd, 0xff, 0xff,
+                       0xff, 0xcc, 0xff, 0xff, 0xff, 0xcb, 0xff, 0xff,
+                       0xff, 0xca, 0xff, 0xff, 0xff, 0xc9, 0xff, 0xff,
+                       0xff, 0xc8, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff,
+                       0xff, 0xc6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 };
 static const char add_uuid128_param_1[] = {
                        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
                        0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
@@ -1093,6 +1123,18 @@ static const struct generic_data add_uuid32_multi_test_1 = {
        .expect_hci_len = sizeof(write_eir_uuid32_multi_hci),
 };
 
+static const struct generic_data add_uuid32_multi_test_2 = {
+       .send_opcode = MGMT_OP_ADD_UUID,
+       .send_param = add_uuid32_param_4,
+       .send_len = sizeof(add_uuid32_param_4),
+       .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_uuid32_multi_hci_2,
+       .expect_hci_len = sizeof(write_eir_uuid32_multi_hci_2),
+};
+
 static const struct generic_data add_uuid128_test_1 = {
        .send_opcode = MGMT_OP_ADD_UUID,
        .send_param = add_uuid128_param_1,
@@ -1467,6 +1509,34 @@ static void setup_multi_uuid32(const void *test_data)
                                        setup_powered_callback, NULL, NULL);
 }
 
+static void setup_multi_uuid32_2(const void *test_data)
+{
+       struct test_data *data = tester_get_data();
+       unsigned char param[] = { 0x01 };
+       unsigned char uuid_param[] = {
+                       0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+                       0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00 };
+       int i;
+
+       tester_print("Powering on controller (with many 32-bit UUIDs)");
+
+       mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index,
+                               sizeof(param), param, NULL, NULL, NULL);
+
+       for (i = 0; i < 58; i++) {
+               uint32_t val = htobl(0xffffffff - i);
+               memcpy(&uuid_param[12], &val, sizeof(val));
+               mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+                               sizeof(uuid_param), uuid_param,
+                               NULL, NULL, NULL);
+       }
+
+       mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index,
+                                       sizeof(param), param,
+                                       setup_powered_callback, NULL, NULL);
+}
+
 static void setup_multi_uuid128(const void *test_data)
 {
        struct test_data *data = tester_get_data();
@@ -1939,6 +2009,8 @@ int main(int argc, char *argv[])
                                test_command_generic);
        test_bredr("Add UUID - UUID-32 multiple 1", &add_uuid32_multi_test_1,
                                setup_multi_uuid32, test_command_generic);
+       test_bredr("Add UUID - UUID-32 partial 1", &add_uuid32_multi_test_2,
+                               setup_multi_uuid32_2, test_command_generic);
        test_bredr("Add UUID - UUID-128 1", &add_uuid128_test_1,
                                setup_ssp, test_command_generic);
        test_bredr("Add UUID - UUID-128 multiple 1", &add_uuid128_multi_test_1,