Commit graph

2,691 commits

Author SHA1 Message Date
Szymon Janc
2f5145b34f test: bluetooth: tester: Fix GAP/CONN/DCON/BV-05-C test
For GAP/CONN/DCON/BV-05-C PTS expects IUT to fail operation
if the peer does not support Central Address Resolution.

In Test Set there is ALT to start undirected advertising instead
but PTS interpretation is that IUT shall reject directed request
regardless and may then later on follow up with underected
advertising (which PTS doesn't validate). To keep this simple
just reject here.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-03-31 10:26:54 -05:00
Emil Gydesen
c1ff9a5346 tests: Bluetooth: BAP: UC: Add support for supported context
When supported contexts are read we print it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-23 12:33:18 -05:00
Emil Gydesen
2b198cf2cc Bluetooth: Audio: Make "foreach" functions consistent
Modify foreach functions in LE Audio to follow the same pattern:
Return true to continue iterating.
Return false to stop iterating.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-23 08:53:33 -04:00
Valerio Setti
e386c63c4b test: bluetooth: tester: disable optimizations for native_sim
TF-PSA-Crypto's bignum module includes some assembly optimization for
x86, x86_64 and ARM64 platforms. When building for "native_sim/native"
on a 64 bit platform the compiler tries to set 32 bit compatibility mode,
but of course assembly functions between 32 and 64 bits architectures
don't match and therefore the build fails.
Disabling optimizations prevents TF-PSA-Crypto from trying to use
assembly and the test passes.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-03-20 12:32:52 -05:00
Valerio Setti
1b9636e8b4 tests: adjust Mbed TLS header file path
These tests directly reference Mbed TLS/TF-PSA-Crypto include path in
their CMakeLists file. This commits adjust the path with new values.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-03-20 12:32:52 -05:00
Emil Gydesen
57155a5b2b tests: Bluetooth: Audio: Spring cleaning
Add missing header files, remove unused header files,
fix typos and missing static.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-20 18:18:55 +09:00
Kai Cheng
9906fdbe31 Bluetooth: Test: add dependency for bt_uuid_from_str unit tests
bt_uuid_from_str() uses hex2bin() from lib/utils/hex.c and
uuid_from_string() from lib/uuid/uuid.c. Add both dependencies
to each test CMakeLists.txt that compiles
subsys/bluetooth/host/uuid.c, fixing link failures on the
unit_testing platform.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-03-19 11:36:39 +00:00
Kai Cheng
3f70be8dbd Bluetooth: Test: add unit tests for bt_uuid_from_str and bt_uuid_compress
Add comprehensive unit tests for bt_uuid_from_str and bt_uuid_compress
functions to ensure proper conversion of string representations to
Bluetooth UUID structures. Tests cover:

- 16-bit UUID string conversion (e.g., "180d")
- 32-bit UUID string conversion (e.g., "abcdef12")
- 128-bit UUID string conversion with standard format
- Invalid input cases (malformed strings, empty strings, wrong lengths)
- bt_uuid_compress: 128-bit base UUID to 16-bit and 32-bit
- bt_uuid_compress: non-base 128-bit UUID returns -ENOTSUP
- bt_uuid_compress: 16-bit passthrough

Includes proper validation of converted UUID values against
expected results using bt_uuid_cmp().

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-03-19 11:36:39 +00:00
Emil Gydesen
d3ab051d7a Bluetooth: Audio: Shell: Add support for 2 calls as TBS client
Add support for 2 calls to enable the join feature as
client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-18 17:43:12 -05:00
Jamie McCrae
f22592cbc5 tree: Replace FIXED_PARTITION_* macro usage with PARTITION_*
Replaces usage of these deprecated macros with ones that support
fixed and mapped partition compatibles. Also includes an update to
hal_espressif which also (rightly or wrongly) has zephyr specific
code in it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-17 18:24:52 -04:00
alperen sener
75b6f202ff tests: bluetooth: tester: add subrating request BTP CMD
Adding subrating request BTP CMD to tester. Since ZLL does not
support subrating, it is not enabled by default in tester config.

Subrating request is already supported by AutoPTS GAP.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-03-17 18:19:04 -04:00
Emil Gydesen
b908885ec9 Bluetooth: TBS: Remove BT_TBS_SUPPORTED_FEATURES
Remove the Kconfig option BT_TBS_SUPPORTED_FEATURES as it was
not used by the subsystem, but only by applications.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-16 10:08:42 -04:00
Emil Gydesen
f8b573e7a3 Bluetooth: CCP: Modify get_bearer_uci to use output buffer
Modify bt_ccp_call_control_server_get_bearer_uci to
store the bearer UCI in an output buffer, instead of just
providing the pointer.

The reason for this is to make the result thread safe, and
avoid the user/application having a direct pointer to
internal storage.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-16 10:08:29 -04:00
Emil Gydesen
02ef624438 tests: Bluetooth: Audio: Shell: Fix ctlr bcast stream cnt
Set the CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX and
CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX to match the
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT and
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT count.

This also fixes a compile issue since
CONFIG_BT_ISO_MAX_CHAN=2 and the controller configs
cannot be higher than this.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-16 10:06:22 -04:00
Piotr Kosycarz
b626e8b4b7 tests: bluetooth: shell: make bluetooth tag common
So that all test cases has a tag.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2026-03-13 14:31:48 -07:00
Cheng Chang
541e03c962 tests: bluetooth: classic: Add test suite a2dp source
IUT works as a a2dp source. The peer device, a2dp sink is
a PC with running bumble on it.

The test content are follows:
case 1: test API register_ep. The api is used to register endpoint.
The case tests it when the parameters is correct or incorrect.
case 2: test API a2dp connect. This case repeats the a2dp connect
operation to verify its correctness
case 3: test API a2dp disconnect.This case repeats the a2dp connect
operation to verify its correctness
case 4: test API a2dp discover. The case send discover and get
(all)capabilities cmd to a2dp source.
case 5: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from sink to source.
case 6: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from source to sink.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2026-03-11 23:18:57 -04:00
Cheng Chang
34d02af940 tests: bluetooth: classic: Add test suite a2dp_sink
IUT works as a a2dp sink. The peer device, a2dp source is
a PC with running bumble on it.

The test content are follows:
case 1: test API register_ep. The api is used to register endpoint.
The case tests it when the parameters is correct or incorrect.
case 2: test API a2dp connect. This case repeats the a2dp connect
operation to verify its correctness
case 3: test API a2dp disconnect.This case repeats the a2dp connect
operation to verify its correctness
case 4: test API a2dp discover. The case send discover and get
(all)capabilities cmd to a2dp source.
case 5: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from source to sink.
case 6: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from sink to source.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2026-03-11 23:18:42 -04:00
Lyle Zhu
92ee8bae34 tests: bluetooth: tester: fix registered_services bitmap size
The registered_services bitmap was incorrectly sized using
BTP_SERVICE_ID_MAX, which is the last valid service ID (starting
from 0). This caused the bitmap to be one element too small.

Fix by defining BTP_SERVICE_ID_COUNT as (BTP_SERVICE_ID_MAX + 1)
and using it for the ATOMIC_DEFINE size to properly accommodate
all service IDs from 0 to BTP_SERVICE_ID_MAX inclusive.

Add comment explaining the service ID indexing and count calculation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-11 11:40:40 +01:00
Emil Gydesen
4cbe8a3313 tests: Bluetooth: tester: Use bt_tbs_client_get_by_index
Instead of reading the CCID and then using
bt_tbs_client_get_by_ccid to get the instance to provide the handles
event, we can now just use bt_tbs_client_get_by_index directly.

This also changes so that the upper tester will receive a
handles event for each instance, and not just for GTBS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-09 11:11:36 -05:00
Szymon Janc
743974d175 tests: Bluetooth: Update ICS to TCRL pkg102
Updated to TCRL pkg102. No functional changes.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-03-04 16:43:31 +00:00
Emil Gydesen
0e07f62e3a Bluetooth: CCP: Fix bad uses of TBS_MAX_PROVIDER_NAME_LENGTH
Several places used CONFIG_BT_TBS_MAX_PROVIDER_NAME_LENGTH
instead of
CONFIG_BT_CCP_CALL_CONTROL_SERVER_PROVIDER_NAME_MAX_LENGTH.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-04 14:34:10 +00:00
Emil Gydesen
f5f9a0e0f3 Bluetooth: CCP: Modify get_bearer_provider_name to use output buffer
Modify bt_ccp_call_control_server_get_bearer_provider_name to
store the bearer provider name in an output buffer, instead of just
providing the pointer.

The reason for this is to make the result thread safe, and
avoid the user/application having a direct pointer to
internal storage.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-04 14:34:10 +00:00
Gaetan Perrot
4d4cbe39d0 tests: bluetooth: controller: mock_ctrl: ll_assert: fix printf format
Use the correct unsigned format specifier to match the uint32_t line
argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-03-03 17:57:21 +01:00
Lyle Zhu
9211d541d9 Bluetooth: Classic: shell: Increase RX stack size
Increase the Bluetooth RX stack size from the default to 2048 bytes in
the BR/EDR shell test configuration. This provides additional stack
space needed for processing complex Bluetooth Classic operations,
particularly when handling nested SDP attribute parsing.

The increased stack size ensures:
- Sufficient space for recursive SDP attribute parsing
- Prevention of stack overflow during BR/EDR operations

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 17:57:11 +01:00
Thomas Hebb
58812d0519 tests: bluetooth: shell: Test compilation of DID profile
No test currently builds Zephyr with CONFIG_BT_DID set, meaning errors
in that feature are not caught by CI.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2026-03-02 10:49:56 +01:00
Emil Gydesen
dd4a01af48 Bluetooth: TBS: set_uri_scheme_list single string instead of array
Refactor bt_tbs_set_uri_scheme_list to take a single string instead
of an array of URIs. This should not affect applications much
in any way (and may actually be easier to use), but simplifies
the implementation significantly, and reduces memory footprint.

Additionally it also make the client and server more similar
as bt_tbs_client_read_uri_list just returns it as a single
string as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:10:38 +01:00
Emil Gydesen
3b93203348 tests: Bluetooth: Audio: Remove unused mocks
After the switch to the native_sim board instead of
the unit_testing board, we no longer need or use these
mocks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:08:34 +01:00
Emil Gydesen
9311480730 tests: Bluetooth: CAP: Fix issues in BAP BA mock
Fix wrong assignment to pa_sync_state.
Add missing call to recv_state_removed

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-19 10:00:45 -06:00
Radosław Koppel
25f4286c71 tests: bluetooth: host: conn: Disable GATT GAP svc validation
Disable the GATT GAP service validation for the test.

This test mocks bluetooth modules beside of conn and net_buf.
The mock does not contain functionality required by the validation module.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Lyle Zhu
dd1de01d96 tests: bluetooth: tester: add RFCOMM service support
Add RFCOMM service implementation to the Bluetooth tester framework,
enabling testing of RFCOMM protocol functionality over Bluetooth
Classic connections.

The implementation includes:
- RFCOMM DLC (Data Link Connection) management with support for up to
  10 concurrent channels and 5 server instances
- BTP (Bluetooth Test Protocol) command handlers for connect,
  disconnect, send data, listen, send RPN, and get DLC info operations
- Event notifications for connection state changes and data transfer
- Integration with the existing BTP service infrastructure

Enable RFCOMM support in the Bluetooth Classic test configuration.

Co-Author: Jiawei Yang <jiawei.yang_1@nxp.com>
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-17 15:22:50 +00:00
Emil Gydesen
309b5b3c01 Bluetooth: CAP: Add ep conn check in unicast audio start
Add check in valid_unicast_audio_start_param to verify
that the ep connection matches the member_conn.

Instead of declaring the endpoints in the unit tests, we
not define them in the mock unicast client and use the
discover function to get pointers.

This allows for a proper implementation of
bt_bap_unicast_client_has_ep as well as makes the tests more similar
to a normal application.

This change required a significant change in the unicast_stop
unit tests as well, which uncovered a small bug in the implementation.
The bug was fixed as part of this commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-17 10:31:09 +01:00
Johan Hedberg
dd37a250b1 Bluetooth: Host: Remove leftover k_poll related code
There's no use of k_poll in the host stack anymore, so remove leftovers
and related definitions.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-02-16 09:03:09 -06:00
Lars Knudsen
00ac90be83 Bluetooth: Shell: Fix BAP USB Audio on windows
On Windows, using the UNDEFINED device class
and terminal types in the devicetree resulted
in the USB Audio device not being selectable as
input/output sound device.

Changing to HEADSET makes it work.

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2026-02-13 09:48:05 -06:00
Herman Berget
62e12edb19 Bluetooth: Host: Use HCI VS command to set public addr on bt_enable
The current way of setting the public address using
`bt_hci_driver_api::setup` does not work well in split builds
where host and controller runs on different cores/socs/boards.
This approach requires each HCI driver and each `hci_<transport>`
application to implement the setup and pass the information on
to the next layer.

Zephyr already defines a vendor-specific command that can be used
to set the public address (`bt_hci_cp_vs_write_bd_addr`).
Use this in `bt_enable` after opening the HCI transport and before
initializing the id module. This makes the setup independent of
hci transport and only depends on a controller that implements the
Zephyr HCI VS commands.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2026-02-12 14:29:44 +00:00
Alex Ciascai
d1f11736e7 bluetooth: tbs: Fix GTBS call handling and add (G)TBS bearer registration
Replaces the previous static bearer registration with a dynamic
runtime registration flow driven by Auto-PTS. This allows the
tester to create GTBS and TBS instances at runtime with complete
metadata in the correct registration orders.

Signed-off-by: Alex Ciascai <ciascai.alexandru@gmail.com>
2026-02-12 14:27:07 +00:00
Alex Ciascai
4ec16b4d53 tests: Bluetooth: HAS: Enable preset sync support for synchronized tests
Configure the HAS tester to advertise preset synchronization support by
setting preset_sync_support=true in bt_has_register(). This passing the
PTS tests, even if we fake the synchronization. The test does not require
an additional lower tester, so there is no other IUT to synchronize with.
Additional any actual inter-device synchronization is expected to be
implemented by the application..

Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
2026-02-11 13:56:05 +01:00
Emil Gydesen
5864564a46 Bluetooth: CCP: Add user_data to bt_ccp_call_control_client_cb
Add a user_data field to bt_ccp_call_control_client_cb. The
field is optional to enable via Kconfig. The field can be used
to provide additional context from the owner of the callback
structure, to the callbacks themselves.

This solves a memory use-after-free issue in the unit tests
where the values from the callback was accessed after they
were released, as the values were just stack allocated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 10:51:43 +01:00
Jamie McCrae
64aab6f80d tests: bluetooth: shell: Remove invalid use of snippets
Snippets in zephyr should be globally usable for general purpose,
snippets for a single application are not a valid use-case (that
is intended for user applications in their own repositories),
therefore remove these

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-02-04 15:30:09 -06:00
Alberto Escolar Piedras
ce7b62a55c tests: Bluetooth: ASCS: Fix link with CONFIG_NO_OPTIMIZATIONS
When this test is built with CONFIG_NO_OPTIMIZATIONS (which is the case
when building with CONFIG_COVERAGE) or when building with debug logging,
it fails to link due to lacking bt_uuid_str().
Let's include the corresponding file so it can link.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-04 15:17:55 +00:00
Szymon Janc
63b43f310a tests: Bluetooth: tester: Fix missing NULL check in PBP BTP
btp_bap_broadcast_local_source_from_src_id_get() may return NULL.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-01-30 11:07:05 +01:00
Lyle Zhu
53ada3ba72 tests: Bluetooth: Support unpair for classic bonding
The bonding information of classic can be deleted by calling the
function `bt_br_unpair()`.

The BTP command `unpair` does not support the case. Calling the
function `bt_br_unpair()` to delete classic bonding information if
the address is BR type when the BTP command `unpair` is received.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-26 14:15:29 +01:00
Lyle Zhu
0d73d29962 bluetooth: classic: add callback for incoming connection requests
Add a callback mechanism to allow applications to handle incoming
BR/EDR connection requests and decide whether to accept or reject
them, as well as specify the desired role (central/peripheral).

Update bt_br_set_connectable() to accept an optional callback function
parameter. When provided, callback is invoked on incoming connection
requests, allowing the application to inspect the remote device address
and Class of Device before accepting or rejecting the connection.

If no callback is provided, the connection request is accepted
internally with the default behavior based on the
`CONFIG_BT_ACCEPT_CONN_AS_CENTRAL` configuration option.

The accept_conn() function is updated to:
- Call the registered callback if available
- Pass the remote device address and Class of Device to the callback
- Accept the connection if the callback returns BT_BR_CONN_REQ_ACCEPT_*
- If the returned value is BT_BR_CONN_REQ_ACCEPT_CENTRAL, the role
  switch will be requested.
- Reject the connection if the callback returns BT_BR_CONN_REQ_REJECT_*
- Add error handling and logging for failed connection acceptance

Update all existing callers of bt_br_set_connectable() to pass NULL
for the callback parameter to maintain backward compatibility.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-26 12:01:22 +01:00
Lyle Zhu
2a7e90b1e3 tests: bluetooth: shell: add test for accept_conn_as_central
Add a new test case for the Bluetooth shell to verify the
BT_ACCEPT_CONN_AS_CENTRAL configuration option.

The test uses the BR/EDR configuration and enables the option to
accept incoming ACL connections as central role.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-26 12:01:22 +01:00
Emil Gydesen
018482e3e9 tests: Bluetooth: Tester: Fix miss check and alloc in BAP broadcast
Some of the BAP broadcast functions was missing a check for
allocated.

Adding the checks exposed a bug in the CAP commands where
the broadcasts were never actually allocated. Since there
is not a command for that in CAP, a workaround has been
implemented to use the first command (setup_stream) to
allocate a BAP broadcast with a dummy broadcast ID.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-25 17:06:13 +01:00
Vinayak Kariappa Chettimada
0b1b099196 Bluetooth: Controller: Fix PAST sync_offset_us calculation
Fix the missing use of remainder value in the sync_offset_us
calculations. Also, Periodic Sync reception is relative to
Peripheral event hence ticks_anchor does not require the
ticker margin and event jitter to be subtracted.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 14:09:11 +00:00
Szymon Janc
258eef1017 tests: Bluetooth: Bump qualification materials to Core Spec 6.2
This enables Bluetooth Core 6.2. No functional changes.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-01-20 15:33:36 +00:00
Emil Gydesen
d74f5d7d23 Bluetooth: Audio: depend on UTF8
Add a dependency for UTF8 for LE Audio. Since (nearly?) all
string in LE Audio are UTF8 and that the stack wants to be
able to check and validate strings coming both from remove
deviecs and from the application, it will depend on the utf8
API that is guarded by CONFIG_UTF8.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-20 13:20:52 +00:00
Gaetan Perrot
e38ddf4edf tests: bluetooth: btp_mesh: return error when blob target list is full
cmd_blob_target() always returned 0 even when the target list was
full, making error checks at call sites unreachable.

Return a proper error code when no more targets can be added so
callers can correctly detect and handle the failure.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-19 16:03:28 +00:00
alperen sener
8907c9ab8d tests: Bluetooth: tester: Fix Central Address Resolution chr. read
CAR characteristic read process was incomplete, CAR status was not
actually stored.

Added a new BTP_GAP_EV_PEER_CAR_RECEIVED to tester. This is to
prevent disconnect events before IUT successfully reads CAR from
central.

Updated start_directed_advertising() so that if the central has
no CAR support we must not send directed advertisements. IUT
might enter another connectable mode according to specification,
thus IUT starts sending connectable undirected advertisements with
resovable address.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-01-19 10:04:25 +01:00
Emil Gydesen
d30ed27049 Bluetooth: Tester: Remove empty file hci_ipc.conf
The file is unused and the use of it has been removed from
autopts.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-16 11:40:13 +00:00