Commit Graph

858 Commits

Author SHA1 Message Date
Mike J. Chen
93997dab8e tests: bsim: add early disconnect tests for iso and l2cap
Add early_disconnect test cases for iso/cis and l2cap/stress
to test the bluetooth stack handling of disconnects
while transmit is still in progress.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-07-03 11:59:02 -05:00
Emil Gydesen
e72e837971 tests: Bluetooth: Tester: VCP BSIM test
Adds BSIM testing of the VCP features of the BT Tester.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-01 10:54:09 -10:00
Emil Gydesen
2298ec49c7 tests: Bluetooth: Audio: Add common start_broadcast_adv
Add a common function, start_broadcast_adv, to start
broadcast advertisement in the LE Audio BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-01 05:57:48 -10:00
Johan Hedberg
978614abfb tests: bsim: bluetooth: Remove bt_hci_cmd_create() usage
These tests have some sort of simple host implementation, which reuses the
bt_hci_cmd_create() API name, but the implementation is actually local and
something that can be made static. Change the function to be static and
rename it to be more in line with other internal functions.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-06-23 12:44:53 -07:00
Johan Hedberg
b0bed23fd2 Bluetooth: tests: Use bt_hci_cmd_alloc()
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-06-23 12:44:53 -07:00
Vinayak Kariappa Chettimada
045d60e6c9 tests: bsim: Bluetooth: Enable testing periodic adv chains on nRF54lx
Enable testing periodic advertising chains on nrf54l15bsim
target to cover the Controller's use of single timer for
packet and tIFS switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-06-23 12:32:00 -07:00
Pavel Vasilyev
e7a7c590bf tests: bsim: bluetooth: host: privacy: peripheral: Enable nRF5340
Enable privacy peripheral test for nRF5340.

After fixing scan interval, the test started passing on nRF5340 as well.
Enable it for regressions.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-06-23 15:48:35 +01:00
Pavel Vasilyev
dacdf7da74 tests: bsim: bluetooth: host: privacy: peripheral: Fix scan interval
The scan interval must match scan window to start next scanning after
previous window completes. Otherwise, one of advertisements may be
missed and test will fail because it will think that RPA rotation didn't
happen in time.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-06-23 15:48:35 +01:00
Anas Nashif
bd8597c9d7 x86: rename DEBUG_INFO to X86_DEBUG_INFO
This is an X86 specific option and should not appear as generic debug
option.

Fixes zephyrproject-rtos/zephyr#52929

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-20 14:43:42 -05:00
Emil Gydesen
2ab5882e0b Bluetooth: CAP: Add cap_unicast_group API
Adds a new abstract struct for unicast group that is
specific for CAP. The difference between this and the BAP
unicast group, is that the parameters are CAP streams and
thus ensuring that the streams in the group adhere to the
additional requirements that CAP has on top of BAP.

This also adds foreach functions for both CAP and BAP
to allow users to iterate on the streams in the
abstract groups.

Various samples, modules and tests have been updated
to use the CAP struct and API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-17 08:20:25 +02:00
Emil Gydesen
e82cabb809 tests: Bluetooth: Audio: Add common TEST_SAMPLE_SIRK
Add a common definition of the TEST_SAMPLE_SIRK used by
the BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-10 22:13:14 +02:00
Emil Gydesen
44d5e8316d tests: Bluetooth: Fix use of BTP PAST event in BSIM
The is_valid_gap_packet_len check for
btp_gap_ev_periodic_transfer_received_ev referenced a field
that was recently removed.

Modify the check to just check the size, as the event now
has not variable length fields.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-10 12:51:32 -04:00
Emil Gydesen
52f089af23 Bluetooth: CSIP: Set member: Fix issue with re-registration
The bt_csip_set_member_register kept a counter that was not
decreased when bt_csip_set_member_unregister was called.
This meant that we could register and unregister CSIS,
but we could not re-register once it had been unregistered.

This commit fixes this by removing the counter and instead
rely on the service instance state, which also requires restoring
the original service definition, as well as adding a test that would
have failed with the previous version.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-27 14:45:15 +02:00
Emil Gydesen
60e9f99582 tests: Bluetooth: Split CAP and GMAP AC tests into separate scripts
This commit splits the CAP and GMAP audio configuration (AC)
tests into separate scripts. The purpose of this is to reduce
the runtime of the individual scripts (some, like the cap_ac_11,
tests takes a long time to run all combinations).
This split also improves support for running them in parallel.

