OSDN Git Service

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

index 5e4138e..6fd6655 100644 (file)
@@ -1062,6 +1062,37 @@ static const char write_eir_uuid128_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_uuid128_multi_hci_2[] = { 0x00,
+                       0x02, 0x0a, 0x00, 0xe1, 0x07, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x01, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x02, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x03, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x04, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x05, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x06, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x07, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x08, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x09, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x0a, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x0b, 0x11, 0x22, 0x33,
+                       0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
+                       0xcc, 0xdd, 0xee, 0xff, 0x0c, 0xff, 0xee, 0xdd,
+                       0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55,
+                       0x44, 0x33, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
 static const struct generic_data add_uuid16_test_1 = {
        .send_opcode = MGMT_OP_ADD_UUID,
@@ -1159,6 +1190,18 @@ static const struct generic_data add_uuid128_multi_test_1 = {
        .expect_hci_len = sizeof(write_eir_uuid128_multi_hci),
 };
 
+static const struct generic_data add_uuid128_multi_test_2 = {
+       .send_opcode = MGMT_OP_ADD_UUID,
+       .send_param = add_uuid128_param_2,
+       .send_len = sizeof(add_uuid128_param_2),
+       .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_uuid128_multi_hci_2,
+       .expect_hci_len = sizeof(write_eir_uuid128_multi_hci_2),
+};
+
 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 };
@@ -1556,6 +1599,33 @@ static void setup_multi_uuid128(const void *test_data)
                                        setup_powered_callback, NULL, NULL);
 }
 
+static void setup_multi_uuid128_2(const void *test_data)
+{
+       struct test_data *data = tester_get_data();
+       unsigned char param[] = { 0x01 };
+       unsigned char uuid_param[] = {
+                       0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
+                       0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00,
+                       0x00 };
+       int i;
+
+       tester_print("Powering on controller (with many 128-bit UUIDs)");
+
+       mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index,
+                               sizeof(param), param, NULL, NULL, NULL);
+
+       for (i = 0; i < 13; i++) {
+               uuid_param[15] = i;
+               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_uuid16(const void *test_data)
 {
        struct test_data *data = tester_get_data();
@@ -2015,6 +2085,8 @@ int main(int argc, char *argv[])
                                setup_ssp, test_command_generic);
        test_bredr("Add UUID - UUID-128 multiple 1", &add_uuid128_multi_test_1,
                                setup_multi_uuid128, test_command_generic);
+       test_bredr("Add UUID - UUID-128 partial 1", &add_uuid128_multi_test_2,
+                               setup_multi_uuid128_2, test_command_generic);
 
        test_bredr("Load Link Keys - Empty List Success 1",
                        &load_link_keys_success_test_1, NULL,