diff mbox series

[v1,PTS] Included peripheral mode for fixing of few PTS Test Cases

Message ID 20240620112209.12287-1-quic_prathm@quicinc.com (mailing list archive)
State New, archived
Headers show
Series [v1,PTS] Included peripheral mode for fixing of few PTS Test Cases | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch fail WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #105: For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics. WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (24, 33) #231: FILE: tools/btgatt-client.c:1880: + if (strcmp(optarg, "peripheral") == 0) + peri_cent = PERIPHERAL_MODE; ERROR:CODE_INDENT: code indent should use tabs where possible #240: FILE: tools/btgatt-client.c:1889: + break;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #240: FILE: tools/btgatt-client.c:1889: + break;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #252: FILE: tools/btgatt-client.c:1917: + if(peri_cent == CENTRAL_MODE)$ ERROR:OPEN_BRACE: that open brace { should be on the previous line #252: FILE: tools/btgatt-client.c:1917: + if(peri_cent == CENTRAL_MODE) + { ERROR:SPACING: space required before the open parenthesis '(' #252: FILE: tools/btgatt-client.c:1917: + if(peri_cent == CENTRAL_MODE) WARNING:LEADING_SPACE: please, no spaces at the start of a line #253: FILE: tools/btgatt-client.c:1918: + {$ ERROR:CODE_INDENT: code indent should use tabs where possible #254: FILE: tools/btgatt-client.c:1919: + if (!dst_addr_given) {$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #254: FILE: tools/btgatt-client.c:1919: + if (!dst_addr_given) {$ WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 12) #254: FILE: tools/btgatt-client.c:1919: + if (!dst_addr_given) { + fprintf(stderr, "Destination address required!\n"); ERROR:CODE_INDENT: code indent should use tabs where possible #255: FILE: tools/btgatt-client.c:1920: + fprintf(stderr, "Destination address required!\n");$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #255: FILE: tools/btgatt-client.c:1920: + fprintf(stderr, "Destination address required!\n");$ ERROR:CODE_INDENT: code indent should use tabs where possible #256: FILE: tools/btgatt-client.c:1921: + return EXIT_FAILURE;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #256: FILE: tools/btgatt-client.c:1921: + return EXIT_FAILURE;$ ERROR:CODE_INDENT: code indent should use tabs where possible #257: FILE: tools/btgatt-client.c:1922: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #257: FILE: tools/btgatt-client.c:1922: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #259: FILE: tools/btgatt-client.c:1924: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #264: FILE: tools/btgatt-client.c:1928: + if(peri_cent == CENTRAL_MODE)$ ERROR:SPACING: space required before the open parenthesis '(' #264: FILE: tools/btgatt-client.c:1928: + if(peri_cent == CENTRAL_MODE) ERROR:CODE_INDENT: code indent should use tabs where possible #265: FILE: tools/btgatt-client.c:1929: + fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #265: FILE: tools/btgatt-client.c:1929: + fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #266: FILE: tools/btgatt-client.c:1930: + else$ ERROR:CODE_INDENT: code indent should use tabs where possible #267: FILE: tools/btgatt-client.c:1931: + fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #267: FILE: tools/btgatt-client.c:1931: + fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);$ /github/workspace/src/src/13705151.patch total: 10 errors, 15 warnings, 144 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. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile /github/workspace/src/src/13705151.patch 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.
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 13: B1 Line exceeds max length (164>80): "For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics." 14: B1 Line exceeds max length (137>80): "When IUT and PTS are connected from bluetoothctl tool, GAP service and its characterisitics are not showing in the bluetoothctl terminal." 16: B1 Line exceeds max length (187>80): "For GAP/SEC/SEM/BV-56-C , GAP/SEC/SEM/BV-57-C, GAP/SEC/SEM/BV-58-C test cases the IUT should be in peripheral mode(advertise and accept connection) and GATT client role as per GAP.TS.p44."
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake fail BluezMake FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ tools/btgatt-client.c: In function ‘main’: tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] 1930 | else | ^~~~ tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 1932 | if (fd < 0) | ^~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4666: all] Error 2
tedd_an/MakeCheck fail BlueZ Make Check FAIL:
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind fail Check Valgrind FAIL: tools/btgatt-client.c: In function ‘main’: tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] 1930 | else | ^~~~ tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 1932 | if (fd < 0) | ^~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1 make[1]: *** Waiting for unfinished jobs.... tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ make: *** [Makefile:12292: check] Error 2
tedd_an/CheckSmatch fail CheckSparse: FAIL: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:621:25: warning: Variable length array is used. src/shared/gatt-server.c:720:25: warning: Variable length array is used. src/shared/bap.c:286:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:621:25: warning: Variable length array is used. src/shared/gatt-server.c:720:25: warning: Variable length array is used. src/shared/bap.c:286:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:219:15: warning: array of flexible structures ./lib/bluetooth.h:224:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/btgatt-client.c: In function ‘main’: tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] 1930 | else | ^~~~ tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 1932 | if (fd < 0) | ^~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4666: all] Error 2
tedd_an/bluezmakeextell fail Make External ELL FAIL: tools/btgatt-client.c: In function ‘main’: tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] 1930 | else | ^~~~ tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 1932 | if (fd < 0) | ^~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4666: all] Error 2
tedd_an/IncrementalBuild fail [v1,PTS] Included peripheral mode for fixing of few PTS Test Cases tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[]) | ^~~~ tools/btgatt-client.c: In function ‘main’: tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] 1930 | else | ^~~~ tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 1932 | if (fd < 0) | ^~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4666: all] Error 2
tedd_an/ScanBuild fail Scan Build FAIL

