diff options
author | Pauli Virtanen <pav@iki.fi> | 2023-08-19 16:31:22 +0300 |
---|---|---|
committer | Ayush Garg <ayush.garg@samsung.com> | 2024-01-05 19:04:03 +0530 |
commit | 66514cf00e3f16d6f901ca1d896efc9f8668fb38 (patch) | |
tree | 14489102357f24a9d944b0420cbc7f95804a4893 | |
parent | ab989164531e7f91dd43031424c601c30088c537 (diff) | |
download | bluez-66514cf00e3f16d6f901ca1d896efc9f8668fb38.tar.gz bluez-66514cf00e3f16d6f901ca1d896efc9f8668fb38.tar.bz2 bluez-66514cf00e3f16d6f901ca1d896efc9f8668fb38.zip |
sco-tester: add test for ACL disconnect before SCO established
Simulate ACL being disconnected before SCO is established. Kernel shall
not crash.
eSCO ACL Disconnect - Failure
Link: https://lore.kernel.org/linux-bluetooth/00000000000013b93805fbbadc50@google.com/
-rwxr-xr-x | tools/sco-tester.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/sco-tester.c b/tools/sco-tester.c index f3de42c7..ecc65e09 100755 --- a/tools/sco-tester.c +++ b/tools/sco-tester.c @@ -800,6 +800,36 @@ static void test_connect_simult_disc(const void *test_data) test_connect(test_data); } +static bool hook_acl_disc(const void *msg, uint16_t len, void *user_data) +{ + const struct bt_hci_evt_conn_complete *ev = msg; + struct test_data *data = tester_get_data(); + struct bthost *bthost; + + tester_print("Disconnect ACL"); + + bthost = hciemu_client_get_host(data->hciemu); + bthost_hci_disconnect(bthost, le16_to_cpu(ev->handle), 0x13); + + hciemu_flush_client_events(data->hciemu); + + return true; +} + +static void test_connect_acl_disc(const void *test_data) +{ + struct test_data *data = tester_get_data(); + + /* ACL disconnected before SCO is established seen. + * Kernel shall not crash, but <= 6.5-rc5 crash. + */ + hciemu_add_hook(data->hciemu, HCIEMU_HOOK_POST_EVT, + BT_HCI_EVT_CONN_COMPLETE, + hook_acl_disc, NULL); + + test_connect(test_data); +} + int main(int argc, char *argv[]) { tester_init(&argc, &argv); @@ -826,6 +856,10 @@ int main(int argc, char *argv[]) &connect_failure_reset, setup_powered, test_connect_simult_disc); + test_sco("eSCO ACL Disconnect - Failure", + &connect_failure_reset, setup_powered, + test_connect_acl_disc); + test_sco_11("SCO CVSD 1.1 - Success", &connect_success, setup_powered, test_connect); |