From d376c0913f06bab9f112dfab63d9c14de1dd7f21 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 17 Jun 2014 15:11:44 +0300 Subject: [PATCH] tools/mgmt-tester: Add invalid IO capability tests --- tools/mgmt-tester.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index a71a1ca61..c99fe1838 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -2213,6 +2213,15 @@ static const struct generic_data load_ltks_invalid_params_test_3 = { .expect_status = MGMT_STATUS_INVALID_PARAMS, }; +static const char set_io_cap_invalid_param_1[] = { 0xff }; + +static const struct generic_data set_io_cap_invalid_param_test_1 = { + .send_opcode = MGMT_OP_SET_IO_CAPABILITY, + .send_param = set_io_cap_invalid_param_1, + .send_len = sizeof(set_io_cap_invalid_param_1), + .expect_status = MGMT_STATUS_INVALID_PARAMS, +}; + static const char pair_device_param[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00 }; static const char pair_device_rsp[] = { @@ -2221,6 +2230,10 @@ static const char pair_device_invalid_param_1[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff, 0x00 }; static const char pair_device_invalid_param_rsp_1[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff }; +static const char pair_device_invalid_param_2[] = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x05 }; +static const char pair_device_invalid_param_rsp_2[] = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00 }; static const struct generic_data pair_device_not_powered_test_1 = { .send_opcode = MGMT_OP_PAIR_DEVICE, @@ -2240,6 +2253,15 @@ static const struct generic_data pair_device_invalid_param_test_1 = { .expect_len = sizeof(pair_device_invalid_param_rsp_1), }; +static const struct generic_data pair_device_invalid_param_test_2 = { + .send_opcode = MGMT_OP_PAIR_DEVICE, + .send_param = pair_device_invalid_param_2, + .send_len = sizeof(pair_device_invalid_param_2), + .expect_status = MGMT_STATUS_INVALID_PARAMS, + .expect_param = pair_device_invalid_param_rsp_2, + .expect_len = sizeof(pair_device_invalid_param_rsp_2), +}; + static const void *pair_device_send_param_func(uint16_t *len) { struct test_data *data = tester_get_data(); @@ -4027,12 +4049,19 @@ int main(int argc, char *argv[]) &load_ltks_invalid_params_test_3, NULL, test_command_generic); + test_bredrle("Set IO Capability - Invalid Params 1", + &set_io_cap_invalid_param_test_1, + NULL, test_command_generic); + test_bredrle("Pair Device - Not Powered 1", &pair_device_not_powered_test_1, NULL, test_command_generic); test_bredrle("Pair Device - Invalid Parameters 1", &pair_device_invalid_param_test_1, NULL, test_command_generic); + test_bredrle("Pair Device - Invalid Parameters 2", + &pair_device_invalid_param_test_2, + NULL, test_command_generic); test_bredrle("Pair Device - Legacy Success 1", &pair_device_success_test_1, NULL, test_command_generic); -- 2.47.3