Commit Message

Prathibha Madugonde June 20, 2024, 11:22 a.m. UTC
From: Prathibha Madugonde <quic_prathm@quicinc.com>

Fix for below Test Cases:
GAP/SEC/SEM/BV-56-C
GAP/SEC/SEM/BV-57-C
GAP/SEC/SEM/BV-58-C
GAP/SEC/SEM/BV-59-C
GAP/SEC/SEM/BV-60-C
GAP/SEC/SEM/BV-61-C

For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics.
When IUT and PTS are connected from bluetoothctl tool, GAP service and its characterisitics are not showing in the bluetoothctl terminal.
Therefore need to use other existing tools, here we used btgatt-client tool.
For GAP/SEC/SEM/BV-56-C , GAP/SEC/SEM/BV-57-C, GAP/SEC/SEM/BV-58-C test cases the IUT should be in peripheral mode(advertise and accept connection) and GATT client role as per GAP.TS.p44.
Added peripheral mode in the btgatt-client tool for PASSING those test cases.

Signed-off-by: Prathibha Madugonde <quic_prathm@quicinc.com>
---
 tools/btgatt-client.c | 97 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 91 insertions(+), 6 deletions(-)

Comments

bluez.test.bot@gmail.com June 20, 2024, 11:58 a.m. UTC | #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=863798

---Test result---

Test Summary:
CheckPatch                    FAIL      0.69 seconds
GitLint                       FAIL      0.43 seconds
BuildEll                      PASS      24.73 seconds
BluezMake                     FAIL      53.29 seconds
MakeCheck                     FAIL      162.44 seconds
MakeDistcheck                 PASS      180.97 seconds
CheckValgrind                 FAIL      43.21 seconds
CheckSmatch                   FAIL      96.15 seconds
bluezmakeextell               FAIL      27.13 seconds
IncrementalBuild              FAIL      52.61 seconds
ScanBuild                     FAIL      608.50 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v1,PTS] Included peripheral mode for fixing of few PTS Test Cases
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#105: 
For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics.

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (24, 33)
#231: FILE: tools/btgatt-client.c:1880:
+			if (strcmp(optarg, "peripheral") == 0)
+				 peri_cent = PERIPHERAL_MODE;

ERROR:CODE_INDENT: code indent should use tabs where possible
#240: FILE: tools/btgatt-client.c:1889:
+            break;$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#240: FILE: tools/btgatt-client.c:1889:
+            break;$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#252: FILE: tools/btgatt-client.c:1917:
+    if(peri_cent == CENTRAL_MODE)$

ERROR:OPEN_BRACE: that open brace { should be on the previous line
#252: FILE: tools/btgatt-client.c:1917:
+    if(peri_cent == CENTRAL_MODE)
+    {

ERROR:SPACING: space required before the open parenthesis '('
#252: FILE: tools/btgatt-client.c:1917:
+    if(peri_cent == CENTRAL_MODE)

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#253: FILE: tools/btgatt-client.c:1918:
+    {$

ERROR:CODE_INDENT: code indent should use tabs where possible
#254: FILE: tools/btgatt-client.c:1919:
+        if (!dst_addr_given) {$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#254: FILE: tools/btgatt-client.c:1919:
+        if (!dst_addr_given) {$

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 12)
#254: FILE: tools/btgatt-client.c:1919:
+        if (!dst_addr_given) {
+            fprintf(stderr, "Destination address required!\n");

ERROR:CODE_INDENT: code indent should use tabs where possible
#255: FILE: tools/btgatt-client.c:1920:
+            fprintf(stderr, "Destination address required!\n");$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#255: FILE: tools/btgatt-client.c:1920:
+            fprintf(stderr, "Destination address required!\n");$

ERROR:CODE_INDENT: code indent should use tabs where possible
#256: FILE: tools/btgatt-client.c:1921:
+            return EXIT_FAILURE;$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#256: FILE: tools/btgatt-client.c:1921:
+            return EXIT_FAILURE;$

ERROR:CODE_INDENT: code indent should use tabs where possible
#257: FILE: tools/btgatt-client.c:1922:
+        }$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#257: FILE: tools/btgatt-client.c:1922:
+        }$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#259: FILE: tools/btgatt-client.c:1924:
+    }$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#264: FILE: tools/btgatt-client.c:1928:
+    if(peri_cent == CENTRAL_MODE)$

ERROR:SPACING: space required before the open parenthesis '('
#264: FILE: tools/btgatt-client.c:1928:
+    if(peri_cent == CENTRAL_MODE)

ERROR:CODE_INDENT: code indent should use tabs where possible
#265: FILE: tools/btgatt-client.c:1929:
+        fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#265: FILE: tools/btgatt-client.c:1929:
+        fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#266: FILE: tools/btgatt-client.c:1930:
+    else$

ERROR:CODE_INDENT: code indent should use tabs where possible
#267: FILE: tools/btgatt-client.c:1931:
+        fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#267: FILE: tools/btgatt-client.c:1931:
+        fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);$

/github/workspace/src/src/13705151.patch total: 10 errors, 15 warnings, 144 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.

NOTE: Whitespace errors detected.
      You may wish to use scripts/cleanpatch or scripts/cleanfile

/github/workspace/src/src/13705151.patch 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 - FAIL
Desc: Run gitlint
Output:
[v1,PTS] Included peripheral mode for fixing of few PTS Test Cases

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
13: B1 Line exceeds max length (164>80): "For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics."
14: B1 Line exceeds max length (137>80): "When IUT and PTS are connected from bluetoothctl tool, GAP service and its characterisitics are not showing in the bluetoothctl terminal."
16: B1 Line exceeds max length (187>80): "For GAP/SEC/SEM/BV-56-C , GAP/SEC/SEM/BV-57-C, GAP/SEC/SEM/BV-58-C test cases the IUT should be in peripheral mode(advertise and accept connection) and GATT client role as per GAP.TS.p44."
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4666: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make: *** [Makefile:12292: check] Error 2
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
make: *** [Makefile:12292: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:621:25: warning: Variable length array is used.
src/shared/gatt-server.c:720:25: warning: Variable length array is used.
src/shared/bap.c:286:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:621:25: warning: Variable length array is used.
src/shared/gatt-server.c:720:25: warning: Variable length array is used.
src/shared/bap.c:286:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'
tools/sco-tester.c: note: in included file:
./lib/bluetooth.h:219:15: warning: array of flexible structures
./lib/bluetooth.h:224:31: warning: array of flexible structures
tools/bneptest.c:634:39: warning: unknown escape sequence: '\%'
tools/seq2bseq.c:57:26: warning: Variable length array is used.
tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4666: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4666: all] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[v1,PTS] Included peripheral mode for fixing of few PTS Test Cases

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4666: all] Error 2
##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:

src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1294:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1359:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1634:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1639:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2143:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2151:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3240:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3262:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.
src/shared/shell.c:1331:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
                        if (c != opt->options[index - offset].val) {
                                 ^~~~~~~~~~~~
1 warning generated.
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1294:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1359:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1634:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1639:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2143:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2151:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3240:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3262:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.
src/shared/shell.c:1331:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
                        if (c != opt->options[index - offset].val) {
                                 ^~~~~~~~~~~~
1 warning generated.
tools/hciattach.c:816:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
        if ((n = read_hci_event(fd, resp, 10)) < 0) {
             ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:864:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
        if ((n = read_hci_event(fd, resp, 4)) < 0) {
             ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:886:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
                if ((n = read_hci_event(fd, resp, 10)) < 0) {
                     ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:908:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
        if ((n = read_hci_event(fd, resp, 4)) < 0) {
             ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:929:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
        if ((n = read_hci_event(fd, resp, 4)) < 0) {
             ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:973:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
        if ((n = read_hci_event(fd, resp, 6)) < 0) {
             ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
src/oui.c:50:2: warning: Value stored to 'hwdb' is never read
        hwdb = udev_hwdb_unref(hwdb);
        ^      ~~~~~~~~~~~~~~~~~~~~~
src/oui.c:53:2: warning: Value stored to 'udev' is never read
        udev = udev_unref(udev);
        ^      ~~~~~~~~~~~~~~~~
2 warnings generated.
tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp'
                                if (fds[i].fd == sock)
                                    ^~~
tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined
                                dh->ts_sec  = htobl(frm.ts.tv_sec);
                                            ^ ~~~~~~~~~~~~~~~~~~~~
tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value
                                if (be32toh(dp.flags) & 0x02) {
                                    ^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
#  define be32toh(x) __bswap_32 (x)
                     ^~~~~~~~~~~~~~
tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value
                                frm.data_len = be32toh(dp.len);
                                               ^~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
#  define be32toh(x) __bswap_32 (x)
                     ^~~~~~~~~~~~~~
tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value
                                opcode = be32toh(dp.flags) & 0xffff;
                                         ^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
#  define be32toh(x) __bswap_32 (x)
                     ^~~~~~~~~~~~~~
tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined
                        frm.data_len = btohs(dh.len);
                                     ^ ~~~~~~~~~~~~~
tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined
                frm.len = frm.data_len;
                        ^ ~~~~~~~~~~~~
tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value
                        ts = be64toh(ph.ts);
                             ^~~~~~~~~~~~~~
/usr/include/endian.h:51:22: note: expanded from macro 'be64toh'
#  define be64toh(x) __bswap_64 (x)
                     ^~~~~~~~~~~~~~
tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value
                        frm.in = be32toh(dp.flags) & 0x01;
                                 ^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
#  define be32toh(x) __bswap_32 (x)
                     ^~~~~~~~~~~~~~
tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined
                        frm.in = dh.in;
                               ^ ~~~~~
tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
        fd = open(file, open_flags, 0644);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 warnings generated.
tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read
                i = execvp(cmdargv[0], cmdargv);
                ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
                i = execvp(cmdargv[0], cmdargv);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
                if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
                     ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined
        req.channel = raddr.rc_channel;
                    ^ ~~~~~~~~~~~~~~~~
tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
                if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
                     ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined
                buf[1] = data[i + 1];
                       ^ ~~~~~~~~~~~
src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined
                        buf[1] = data[i + 1];
                               ^ ~~~~~~~~~~~
src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined
                        buf[1] = data[i + 1];
                               ^ ~~~~~~~~~~~
3 warnings generated.
tools/ciptool.c:350:7: warning: 5th function call argument is an uninitialized value
        sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int'
                        uint32_t *value_int = malloc(sizeof(int));
                        ~~~~~~~~~~            ^~~~~~ ~~~~~~~~~~~
tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value
                        free(allocArray[i]);
                        ^~~~~~~~~~~~~~~~~~~
tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name'
        return add_service(0, &si);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc'
                        return -1;
                        ^~~~~~~~~
4 warnings generated.
tools/avtest.c:225:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 3);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:235:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 4);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:244:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 3);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:258:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf,
                                ^     ~~~~~~~~~~~~~~
tools/avtest.c:265:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf,
                                ^     ~~~~~~~~~~~~~~
tools/avtest.c:272:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf,
                                ^     ~~~~~~~~~~~~~~
tools/avtest.c:279:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf,
                                ^     ~~~~~~~~~~~~~~
tools/avtest.c:291:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 4);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:295:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:304:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 3);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:308:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:317:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 3);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:324:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:346:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 4);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:350:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:359:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 3);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:363:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:376:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 4);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:380:5: warning: Value stored to 'len' is never read
                                len = write(sk, buf, 2);
                                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:387:4: warning: Value stored to 'len' is never read
                        len = write(sk, buf, 2);
                        ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:397:4: warning: Value stored to 'len' is never read
                        len = write(sk, buf, 2);
                        ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:562:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 2);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:570:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, invalid ? 2 : 3);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:584:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 4 + sizeof(media_transport));
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:597:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:607:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:619:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:634:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:646:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:655:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 3);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:662:3: warning: Value stored to 'len' is never read
                len = write(sk, buf, 2);
                ^     ~~~~~~~~~~~~~~~~~
