diff mbox series

[BlueZ,4/6] test-bap: Add Broadcast Source Establish test

Message ID 20240527075422.18953-5-iulia.tanasescu@nxp.com (mailing list archive)
State Accepted
Commit bb30b19901547b012896b239dfa10a2a9e95c665
Headers show
Series Add new BAP BSRC/SCC tests | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Iulia Tanasescu May 27, 2024, 7:54 a.m. UTC
BAP/BSRC/SCC/BV-35-C [Establishes Broadcast] (page 175):

    Test Purpose:
    Verify that a Broadcast Source IUT can establish a broadcast
    Audio Stream.

    Pass verdict:
    The IUT sends AUX_SYNC_IND PDUs with an Extended Header
    containing BIGInfo in the ACAD field.

    The IUT sends BIS Data PDUs over the broadcast Audio
    Stream.

Test Summary
------------
BAP/BSRC/SCC/BV-35-C [Establishes Broadcast]         Passed
---
 unit/test-bap.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/unit/test-bap.c b/unit/test-bap.c
index 9cb4ae8d8..59e056e05 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -6029,7 +6029,7 @@  static struct test_config cfg_bsrc_vs = {
  * Each value included in the Codec_Specific_Configuration is formatted in
  * an LTV structure with the length, type, and value specified in Table 4.74.
  */
-static void test_bsrc_scc(void)
+static void test_bsrc_scc_config(void)
 {
 	define_test("BAP/BSRC/SCC/BV-01-C [Config Broadcast, LC3 8_1_1]",
 		NULL, test_bcast, &cfg_bsrc_8_1_1, IOV_NULL);
@@ -6131,6 +6131,50 @@  static void test_bsrc_scc(void)
 		NULL, test_bcast, &cfg_bsrc_vs, IOV_NULL);
 }
 
+static void bsrc_state_estab(struct bt_bap_stream *stream, uint8_t old_state,
+				uint8_t new_state, void *user_data)
+{
+	switch (new_state) {
+	case BT_BAP_STREAM_STATE_CONFIG:
+		bt_bap_stream_enable(stream, true, NULL, NULL, NULL);
+		break;
+	case BT_BAP_STREAM_STATE_ENABLING:
+		bt_bap_stream_start(stream, NULL, NULL);
+		break;
+	case BT_BAP_STREAM_STATE_STREAMING:
+		tester_test_passed();
+		break;
+	}
+}
+
+static struct test_config cfg_bsrc_8_1_1_estab = {
+	.cc = LC3_CONFIG_8_1,
+	.qos = LC3_QOS_8_1_1_B,
+	.src = true,
+	.state_func = bsrc_state_estab,
+};
+
+/* Test Purpose:
+ * Verify that a Broadcast Source IUT can establish a broadcast
+ * Audio Stream.
+ *
+ * Pass verdict:
+ * The IUT sends AUX_SYNC_IND PDUs with an Extended Header
+ * containing BIGInfo in the ACAD field. The IUT sends BIS Data
+ * PDUs over the broadcast Audio Stream.
+ */
+static void test_bsrc_scc_estab(void)
+{
+	define_test("BAP/BSRC/SCC/BV-35-C [Establishes Broadcast]",
+		NULL, test_bcast, &cfg_bsrc_8_1_1_estab, IOV_NULL);
+}
+
+static void test_bsrc_scc(void)
+{
+	test_bsrc_scc_config();
+	test_bsrc_scc_estab();
+}
+
 static struct test_config cfg_bsnk_8_1 = {
 	.cc = LC3_CONFIG_8_1,
 	.qos = QOS_BCAST,