diff mbox series

[BlueZ,2/2] iso-tester: Add ISO 48_2_1 Defer Receive - Success

Message ID 20220805215622.3958723-2-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/2] bthost: Add qos support to bthost_set_cig_params | expand

Commit Message

Luiz Augusto von Dentz Aug. 5, 2022, 9:56 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds a test to check if different QoS are properly handled when
acting as peripheral.
---
 tools/iso-tester.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 56c17b78b..df46bc953 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -541,6 +541,12 @@  static const struct iovec send_16_2_1 = {
 	.iov_len = sizeof(data_16_2_1),
 };
 
+static const uint8_t data_48_2_1[100] = { [0 ... 99] = 0xff };
+static const struct iovec send_48_2_1 = {
+	.iov_base = (void *)data_48_2_1,
+	.iov_len = sizeof(data_48_2_1),
+};
+
 static const struct iso_client_data connect_16_2_1_send = {
 	.qos = QOS_16_2_1,
 	.expect_err = 0,
@@ -582,6 +588,14 @@  static const struct iso_client_data listen_16_2_1_defer_recv = {
 	.defer = true,
 };
 
+static const struct iso_client_data listen_48_2_1_defer_recv = {
+	.qos = QOS_48_2_1,
+	.expect_err = 0,
+	.recv = &send_48_2_1,
+	.server = true,
+	.defer = true,
+};
+
 static const struct iso_client_data listen_16_2_1_defer_reject = {
 	.qos = QOS_16_2_1,
 	.expect_err = -1,
@@ -973,7 +987,7 @@  static bool check_io_qos(const struct bt_iso_io_qos *io1,
 		return false;
 	}
 
-	if (io1->sdu != io2->sdu) {
+	if (io1->sdu && io2->sdu && io1->sdu != io2->sdu) {
 		tester_warn("Unexpected IO SDU: %u != %u", io1->sdu, io2->sdu);
 		return false;
 	}
@@ -1450,7 +1464,7 @@  static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func)
 		client = hciemu_get_client(data->hciemu, 0);
 		host = hciemu_client_host(client);
 
-		bthost_set_cig_params(host, 0x01, 0x01);
+		bthost_set_cig_params(host, 0x01, 0x01, &isodata->qos);
 		bthost_create_cis(host, 257, data->acl_handle);
 	}
 }
@@ -1701,6 +1715,10 @@  int main(int argc, char *argv[])
 	test_iso("ISO Defer Receive - Success", &listen_16_2_1_defer_recv,
 						setup_powered, test_listen);
 
+	test_iso("ISO 48_2_1 Defer Receive - Success",
+						&listen_48_2_1_defer_recv,
+						setup_powered, test_listen);
+
 	test_iso("ISO Defer Reject - Success", &listen_16_2_1_defer_reject,
 						setup_powered, test_listen);