tools/avtest.c:698:2: warning: Value stored to 'len' is never read
        len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed));
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 warnings generated.
tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull'
                        tcp_port = atoi(optarg);
                                   ^~~~~~~~~~~~
tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull'
                        if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
                            ^~~~~~~~~~~~~~
2 warnings generated.
tools/create-image.c:76:3: warning: Value stored to 'fd' is never read
                fd = -1;
                ^    ~~
tools/create-image.c:84:3: warning: Value stored to 'fd' is never read
                fd = -1;
                ^    ~~
tools/create-image.c:92:3: warning: Value stored to 'fd' is never read
                fd = -1;
                ^    ~~
tools/create-image.c:105:2: warning: Value stored to 'fd' is never read
        fd = -1;
        ^    ~~
4 warnings generated.
tools/btgatt-client.c: In function ‘main’:
tools/btgatt-client.c:1930:5: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
 1930 |     else
      |     ^~~~
tools/btgatt-client.c:1932:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 1932 |  if (fd < 0)
      |  ^~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7837: tools/btgatt-client.o] Error 1
make[1]: *** Waiting for unfinished jobs....
tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read
        argv -= optind;
        ^       ~~~~~~
1 warning generated.
make: *** [Makefile:4666: all] Error 2


---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz June 20, 2024, 2 p.m. UTC | #2
Hi,

On Thu, Jun 20, 2024 at 7:23 AM <quic_prathm@quicinc.com> wrote:
>
> From: Prathibha Madugonde <quic_prathm@quicinc.com>
>
> Fix for below Test Cases:
> GAP/SEC/SEM/BV-56-C
> GAP/SEC/SEM/BV-57-C
> GAP/SEC/SEM/BV-58-C
> GAP/SEC/SEM/BV-59-C
> GAP/SEC/SEM/BV-60-C
> GAP/SEC/SEM/BV-61-C
>
> For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics.
> When IUT and PTS are connected from bluetoothctl tool, GAP service and its characterisitics are not showing in the bluetoothctl terminal.

Ok, this is sort of weird if that is intentional to expose Battery
Level Characteristic on GAP service, so there is no Battery Service?
Not sure why it would be using Battery Level either, or is this
something you can influence with some (PIXIT?) configuration? If the
idea is just to have the peripheral acting as a GATT client any
attribute would do it so the choice here seems really odd, what I'd
expect is that one could configure the attribute/handle that it wants
to send the GATT operations.