An additional, positive, side effect of this is that the logs will
also be smaller per run.

The new scripts can be run directly, or via the e.g. _cap_ac_X.sh
scripts that run entire audio configuration for all presets.

The design of how the parameters are passed around, are based
on variable instead of function arguments. Effectively they can
be used for the same thing, but variables have the advantage
that it is easier to deal with longer names,
and that any of the test scripts can be called with additional
arguments that can, when using variables, easily be forwarded
to the call to Execute for the PHY in the
_ac_common.sh.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-27 12:01:59 +01:00
Pavel Vasilyev
9cb00bee6a tests: bsim: bluetooth: mesh: Remove bsim tests with TinyCrypt
As TinyCrypt gets deprecated, we need to remove all bsim tests that use
it. This commit switches all Bluetooth mesh bsim tests to PSA as a
default crypto backend.

This includes:
- removing `CONFIG_BT_MESH_USES_TINYCRYPT` as PSA is default crypto
  backend for mesh. `CONFIG_BT_MESH_USES_MBEDTLS_PSA` is not required to
  be enabled;
- merging `overlay_psa.conf` into `prj.conf` as this configuration
  becomes default for all mesh bsim tests;
- merging `overlay_ss.conf` into `overlay_pst.conf` as secure storage is
  required for running persistent storage bsim tests with PSA;

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-26 13:17:08 +02:00
Pavel Vasilyev
b965128f0f tests: bsim: bluetooth: mesh: Run low latency adv tests with PSA
This is a preparation commit for switching all bsim tests to PSA as
TinyCrypt will be removed soon.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-26 13:17:08 +02:00
Alberto Escolar Piedras
4d4f3728c9 tests/bluetooth & bsim: Fix code compliance issues
Fix issues detected by checkpatch

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-21 12:35:28 +02:00
Aleksandr Khromykh
b3e5aba6ba tests: bluetooth: mesh: bsim test to check memory leak after suspending
Commit adds mesh bsim test to check adv pool memory leakage
after mesh has been suspended.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-05-20 15:25:06 +02:00
Nithin Ramesh Myliattil
70a97a8222 Bluetooth: BAP: Add control point cbs to BASS
For the control point operations, add/modify/
remove source, callbacks are added so that Application
can decide whether to accept/reject the control point
operations.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2025-05-14 14:15:51 +02:00
Pavel Vasilyev
14b4e30cdf bluetooth: host: Deprecated BT_CONN_TX_MAX
After https://github.com/zephyrproject-rtos/zephyr/pull/72090,
`conn_tx_alloc` no longer blocks, and each buffer always has a
corresponding `bt_conn_tx` object. This eliminates the need to configure
the number of `bt_conn_tx` objects via `CONFIG_BT_CONN_TX_MAX`, since
every buffer now carries its own context even when no callback is used.

This commit deprecates `CONFIG_BT_CONN_TX_MAX` as it is no longer
necessary. Instead, `CONFIG_BT_BUF_ACL_TX_COUNT` is used to allocate
`bt_conn_tx` objects for outgoing ACL data. ZLL already uses
`CONFIG_BT_BUF_ACL_TX_COUNT` to configure the number of outgoing ACL
packets. With this change, modifying the packet count will automatically
adjust the number of corresponding contexts, preventing both context
starvatoin and underutilization.

This approach also aligns with ISO, where the number of `bt_conn_tx`
objects for outgoing ISOdata matches `CONFIG_BT_ISO_TX_BUF_COUNT`.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-12 14:54:26 +02:00
Emil Gydesen
277d0c1f89 tests: Bluetooth: CAP: Fix typo STREMT -> STREAM
Fixed a typo in the term "stream".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-06 10:50:22 +02:00
Emil Gydesen
240749c770 tests: Bluetooth: CAP: Add bcast reception with multiple acceptors
Expand the CAP broadcast reception test to also run with
multiple acceptors to better verify correctness in the
procedures.

For this to run more stable, the maximum number of streams
has been reduce to 2, rather than
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-06 10:50:22 +02:00
Arkadiusz Balys
bee2f79dde samples: Enable OpenThread logging in all related samples
Some OpenThread logs were moved from L2 to the OpenThread module,
so enable logging from there to keep previous logging visibility.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2025-05-05 14:25:13 +02:00
Vinayak Kariappa Chettimada
30a634c47a Bluetooth: Controller: Interleaved extended advertising reception
Increase scan aux sets to support interleaved extended
advertising reception in hci_ipc ISO support configuration
in nRF5340 HCI ISO Controller.

