tools/sco-tester: add test cases to get offload codecs
Subsystems (2)
PATCH v2 1/3 tools/sco-tester: add test cases to get offload codecs
Add a test case to query offload codecs supported over sco
---
Notes:
changes in v2:
- Fix unused variables
lib/bluetooth.h | 18 +++++++++++ tools/sco-tester.c | 76 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 3 deletions(-)
lib/bluetooth.h +18 -0
@@ -140,6 +140,24 @@ struct bt_voice {#define BT_SCM_PKT_STATUS 0x03 +#define BT_CODEC 19 +struct bt_codec { +uint8_t id; +uint16_t cid; +uint16_t vid; +uint8_t data_path_id; +uint8_t num_caps; +struct codec_caps { +uint8_t len; +uint8_t data[]; + } caps[]; +} __attribute__((packed)); + +struct bt_codecs { +uint8_t num_codecs; +struct bt_codec codecs[]; +} __attribute__((packed)); +/* Connection and socket states */ enum {BT_CONNECTED =1 ,/* Equal to TCP_ESTABLISHED to make net code happy */
tools/sco-tester.c +73 -3
125 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/3 tools/sco-tester: Add a test case for setting offload codec
Add a test case to set codec for HFP offload use case
---
Notes:
changes in v2:
- No changes
tools/sco-tester.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
tools/sco-tester.c +40 -0
@@ -375,6 +375,43 @@ end:close (sk); } +static void test_codecs_setsockopt (const void *test_data) +{ +int sk, err; +char buffer[255 ]; +struct bt_codecs *codecs; + + sk =socket (PF_BLUETOOTH ,SOCK_SEQPACKET ,BTPROTO_SCO ); +if (sk <0 ) { +tester_warn ("Can't create socket: %s (%d)" ,strerror (errno), + errno); +tester_test_failed (); +return ; + } + +memset (buffer,0 ,sizeof (buffer)); + + 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; + } + +tester_test_passed (); + +end: +close (sk); +} +static void test_getsockopt (const void *test_data) {int sk, err;
@@ -669,5 +706,8 @@ int main(int argc, char *argv[])test_offload_sco ("Basic SCO Get Socket Option - Offload - Success" ,NULL , setup_powered, test_codecs_getsockopt); +test_offload_sco ("Basic SCO Set Socket Option - Offload - Success" , +NULL , setup_powered, test_codecs_setsockopt); +return tester_run (); }
Signature · 1 line
2.17.1
PATCH v2 3/3 tools/sco-tester: add a test case for offload SCO connect
In reply to Kiran KAdd 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(+)
tools/sco-tester.c +49 -0
@@ -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 (); }
Signature · 1 line
2.17.1
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=543085
---Test result---
Test Summary:
CheckPatch FAIL 0.72 seconds GitLint PASS 0.31 seconds Prep - Setup ELL PASS 41.19 seconds Build - Prep PASS 0.09 seconds Build - Configure PASS 7.12 seconds Build - Make PASS 178.50 seconds Make Check PASS 8.98 seconds Make Distcheck PASS 219.84 seconds Build w/ext ELL - Configure PASS 7.29 seconds Build w/ext ELL - Make PASS 166.16 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:tools/sco-tester: add test cases to get offload codecs WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #27: FILE: lib/bluetooth.h:154:
+} __attribute__((packed));
WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #32: FILE: lib/bluetooth.h:159:
+} __attribute__((packed));
- total: 0 errors, 2 warnings, 149 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
"[PATCH] tools/sco-tester: add test cases to get offload codecs" has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
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
Hi Kiran,
Quoted 88 lines · On Tue, Sep 7, 2021 at 4:58 AM <[email protected]> wrote:
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=543085---Test result---
Test Summary:
CheckPatch FAIL 0.72 seconds GitLint PASS 0.31 seconds Prep - Setup ELL PASS 41.19 seconds Build - Prep PASS 0.09 seconds Build - Configure PASS 7.12 seconds Build - Make PASS 178.50 seconds Make Check PASS 8.98 seconds Make Distcheck PASS 219.84 seconds Build w/ext ELL - Configure PASS 7.29 seconds Build w/ext ELL - Make PASS 166.16 secondsDetails
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:tools/sco-tester: add test cases to get offload codecs WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer__packedover __attribute__((packed)) #27: FILE:lib/bluetooth.h:154:
+} __attribute__((packed));WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer
__packedover __attribute__((packed)) #32: FILE:lib/bluetooth.h:159:
+} __attribute__((packed));- total: 0 errors, 2 warnings, 149 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace."[PATCH]
tools/sco-tester: add test cases to get offload codecs" has style problems, please review.NOTE: Ignored message types:
COMMIT_MESSAGECOMPLEX_MACROCONST_STRUCTFILE_PATH_CHANGESMISSING_SIGN_OFFPREFER_PACKEDSPDX_LICENSE_TAGSPLIT_STRINGSSCANF_TO_KSTRTONOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.##############################
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
Quoted 3 lines
---
Regards,
Linux Bluetooth
Applied, thanks.
Signature · 1 line
Luiz Augusto von Dentz