> Therefore need to use other existing tools, here we used btgatt-client tool.
> For GAP/SEC/SEM/BV-56-C , GAP/SEC/SEM/BV-57-C, GAP/SEC/SEM/BV-58-C test cases the IUT should be in peripheral mode(advertise and accept connection) and GATT client role as per GAP.TS.p44.
> Added peripheral mode in the btgatt-client tool for PASSING those test cases.
>
> Signed-off-by: Prathibha Madugonde <quic_prathm@quicinc.com>
> ---
>  tools/btgatt-client.c | 97 ++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 91 insertions(+), 6 deletions(-)
>
> diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
> index b47914da3..2b732e454 100644
> --- a/tools/btgatt-client.c
> +++ b/tools/btgatt-client.c
> @@ -36,6 +36,8 @@
>  #include "src/shared/gatt-helpers.h"
>
>  #define ATT_CID 4
> +#define CENTRAL_MODE   1
> +#define PERIPHERAL_MODE   2
>
>  #define PRLOG(...) \
>         printf(__VA_ARGS__); print_prompt();
> @@ -1633,6 +1635,68 @@ static void signal_cb(int signum, void *user_data)
>         }
>  }
>
> +static int l2cap_le_att_listen_and_accept(bdaddr_t *src, int sec,
> +                                                       uint8_t src_type)
> +{
> +       int sk, nsk;
> +       struct sockaddr_l2 srcaddr, addr;
> +       socklen_t optlen;
> +       struct bt_security btsec;
> +       char ba[18];
> +
> +       sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
> +       if (sk < 0) {
> +               perror("Failed to create L2CAP socket");
> +               return -1;
> +       }
> +
> +       /* Set up source address */
> +       memset(&srcaddr, 0, sizeof(srcaddr));
> +       srcaddr.l2_family = AF_BLUETOOTH;
> +       srcaddr.l2_cid = htobs(ATT_CID);
> +       srcaddr.l2_bdaddr_type = src_type;
> +       bacpy(&srcaddr.l2_bdaddr, src);
> +
> +       if (bind(sk, (struct sockaddr *) &srcaddr, sizeof(srcaddr)) < 0) {
> +               perror("Failed to bind L2CAP socket");
> +               goto fail;
> +       }
> +
> +       /* Set the security level */
> +       memset(&btsec, 0, sizeof(btsec));
> +       btsec.level = sec;
> +       if (setsockopt(sk, SOL_BLUETOOTH, BT_SECURITY, &btsec,
> +                                                       sizeof(btsec)) != 0) {
> +               fprintf(stderr, "Failed to set L2CAP security level\n");
> +               goto fail;
> +       }
> +
> +       if (listen(sk, 10) < 0) {
> +               perror("Listening on socket failed");
> +               goto fail;
> +       }
> +
> +       printf("Started listening on ATT channel. Waiting for connections\n");
> +
> +       memset(&addr, 0, sizeof(addr));
> +       optlen = sizeof(addr);
> +       nsk = accept(sk, (struct sockaddr *) &addr, &optlen);
> +       if (nsk < 0) {
> +               perror("Accept failed");
> +               goto fail;
> +       }
> +
> +       ba2str(&addr.l2_bdaddr, ba);
> +       printf("Connect from %s\n", ba);
> +       close(sk);
> +
> +       return nsk;
> +
> +fail:
> +       close(sk);
> +       return -1;
> +}
> +
>  static int l2cap_le_att_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t dst_type,
>                                                                         int sec)
>  {
> @@ -1709,6 +1773,7 @@ static void usage(void)
>         printf("Options:\n"
>                 "\t-i, --index <id>\t\tSpecify adapter index, e.g. hci0\n"
>                 "\t-d, --dest <addr>\t\tSpecify the destination address\n"
> +               "\t-p, --peripheral mode\t\t\tStar Listening on Att Channel\n"
>                 "\t-t, --type [random|public] \tSpecify the LE address type\n"
>                 "\t-m, --mtu <mtu> \t\tThe ATT MTU to use\n"
>                 "\t-s, --security-level <sec> \tSet security level (low|medium|"
> @@ -1720,6 +1785,7 @@ static void usage(void)
>  static struct option main_options[] = {
>         { "index",              1, 0, 'i' },
>         { "dest",               1, 0, 'd' },
> +       { "peripheral",         1, 0, 'p' },
>         { "type",               1, 0, 't' },
>         { "mtu",                1, 0, 'm' },
>         { "security-level",     1, 0, 's' },
> @@ -1738,9 +1804,10 @@ int main(int argc, char *argv[])
>         bdaddr_t src_addr, dst_addr;
>         int dev_id = -1;
>         int fd;
> +       int peri_cent = CENTRAL_MODE;
>         struct client *cli;
>
> -       while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:i:",
> +       while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:p:i:",
>                                                 main_options, NULL)) != -1) {
>                 switch (opt) {
>                 case 'h':
> @@ -1809,6 +1876,17 @@ int main(int argc, char *argv[])
>                         }
>
>                         break;
> +               case 'p':
> +                       if (strcmp(optarg, "peripheral") == 0)
> +                                peri_cent = PERIPHERAL_MODE;
> +                       else if (strcmp(optarg, "central") == 0)
> +                               peri_cent = CENTRAL_MODE;
> +                       else {
> +                               fprintf(stderr,
> +                                       "Allowed Modes: peripheral, central\n");
> +                               return EXIT_FAILURE;
> +                       }
> +            break;
>                 default:
>                         fprintf(stderr, "Invalid option: %c\n", opt);
>                         return EXIT_FAILURE;
> @@ -1836,14 +1914,21 @@ int main(int argc, char *argv[])
>                 return EXIT_FAILURE;
>         }
>
> -       if (!dst_addr_given) {
> -               fprintf(stderr, "Destination address required!\n");
> -               return EXIT_FAILURE;
> -       }
> +    if(peri_cent == CENTRAL_MODE)
> +    {
> +        if (!dst_addr_given) {
> +            fprintf(stderr, "Destination address required!\n");
> +            return EXIT_FAILURE;
> +        }
> +
> +    }
>
>         mainloop_init();
>
> -       fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
> +    if(peri_cent == CENTRAL_MODE)
> +        fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
> +    else
> +        fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);
>         if (fd < 0)
>                 return EXIT_FAILURE;
>
> --
> 2.17.1
>
>
Prathibha Madugonde June 28, 2024, 6:02 a.m. UTC | #3
On 6/20/2024 7:30 PM, Luiz Augusto von Dentz wrote:
> Hi,
> 
> On Thu, Jun 20, 2024 at 7:23 AM <quic_prathm@quicinc.com> wrote:
>>
>> From: Prathibha Madugonde <quic_prathm@quicinc.com>
>>
>> Fix for below Test Cases:
>> GAP/SEC/SEM/BV-56-C
>> GAP/SEC/SEM/BV-57-C
>> GAP/SEC/SEM/BV-58-C
>> GAP/SEC/SEM/BV-59-C
>> GAP/SEC/SEM/BV-60-C
>> GAP/SEC/SEM/BV-61-C
>>
>> For all above test cases, PTS tool is adding Battery Level Characteristics in the GAP service. And PTS is expecting to write value to Battery Level Characteristics.
>> When IUT and PTS are connected from bluetoothctl tool, GAP service and its characterisitics are not showing in the bluetoothctl terminal.
> 
> Ok, this is sort of weird if that is intentional to expose Battery
> Level Characteristic on GAP service, so there is no Battery Service?
> Not sure why it would be using Battery Level either, or is this
> something you can influence with some (PIXIT?) configuration? If the
> idea is just to have the peripheral acting as a GATT client any
> attribute would do it so the choice here seems really odd, what I'd
> expect is that one could configure the attribute/handle that it wants
> to send the GATT operations.
> 