CONFIG_BT_MAX_CONN is reduced accordingly as ticker node
instances are shared across all state/role scheduling in the
Controller implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-02 15:20:30 +02:00
Emil Gydesen
abad49b0d3 tests: Bluetooth: BSIM: Store last sent opcode for BT tester
The BT Tester will not provide the opcode in the case of a
BTP error. To help log this for developers, we store the
opcode of the currently outstanding command, so that we can
log it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-02 10:47:32 +02:00
Emil Gydesen
6abdc389d4 Bluetooth: CSIP: Remove bt_csip_set_member_get_sirk
The bt_csip_set_member_get_sirk function is superseded by
bt_csip_set_member_get_info and uses of it has been replaced.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-01 18:15:56 +02:00
Emil Gydesen
d38b0e9ecd tests: BSIM: Bluetooth: Audio: Fix includes
Updates the includes in a a few files to
avoid including unused header files and include the
ones that are used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-01 13:42:37 +02:00
Emil Gydesen
3d9f2d17ed tests: Bluetooth: ISO: Add validation of broadcast info
Add validation of the info the application can retrieve by
calling bt_iso_chan_get_info.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-30 16:26:39 +02:00
Johan Hedberg
6a24e6d152 Bluetooth: tests: Update to use new H:4 buffer encoding
Update the Bluetooth tests to assume the new H:4 encoding for data that's
passing between HCI drivers and their users (normally the host stack).

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-04-29 13:00:33 +02:00
Emil Gydesen
68652a6682 Bluetooth: CAP: Broadcast: Add check for memory allocation for create
When creating a broadcast source with
bt_cap_initiator_broadcast_audio_create there was no check if
all broadcast sources were already allocated, which could cause
a NULL pointer dereference.

Add a check, a test and documentation about possibly
error codes of the function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-28 16:41:06 +02:00
Aleksandr Khromykh
fd818d7274 tests: bluetooth: mesh: test lpn communication after friendship
Commit extends the communication test between the LPN and
the third mesh device by checking that LPN and the third mesh
device can exchange data normally after friendship termination.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-04-25 14:05:27 +02:00
Gudipudi Ramana Kumar
aafcd4f851 bluetooth: audio: Update bad code in BASS to be v1.0.1 compliant
Bad Broadcast Code in BASS/Scan Delegator if BIG_Encryption
field value = 0x03 (Bad_Code), Bad_Code shall be set to the
value 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF according to BASS v1.0.1

Signed-off-by: Gudipudi Ramana Kumar <gudipudiramanakumar@gmail.com>
2025-04-22 16:53:49 +02:00
Aleksandr Khromykh
b53b5e198a bluetooth: rename _bt_gatt_ccc and clarify usage
Bluetooth had two public types with similar name _bt_gatt_ccc and
bt_gatt_ccc, but for absolutely different purposes.
That caused misunderstanding of relationship of them and cases
where to use which one.

Commit changes name of _bt_gatt_ccc to more suitable by usage and
improves documentation of it.

Additionally, it changes name of BT_GATT_CCC_INITIALIZER
to correspond the type name.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-04-17 17:24:19 +02:00
Théo Battrel
77bdc8a435 Bluetooth: Add usage of util_eq and util_memeq
Update `bt_irk_eq` to use `util_memeq` instead of `memcmp` and the
"disconnect" BabbleSim test to use `util_eq` instead of a first
assertion on the size followed by a `memcmp`.

This is done as an example usage of the two new functions.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-04-14 16:06:38 +02:00
Olivier Lesage
7b61bd6518 bluetooth: gatt: Add BT_GATT_CCC_WITH_WRITE_CB()
Add simple helper macro so users can define a CCCD with a write cb
without having to combine BT_GATT_CCC_MANAGED() and
BT_GATT_CCC_INITIALIZER() themselves.

Unlike the changed callback the write callback has a return value
that can be used to reject the write request.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-04-11 16:17:42 +02:00
Pavel Vasilyev
f46fd075d4 tests: bsim: bluetooth: host: hfc_multilink: Run test on nRF5340
Run test on nRF5340 to check if recombination works with HCI IPC
driver.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-11 06:32:58 +02:00
Pavel Vasilyev
82a7110406 tests: bsim: bluetooth: host: hfc: Run test for nRF5340
Run test for nRF5340 to check that it works with a different HCI driver.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-11 06:32:58 +02:00
Emil Gydesen
d8e771ded9 tests: Bluetooth: Add BT Tester GAP smoke test
Add a babblesim test of the BT Tester doing a GAP smoke test
connecting 2 BT testers using BTP.

