iso-tester: Add tests for AC 1 + 2
authorPauli Virtanen <pav@iki.fi>
Sun, 21 May 2023 15:27:38 +0000 (15:27 +0000)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 13:34:03 +0000 (19:04 +0530)
Add tests connecting two CIS using different CIG_ID, with fixed and
auto-allocated IDs.

ISO AC 1 + 2 - Success
ISO AC 1 + 2 CIG 0x01/0x02 - Success

The CIS are connected sequentially so that the first is closed after the
second is connected. In the auto/auto case the kernel shall pick a new
CIG_ID since the first CIG_ID is no longer in a configurable state.

tools/iso-tester.c

index 164cb46..c59d12e 100644 (file)
                QOS_IO(_interval, _latency, _sdu, _phy, _rtn), \
                QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
 
+#define QOS_2(_interval, _latency, _sdu, _phy, _rtn) \
+       QOS_FULL(0x02, BT_ISO_QOS_CIS_UNSET, \
+               QOS_IO(_interval, _latency, _sdu, _phy, _rtn), \
+               QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
+
 #define QOS_1_1(_interval, _latency, _sdu, _phy, _rtn) \
        QOS_FULL(0x01, 0x01, \
                QOS_IO(_interval, _latency, _sdu, _phy, _rtn), \
 #define QOS_16_1_1 QOS(7500, 8, 30, 0x02, 2)
 #define QOS_16_2_1 QOS(10000, 10, 40, 0x02, 2)
 #define QOS_1_16_2_1 QOS_1(10000, 10, 40, 0x02, 2)
+#define QOS_2_16_2_1 QOS_2(10000, 10, 40, 0x02, 2)
 #define QOS_1_1_16_2_1 QOS_1_1(10000, 10, 40, 0x02, 2)
 #define QOS_24_1_1 QOS(7500, 8, 45, 0x02, 2)
 #define QOS_24_2_1 QOS(10000, 10, 60, 0x02, 2)
@@ -546,6 +552,20 @@ static const struct iso_client_data connect_1_16_2_1 = {
        .expect_err = 0
 };
 
+static const struct iso_client_data connect_ac_1_2_cig_1_2 = {
+       .qos = QOS_1_16_2_1,
+       .qos_2 = QOS_2_16_2_1,
+       .expect_err = 0,
+       .mcis = true,
+};
+
+static const struct iso_client_data connect_ac_1_2 = {
+       .qos = QOS_16_2_1,
+       .qos_2 = QOS_16_2_1,
+       .expect_err = 0,
+       .mcis = true,
+};
+
 static const struct iso_client_data connect_1_1_16_2_1 = {
        .qos = QOS_1_1_16_2_1,
        .expect_err = 0
@@ -2126,6 +2146,25 @@ static void test_connect2(const void *test_data)
        setup_connect_many(data, 2, num, funcs);
 }
 
+static gboolean iso_connect2_seq_cb(GIOChannel *io, GIOCondition cond,
+                                                       gpointer user_data)
+{
+       struct test_data *data = tester_get_data();
+
+       data->io_id[0] = 0;
+
+       setup_connect(data, 1, iso_connect2_cb);
+
+       return iso_connect(io, cond, user_data);
+}
+
+static void test_connect2_seq(const void *test_data)
+{
+       struct test_data *data = tester_get_data();
+
+       setup_connect(data, 0, iso_connect2_seq_cb);
+}
+
 static void test_bcast(const void *test_data)
 {
        struct test_data *data = tester_get_data();
@@ -2356,6 +2395,14 @@ int main(int argc, char *argv[])
        test_iso2("ISO AC 11(ii) - Success", &connect_ac_11ii, setup_powered,
                                                        test_connect2);
 
+       test_iso2("ISO AC 1 + 2 - Success", &connect_ac_1_2, setup_powered,
+                                                       test_connect2_seq);
+
+       test_iso2("ISO AC 1 + 2 CIG 0x01/0x02 - Success",
+                                                       &connect_ac_1_2_cig_1_2,
+                                                       setup_powered,
+                                                       test_connect2_seq);
+
        test_iso("ISO Broadcaster - Success", &bcast_16_2_1_send, setup_powered,
                                                        test_bcast);
        test_iso("ISO Broadcaster Encrypted - Success", &bcast_enc_16_2_1_send,