Thanks for your input, after changing the PIXIT Configuration above 
mentioned test cases were able to PASS.

--
Prathibha Madugonde

>> Therefore need to use other existing tools, here we used btgatt-client tool.
>> For GAP/SEC/SEM/BV-56-C , GAP/SEC/SEM/BV-57-C, GAP/SEC/SEM/BV-58-C test cases the IUT should be in peripheral mode(advertise and accept connection) and GATT client role as per GAP.TS.p44.
>> Added peripheral mode in the btgatt-client tool for PASSING those test cases.
>>
>> Signed-off-by: Prathibha Madugonde <quic_prathm@quicinc.com>
>> ---
>>   tools/btgatt-client.c | 97 ++++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 91 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
>> index b47914da3..2b732e454 100644
>> --- a/tools/btgatt-client.c
>> +++ b/tools/btgatt-client.c
>> @@ -36,6 +36,8 @@
>>   #include "src/shared/gatt-helpers.h"
>>
>>   #define ATT_CID 4
>> +#define CENTRAL_MODE   1
>> +#define PERIPHERAL_MODE   2
>>
>>   #define PRLOG(...) \
>>          printf(__VA_ARGS__); print_prompt();
>> @@ -1633,6 +1635,68 @@ static void signal_cb(int signum, void *user_data)
>>          }
>>   }
>>
>> +static int l2cap_le_att_listen_and_accept(bdaddr_t *src, int sec,
>> +                                                       uint8_t src_type)
>> +{
>> +       int sk, nsk;
>> +       struct sockaddr_l2 srcaddr, addr;
>> +       socklen_t optlen;
>> +       struct bt_security btsec;
>> +       char ba[18];
>> +
>> +       sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
>> +       if (sk < 0) {
>> +               perror("Failed to create L2CAP socket");
>> +               return -1;
>> +       }
>> +
>> +       /* Set up source address */
>> +       memset(&srcaddr, 0, sizeof(srcaddr));
>> +       srcaddr.l2_family = AF_BLUETOOTH;
>> +       srcaddr.l2_cid = htobs(ATT_CID);
>> +       srcaddr.l2_bdaddr_type = src_type;
>> +       bacpy(&srcaddr.l2_bdaddr, src);
>> +
>> +       if (bind(sk, (struct sockaddr *) &srcaddr, sizeof(srcaddr)) < 0) {
>> +               perror("Failed to bind L2CAP socket");
>> +               goto fail;
>> +       }
>> +
>> +       /* Set the security level */
>> +       memset(&btsec, 0, sizeof(btsec));
>> +       btsec.level = sec;
>> +       if (setsockopt(sk, SOL_BLUETOOTH, BT_SECURITY, &btsec,
>> +                                                       sizeof(btsec)) != 0) {
>> +               fprintf(stderr, "Failed to set L2CAP security level\n");
>> +               goto fail;
>> +       }
>> +
>> +       if (listen(sk, 10) < 0) {
>> +               perror("Listening on socket failed");
>> +               goto fail;
>> +       }
>> +
>> +       printf("Started listening on ATT channel. Waiting for connections\n");
>> +
>> +       memset(&addr, 0, sizeof(addr));
>> +       optlen = sizeof(addr);
>> +       nsk = accept(sk, (struct sockaddr *) &addr, &optlen);
>> +       if (nsk < 0) {
>> +               perror("Accept failed");
>> +               goto fail;
>> +       }
>> +
>> +       ba2str(&addr.l2_bdaddr, ba);
>> +       printf("Connect from %s\n", ba);
>> +       close(sk);
>> +
>> +       return nsk;
>> +
>> +fail:
>> +       close(sk);
>> +       return -1;
>> +}
>> +
>>   static int l2cap_le_att_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t dst_type,
>>                                                                          int sec)
>>   {
>> @@ -1709,6 +1773,7 @@ static void usage(void)
>>          printf("Options:\n"
>>                  "\t-i, --index <id>\t\tSpecify adapter index, e.g. hci0\n"
>>                  "\t-d, --dest <addr>\t\tSpecify the destination address\n"
>> +               "\t-p, --peripheral mode\t\t\tStar Listening on Att Channel\n"
>>                  "\t-t, --type [random|public] \tSpecify the LE address type\n"
>>                  "\t-m, --mtu <mtu> \t\tThe ATT MTU to use\n"
>>                  "\t-s, --security-level <sec> \tSet security level (low|medium|"
>> @@ -1720,6 +1785,7 @@ static void usage(void)
>>   static struct option main_options[] = {
>>          { "index",              1, 0, 'i' },
>>          { "dest",               1, 0, 'd' },
>> +       { "peripheral",         1, 0, 'p' },
>>          { "type",               1, 0, 't' },
>>          { "mtu",                1, 0, 'm' },
>>          { "security-level",     1, 0, 's' },
>> @@ -1738,9 +1804,10 @@ int main(int argc, char *argv[])
>>          bdaddr_t src_addr, dst_addr;
>>          int dev_id = -1;
>>          int fd;
>> +       int peri_cent = CENTRAL_MODE;
>>          struct client *cli;
>>
>> -       while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:i:",
>> +       while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:p:i:",
>>                                                  main_options, NULL)) != -1) {
>>                  switch (opt) {
>>                  case 'h':
>> @@ -1809,6 +1876,17 @@ int main(int argc, char *argv[])
>>                          }
>>
>>                          break;
>> +               case 'p':
>> +                       if (strcmp(optarg, "peripheral") == 0)
>> +                                peri_cent = PERIPHERAL_MODE;
>> +                       else if (strcmp(optarg, "central") == 0)
>> +                               peri_cent = CENTRAL_MODE;
>> +                       else {
>> +                               fprintf(stderr,
>> +                                       "Allowed Modes: peripheral, central\n");
>> +                               return EXIT_FAILURE;
>> +                       }
>> +            break;
>>                  default:
>>                          fprintf(stderr, "Invalid option: %c\n", opt);
>>                          return EXIT_FAILURE;
>> @@ -1836,14 +1914,21 @@ int main(int argc, char *argv[])
>>                  return EXIT_FAILURE;
>>          }
>>
>> -       if (!dst_addr_given) {
>> -               fprintf(stderr, "Destination address required!\n");
>> -               return EXIT_FAILURE;
>> -       }
>> +    if(peri_cent == CENTRAL_MODE)
>> +    {
>> +        if (!dst_addr_given) {
>> +            fprintf(stderr, "Destination address required!\n");
>> +            return EXIT_FAILURE;
>> +        }
>> +
>> +    }
>>
>>          mainloop_init();
>>
>> -       fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
>> +    if(peri_cent == CENTRAL_MODE)
>> +        fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
>> +    else
>> +        fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);
>>          if (fd < 0)
>>                  return EXIT_FAILURE;
>>
>> --
>> 2.17.1
>>
>>
> 
>
diff mbox series