The purpose of this is to further increase the test coverage
of the BT Tester in CI, as it is only being built, and runtime
errors are typically not caught.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-08 10:49:00 +02:00
Aleksandr Khromykh
69c5c6f40e Bluetooth: Mesh: make corresponding group ID unique
Commit fixes bug when corresponding group ID was never
incremented for independent corresponding relationships.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-03-31 22:01:11 +02:00
Vinayak Kariappa Chettimada
306b6ecdfc tests: bsim: Bluetooth: Enable MIC failure CIS tests
Enable back previously failed CIS tests due to MIC failures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-29 06:32:21 +01:00
Håvard Reierstad
acccd46306 Bluetooth: Mesh: Test pb cancelling in bsim
Adds a provision test to check that provisioning bearers are cancelled
when a provisioning link is opened. Modifies the functionality for
receiving unprovisioned beacons to fail the test if a unprovisioned
beacon is received from the current provisionee after a threshold.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-03-26 16:19:31 +01:00
Håvard Reierstad
062fdc30bd Bluetooth: Mesh: Fix typo in prov bsim
Changes Brearer --> Bearer.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-03-26 16:19:31 +01:00
Emil Gydesen
a15cc2d37c tests: Bluetooth: BAP: Make RX checks less strict
Modify stream_rx.c so that the calls to FAIL are guarded
by the newly added valid_rx_cnt.

This helps prevent timing issues, especially with
broadcast, where the first SDU(s) may be delayed from
the application, and thus may be missed/contain errors.
Now it will only treat missing or error SDUs as a FAIL
if we have received a valid SDU. All fails, will still be
logged. We now also log both valid and total count.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-25 08:43:44 +01:00
Alberto Escolar Piedras
5295e10c26 tests/bsim/run_parallel: Fail if an explicitly listed test is missing
Instead of just printing a warning, fail (return != 0 to the shell)
if a test is missing, or a pattern does not match any test.

Also, warn (and return != 0) if no tests are found when SEARCH_PATH
is provided.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Alberto Escolar Piedras
865c881ed0 tests/bsim: UART: Do not attempt to run empty set of multidevice tests
We never got to add any multidevice tests to the UART driver tests.
So let's not try to run that empty set in CI.

(we have some multidevice UART tests for BT).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Alberto Escolar Piedras
78e772660c tests/bsim/bluetooth: Fix BIS test for 54L15 an 5340
tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh
was split in two in 872b19321f
but for the 54L15 and 5340 it was forgotten in the list of
tests to run.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-20 17:15:27 +01:00
Emil Gydesen
d19abff476 Bluetooth: CSIP: Add support for dynamically setting set size
The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.

The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.

This commit adds a babblesim test for the new API,
as well as a shell command.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-20 14:23:40 +01:00
Emil Gydesen
065dca7e92 Bluetooth: ISO: Make setting ISO data explicit
The stack will no longer implicitly set the data path
for ISO channel, and the responsibility for doing that is
now for the upper layers/applications.

This provides additional flexibility for the higher layers
as they can better control the values and timing of the data
path, as well as support removing and even reconfiguring the
data path at will.
This also removes some complexity from the stack.

This commit also fixed a inconsistency in the disconnected
handler. CIS for centrals as well as BIS were still valid
bt_iso_chan channels in the disconnected callback,
but CIS for peripherals were completely cleaned up at this
point. This issue is fixed by moving the disconnected callback
handling to before the code to cleanup the channel for
peripherals.

Since there is a difference in how you remove data paths
depending on the GAP role (central/peripheral), the
iso_info struct type has been expanded to be more
concise of which type of CIS it is.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-19 10:56:57 +01:00
Emil Gydesen
fb68b4be7e Revert "Bluetooth: Audio: Use generic count_bits to count bits"
This reverts commit ee335399c1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-18 16:39:47 +01:00
Emil Gydesen
ee335399c1 Bluetooth: Audio: Use generic count_bits to count bits
Instead of re-implementing or assuming that POPCOUNT is available
we now use the generic function from Zephyr.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-17 21:03:56 -04:00