From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
tedd.an@intel.com, luiz.von.dentz@intel.com,
michaelfsun@google.com, Kiran K <kiran.k@intel.com>
Subject: [PATCH v2 3/3] tools/sco-tester: add a test case for offload SCO connect
Date: Tue, 7 Sep 2021 16:55:56 +0530 [thread overview]
Message-ID: <20210907112556.11848-3-kiran.k@intel.com> (raw)
In-Reply-To: <20210907112556.11848-1-kiran.k@intel.com>
Add a test case for offload SCO connect with codec type set to mSBC
---
Notes:
* changes in v2:
- No change
tools/sco-tester.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index 67ea4769ef2b..b341fa49f792 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -675,6 +675,52 @@ end:
close(sk);
}
+static void test_connect_offload_msbc(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct sco_client_data *scodata = data->test_data;
+ int sk, err;
+ int len;
+ char buffer[255];
+ struct bt_codecs *codecs;
+
+ sk = create_sco_sock(data);
+ if (sk < 0) {
+ tester_test_failed();
+ return;
+ }
+
+ len = sizeof(buffer);
+ memset(buffer, 0, len);
+
+ codecs = (void *)buffer;
+
+ codecs->codecs[0].id = 0x05;
+ codecs->num_codecs = 1;
+ codecs->codecs[0].data_path_id = 1;
+ codecs->codecs[0].num_caps = 0x00;
+
+ err = setsockopt(sk, SOL_BLUETOOTH, BT_CODEC, codecs, sizeof(buffer));
+ if (err < 0) {
+ tester_warn("Can't set socket option : %s (%d)",
+ strerror(errno), errno);
+ tester_test_failed();
+ goto end;
+ }
+ err = connect_sco_sock(data, sk);
+
+ tester_warn("Connect returned %s (%d), expected %s (%d)",
+ strerror(-err), -err,
+ strerror(scodata->expect_err), scodata->expect_err);
+
+ if (-err != scodata->expect_err)
+ tester_test_failed();
+ else
+ tester_test_passed();
+
+end:
+ close(sk);
+}
int main(int argc, char *argv[])
{
tester_init(&argc, &argv);
@@ -709,5 +755,8 @@ int main(int argc, char *argv[])
test_offload_sco("Basic SCO Set Socket Option - Offload - Success",
NULL, setup_powered, test_codecs_setsockopt);
+ test_offload_sco("eSCO mSBC - Offload - Success",
+ &connect_success, setup_powered, test_connect_offload_msbc);
+
return tester_run();
}
--
2.17.1
next prev parent reply other threads:[~2021-09-07 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 11:25 [PATCH v2 1/3] tools/sco-tester: add test cases to get offload codecs Kiran K
2021-09-07 11:25 ` [PATCH v2 2/3] tools/sco-tester: Add a test case for setting offload codec Kiran K
2021-09-07 11:25 ` Kiran K [this message]
2021-09-07 11:53 ` [v2,1/3] tools/sco-tester: add test cases to get offload codecs bluez.test.bot
2021-09-07 22:07 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210907112556.11848-3-kiran.k@intel.com \
--to=kiran.k@intel.com \
--cc=chethan.tumkur.narayan@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.von.dentz@intel.com \
--cc=michaelfsun@google.com \
--cc=ravishankar.srivatsa@intel.com \
--cc=tedd.an@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox