From 2c17c9929b62e4ab2ef51ddf51c4dc9334c0391b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 7 Nov 2025 10:40:42 -0500 Subject: [PATCH] iso-tester: Add tests for checking proper handling of Sync Lost This introduces the following tests to check if BIG/PA Sync Lost are handled properly: ISO Broadcaster Receiver Sync Lost - Success ISO Broadcaster PAST Receiver Sync Lost - Success --- tools/iso-tester.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 4bf1a287b..ff5c85ae4 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -502,6 +502,7 @@ struct iso_client_data { bool listen_bind; bool pa_bind; bool big; + bool terminate; /* Enable BT_PKT_SEQNUM for RX packet sequence numbers */ bool pkt_seqnum; @@ -1578,6 +1579,27 @@ static const struct iso_client_data bcast_16_2_1_recv_defer_get_base = { .base_len = sizeof(base_lc3_ac_12), }; +static const struct iso_client_data bcast_16_2_1_recv_terminate = { + .qos = QOS_IN_16_2_1, + .expect_err = 0, + .recv = &send_16_2_1, + .bcast = true, + .server = true, + .big = true, + .terminate = true, +}; + +static const struct iso_client_data past_16_2_1_recv_terminate = { + .qos = QOS_IN_16_2_1, + .expect_err = 0, + .recv = &send_16_2_1, + .bcast = true, + .past = true, + .server = true, + .big = true, + .terminate = true, +}; + static const struct iso_client_data bcast_ac_12 = { .qos = BCAST_AC_12, .expect_err = 0, @@ -2389,6 +2411,21 @@ static void iso_shutdown(struct test_data *data, GIOChannel *io) tester_print("Disconnecting..."); } +static void iso_terminate(struct test_data *data, GIOChannel *io) +{ + struct bthost *host; + + /* Setup watcher to check if fd is closed properly after termination */ + data->io_id[0] = g_io_add_watch(io, G_IO_HUP, iso_disconnected, data); + + tester_print("Terminating..."); + + host = hciemu_client_get_host(data->hciemu); + + bthost_set_pa_enable(host, 0x00); + bthost_terminate_big(host, BT_HCI_ERR_LOCAL_HOST_TERM); +} + static gboolean iso_recv_data(GIOChannel *io, GIOCondition cond, gpointer user_data) { @@ -2498,6 +2535,8 @@ static gboolean iso_recv_data(GIOChannel *io, GIOCondition cond, return TRUE; else if (isodata->disconnect) iso_shutdown(data, io); + else if (isodata->terminate) + iso_terminate(data, io); else tester_test_passed(); @@ -4311,6 +4350,16 @@ int main(int argc, char *argv[]) setup_powered, test_bcast_recv); + test_iso("ISO Broadcaster Receiver Sync Lost - Success", + &bcast_16_2_1_recv_terminate, + setup_powered, + test_bcast_recv); + + test_iso("ISO Broadcaster PAST Receiver Sync Lost - Success", + &past_16_2_1_recv_terminate, + setup_powered, + test_bcast_recv); + test_iso("ISO Broadcaster AC 12 - Success", &bcast_ac_12, setup_powered, test_bcast); -- 2.47.3