aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2023-08-19 16:31:23 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2023-08-21 11:24:51 -0700
commit70b4db6803b46d5f9ad08a3f72eef9186b25e50a (patch)
treead3363bede979daa700e9c51ca3d47bf41e9f228 /tools
parent465108814db2b7ba3037a83cb91f7de1cc2f7366 (diff)
iso-tester: add test for ACL disconnect before ISO created
Simulate ACL being disconnected when connecting ISO, before LE Create CIS got sent. The kernel shall indicate connection failure for the ISO socket immediately when the ACL is gone, since connecting the ISO can no longer proceed. ISO Connect ACL Disconnect - Failure
Diffstat (limited to 'tools')
-rw-r--r--tools/iso-tester.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 75edc4380b..410da2c930 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -2654,6 +2654,40 @@ static void test_connect_suspend(const void *test_data)
trigger_force_suspend((void *)test_data);
}
+static bool hook_acl_disc(const void *msg, uint16_t len, void *user_data)
+{
+ const uint8_t *msg_data = msg;
+ const struct bt_hci_evt_le_enhanced_conn_complete *ev;
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost;
+
+ if (msg_data[0] != BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE)
+ return true;
+
+ ev = (void *) &msg_data[1];
+
+ 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 ISO is created */
+ hciemu_add_hook(data->hciemu, HCIEMU_HOOK_POST_EVT,
+ BT_HCI_EVT_LE_META_EVENT,
+ hook_acl_disc, NULL);
+
+ test_connect(test_data);
+}
+
static void test_bcast(const void *test_data)
{
struct test_data *data = tester_get_data();
@@ -2876,6 +2910,10 @@ int main(int argc, char *argv[])
setup_powered,
test_connect2);
+ test_iso("ISO Connect ACL Disconnect - Failure", &connect_suspend,
+ setup_powered,
+ test_connect_acl_disc);
+
test_iso("ISO Defer Send - Success", &connect_16_2_1_defer_send,
setup_powered,
test_connect);