Skip to contentSkip to conversation

sco-tester: Add tests for sending data

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Sep 15, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 sco-tester: Add tests for sending data

From: Luiz Augusto von Dentz <[email protected]>

This adds tests for sending data over the socket.

---
 tools/sco-tester.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
tools/sco-tester.c +27 -0
index b341fa49f..b31fd5aac 100644
@@ -43,6 +43,8 @@ struct test_data {
 
 struct sco_client_data {
 	int expect_err;
+	const uint8_t *send_data;
+	uint16_t data_len;
 };
 
 static void print_debug(const char *str, void *user_data)
@@ -248,6 +250,14 @@ static const struct sco_client_data connect_failure = {
 	.expect_err = EOPNOTSUPP
 };
 
+const uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
+
+static const struct sco_client_data connect_send_success = {
+	.expect_err = 0,
+	.data_len = sizeof(data),
+	.send_data = data
+};
+
 static void client_connectable_complete(uint16_t opcode, uint8_t status,
 					const void *param, uint8_t len,
 					void *user_data)
@@ -600,6 +610,20 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition cond,
 	else
 		tester_print("Successfully connected");
 
+	if (scodata->send_data) {
+		ssize_t ret;
+
+		tester_print("Writing %u bytes of data", scodata->data_len);
+
+		ret = write(sk, scodata->send_data, scodata->data_len);
+		if (scodata->data_len != ret) {
+			tester_warn("Failed to write %u bytes: %zu %s (%d)",
+					scodata->data_len, ret, strerror(errno),
+					errno);
+			err = -errno;
+		}
+	}
+
 	if (-err != scodata->expect_err)
 		tester_test_failed();
 	else
@@ -749,6 +773,9 @@ int main(int argc, char *argv[])
 	test_sco_11("SCO mSBC 1.1 - Failure", &connect_failure, setup_powered,
 							test_connect_transp);
 
+	test_sco("SCO CVSD Send - Success", &connect_send_success,
+					setup_powered, test_connect);
+
 	test_offload_sco("Basic SCO Get Socket Option - Offload - Success",
 				NULL, setup_powered, test_codecs_getsockopt);
 
Signature · 1 line
2.31.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=547625

---Test result---

Test Summary:

CheckPatch                    PASS      1.45 seconds
GitLint                       PASS      0.88 seconds
Prep - Setup ELL              PASS      48.09 seconds
Build - Prep                  PASS      0.48 seconds
Build - Configure             PASS      8.66 seconds
Build - Make                  PASS      207.03 seconds
Make Check                    PASS      9.95 seconds
Make Distcheck                PASS      244.27 seconds
Build w/ext ELL - Configure   PASS      8.75 seconds
Build w/ext ELL - Make        PASS      195.58 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

---
Regards,
Linux Bluetooth