Patch

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index b47914da3..2b732e454 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -36,6 +36,8 @@ 
 #include "src/shared/gatt-helpers.h"
 
 #define ATT_CID 4
+#define CENTRAL_MODE   1
+#define PERIPHERAL_MODE   2
 
 #define PRLOG(...) \
 	printf(__VA_ARGS__); print_prompt();
@@ -1633,6 +1635,68 @@  static void signal_cb(int signum, void *user_data)
 	}
 }
 
+static int l2cap_le_att_listen_and_accept(bdaddr_t *src, int sec,
+							uint8_t src_type)
+{
+	int sk, nsk;
+	struct sockaddr_l2 srcaddr, addr;
+	socklen_t optlen;
+	struct bt_security btsec;
+	char ba[18];
+
+	sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
+	if (sk < 0) {
+		perror("Failed to create L2CAP socket");
+		return -1;
+	}
+
+	/* Set up source address */
+	memset(&srcaddr, 0, sizeof(srcaddr));
+	srcaddr.l2_family = AF_BLUETOOTH;
+	srcaddr.l2_cid = htobs(ATT_CID);
+	srcaddr.l2_bdaddr_type = src_type;
+	bacpy(&srcaddr.l2_bdaddr, src);
+
+	if (bind(sk, (struct sockaddr *) &srcaddr, sizeof(srcaddr)) < 0) {
+		perror("Failed to bind L2CAP socket");
+		goto fail;
+	}
+
+	/* Set the security level */
+	memset(&btsec, 0, sizeof(btsec));
+	btsec.level = sec;
+	if (setsockopt(sk, SOL_BLUETOOTH, BT_SECURITY, &btsec,
+							sizeof(btsec)) != 0) {
+		fprintf(stderr, "Failed to set L2CAP security level\n");
+		goto fail;
+	}
+
+	if (listen(sk, 10) < 0) {
+		perror("Listening on socket failed");
+		goto fail;
+	}
+
+	printf("Started listening on ATT channel. Waiting for connections\n");
+
+	memset(&addr, 0, sizeof(addr));
+	optlen = sizeof(addr);
+	nsk = accept(sk, (struct sockaddr *) &addr, &optlen);
+	if (nsk < 0) {
+		perror("Accept failed");
+		goto fail;
+	}
+
+	ba2str(&addr.l2_bdaddr, ba);
+	printf("Connect from %s\n", ba);
+	close(sk);
+
+	return nsk;
+
+fail:
+	close(sk);
+	return -1;
+}
+
 static int l2cap_le_att_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t dst_type,
 									int sec)
 {
@@ -1709,6 +1773,7 @@  static void usage(void)
 	printf("Options:\n"
 		"\t-i, --index <id>\t\tSpecify adapter index, e.g. hci0\n"
 		"\t-d, --dest <addr>\t\tSpecify the destination address\n"
+		"\t-p, --peripheral mode\t\t\tStar Listening on Att Channel\n"
 		"\t-t, --type [random|public] \tSpecify the LE address type\n"
 		"\t-m, --mtu <mtu> \t\tThe ATT MTU to use\n"
 		"\t-s, --security-level <sec> \tSet security level (low|medium|"
@@ -1720,6 +1785,7 @@  static void usage(void)
 static struct option main_options[] = {
 	{ "index",		1, 0, 'i' },
 	{ "dest",		1, 0, 'd' },
+	{ "peripheral",		1, 0, 'p' },
 	{ "type",		1, 0, 't' },
 	{ "mtu",		1, 0, 'm' },
 	{ "security-level",	1, 0, 's' },
@@ -1738,9 +1804,10 @@  int main(int argc, char *argv[])
 	bdaddr_t src_addr, dst_addr;
 	int dev_id = -1;
 	int fd;
+	int peri_cent = CENTRAL_MODE;
 	struct client *cli;
 
-	while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:i:",
+	while ((opt = getopt_long(argc, argv, "+hvs:m:t:d:p:i:",
 						main_options, NULL)) != -1) {
 		switch (opt) {
 		case 'h':
@@ -1809,6 +1876,17 @@  int main(int argc, char *argv[])
 			}
 
 			break;
+		case 'p':
+			if (strcmp(optarg, "peripheral") == 0)
+				 peri_cent = PERIPHERAL_MODE;
+			else if (strcmp(optarg, "central") == 0)
+				peri_cent = CENTRAL_MODE;
+			else {
+				fprintf(stderr,
+					"Allowed Modes: peripheral, central\n");
+				return EXIT_FAILURE;
+			}
+            break;
 		default:
 			fprintf(stderr, "Invalid option: %c\n", opt);
 			return EXIT_FAILURE;
@@ -1836,14 +1914,21 @@  int main(int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	if (!dst_addr_given) {
-		fprintf(stderr, "Destination address required!\n");
-		return EXIT_FAILURE;
-	}
+    if(peri_cent == CENTRAL_MODE)
+    {
+        if (!dst_addr_given) {
+            fprintf(stderr, "Destination address required!\n");
+            return EXIT_FAILURE;
+        }
+
+    }
 
 	mainloop_init();
 
-	fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
+    if(peri_cent == CENTRAL_MODE)
+        fd = l2cap_le_att_connect(&src_addr, &dst_addr, dst_type, sec);
+    else
+        fd = l2cap_le_att_listen_and_accept(&src_addr, sec, BDADDR_LE_PUBLIC);
 	if (fd < 0)
 		return EXIT_FAILURE;