From 91f595dda9d2f0cba59bb4e014bf552aa9b179d0 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 29 Mar 2015 15:37:51 -0700 Subject: [PATCH] tools: Add test cases for SSP and SC successful local OOB data --- doc/test-coverage.txt | 4 ++-- tools/mgmt-tester.c | 49 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/doc/test-coverage.txt b/doc/test-coverage.txt index c663697e2..06253c660 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 291 Kernel management interface testing +mgmt-tester 293 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 ----- - 355 + 357 Android end-to-end testing diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 98dce4e95..d99701036 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -397,6 +397,7 @@ struct generic_data { uint16_t send_len; const void * (*send_func)(uint16_t *len); uint8_t expect_status; + bool expect_ignore_param; const void *expect_param; uint16_t expect_len; const void * (*expect_func)(uint16_t *len); @@ -1382,6 +1383,10 @@ static const struct generic_data set_ssp_on_invalid_index_test = { static uint16_t settings_powered_ssp[] = { MGMT_OP_SET_SSP, MGMT_OP_SET_POWERED, 0 }; +static uint16_t settings_powered_sc[] = { MGMT_OP_SET_SSP, + MGMT_OP_SET_SECURE_CONN, + MGMT_OP_SET_POWERED, 0 }; + static const char set_sc_on_param[] = { 0x01 }; static const char set_sc_only_on_param[] = { 0x02 }; static const char set_sc_invalid_param[] = { 0x03 }; @@ -4472,6 +4477,22 @@ static const struct generic_data read_local_oob_legacy_pairing_test = { .expect_status = MGMT_STATUS_NOT_SUPPORTED, }; +static const struct generic_data read_local_oob_success_ssp_test = { + .setup_settings = settings_powered_ssp, + .send_opcode = MGMT_OP_READ_LOCAL_OOB_DATA, + .expect_status = MGMT_STATUS_SUCCESS, + .expect_ignore_param = true, + .expect_hci_command = BT_HCI_CMD_READ_LOCAL_OOB_DATA, +}; + +static const struct generic_data read_local_oob_success_sc_test = { + .setup_settings = settings_powered_sc, + .send_opcode = MGMT_OP_READ_LOCAL_OOB_DATA, + .expect_status = MGMT_STATUS_SUCCESS, + .expect_ignore_param = true, + .expect_hci_command = BT_HCI_CMD_READ_LOCAL_OOB_EXT_DATA, +}; + static void client_cmd_complete(uint16_t opcode, uint8_t status, const void *param, uint8_t len, void *user_data) @@ -5319,18 +5340,20 @@ static void command_generic_callback(uint8_t status, uint16_t length, return; } - if (test->expect_func) - expect_param = test->expect_func(&expect_len); + if (!test->expect_ignore_param) { + if (test->expect_func) + expect_param = test->expect_func(&expect_len); - if (length != expect_len) { - tester_test_failed(); - return; - } + if (length != expect_len) { + tester_test_failed(); + return; + } - if (expect_param && expect_len > 0 && - memcmp(param, expect_param, length)) { - tester_test_failed(); - return; + if (expect_param && expect_len > 0 && + memcmp(param, expect_param, length)) { + tester_test_failed(); + return; + } } test_condition_complete(data); @@ -6484,6 +6507,12 @@ int main(int argc, char *argv[]) test_bredr20("Read Local OOB Data - Legacy pairing", &read_local_oob_legacy_pairing_test, NULL, test_command_generic); + test_bredrle("Read Local OOB Data - Success SSP", + &read_local_oob_success_ssp_test, + NULL, test_command_generic); + test_bredrle("Read Local OOB Data - Success SC", + &read_local_oob_success_sc_test, + NULL, test_command_generic); return tester_run(); } -- 2.47.3