Commit graph

524 commits

Author SHA1 Message Date
Alberto Escolar Piedras 61be043f26 tests/bsim/sh_common.source: Set a variable with the board target string
As now, with hwmv2, boards can have "/" in their name,
and the board name is not anymore the complete target
name, let's set a new variable with the
whole board target name, but converted into the format
which can be used in paths.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 3041f05d18 tests/bsim/bt l2cap/stress: Be more silent
This test was way too verbose (produced a log over 65000 lines
long).
Let's mute it a bit. If the test fails, developers
can raise the log level as needed.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Jonathan Rico 06f6c5c992 doc: bsim: Move contents into .rst
This makes the information more discoverable and linkable in the docs.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-22 15:59:49 -04:00
Carles Cufi 592f434d0e Revert "Bluetooth: tests: bsim: host/adv/resume2"
This reverts commit d00cdf9868.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-03-22 07:36:55 -04:00
Aleksander Wasaznik d00cdf9868 Bluetooth: tests: bsim: host/adv/resume2
This test is an attempt at formalizing at least part of the behavior
described in commit 6a79c3deae.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-22 10:25:07 +01:00
Alberto Escolar Piedras f3360265e6 tests|samples/bluetooth: Fix sysbuild due to BOAD_IDENTIFIER
After https://github.com/zephyrproject-rtos/zephyr/pull/70438
got merged simultaneously with
https://github.com/zephyrproject-rtos/zephyr/pull/70564
all these tests stopped building properly due to the
change of avaliable variables in Kconfig & cmake.
Let's fix them.
As a bonus, as for kconfig the BOARD_TARGET_STRING is the
same for the hwmv1 backwards compatible name, let's
just remove the check for the old names.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-21 18:44:04 +01:00
Emil Gydesen 984b0807c4 tests: Bluetooth: PBP: Fix several issues in the PBP bsim tests
The PBP bsim tests had several issues that was not uncovered
until the PA sync timeout was increased. This commit fixes these,
as well as increase some timeout values due to recently
increased PA sync timeout.

Among the issues were lack of support for the alternating PBA
features, missing reset of values and specific time sleeps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-21 15:24:14 +01:00
Emil Gydesen 0dcf3c197e Bluetooth: Audio: Increase PA sync timeouts
Increase the timeouts to be 60 instead of 6.
The reason for this is that some controllers (like the Zephyr
controller) will reserve some of these to ensure stability,
and in fact with skip = 5 and retry = 6, it would still
send the PA reports at every interval.

To accomodate a higher timeout value, the functions used to
convert PA intervals to PA timeouts have been updated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-21 15:24:14 +01:00
Alberto Escolar Piedras 1f4f307bd2 samples|tests/* yamls: Replace all nrf5340bsim hwmv1 names w hwmv2 version
Replace all instances of
nrf5340bsim_nrf5340_cpunet & nrf5340bsim_nrf5340_cpuapp
with
nrf5340bsim/nrf5340/cpunet & nrf5340bsim/nrf5340/cpuapp
In these samples/tests twister yamls definitions.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-21 15:23:56 +01:00
Alberto Escolar Piedras 4235efc7bd samples|tests several: Support using nrf5340bsim hwmv2 names
For all samples which handle the nrf5340bsim in some special way
(for example in sysbuild files, or by checking what samples are
supported) handle also building with the hwmv2 names.

Also, let's fix the cmake info message in these respective
samples which tells the user which board target is used for which
part of the app.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-21 15:23:56 +01:00
Aleksander Wasaznik 1e2b889bbb Bluetooth: tests: use global testlib in read_fill_buf
This deduplicates a copy of testlib from before testlib was a globally
available cmake library.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-21 10:08:01 +00:00
Nithin Ramesh Myliattil 139a40098b Tests: Bluetooth: Host: update rpa expired bsim to cover more use cases
rpa expired bsim is refactored so that every rpa rotation, one of
the adv set belong to an adv_id returns false based on adv_index.
In turn all adv sets under the same adv_Id continues with old rpa.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-03-20 07:55:49 -05:00
Alberto Escolar Piedras ecf29a2f46 tests/bsim/bt l2cap/stress: Be more silent
This test was way too verbose (produced a log over 65000 lines
long).
Let's mute it a bit. If the test fails, developers
can raise the log level as needed.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-19 10:25:07 -05:00
Alberto Escolar Piedras f4972347d4 tests/bsim/bt l2cap/stress: Increase runtime timeout
This test has been seen failing in the new runners
due to a (realtime) timeout.
Let's double the timeout so it does not.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-19 14:30:22 +01:00
Alberto Escolar Piedras 731ba72423 tests/bsim: Reorder tests to avoid failure in GATT/SR/GAS/BV-01-C
GATT/SR/GAS/BV-01-C has just broken due to what appears
like a minor timing change.
This indicates the test may be too time sensitive.
Just reordering the tests, it passes again.
So let's reorder the test list, and we get the minor
benefit of havign them move alphabetically ordered.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-18 19:11:53 +00:00
Rubin Gerritsen 7c2f26bd2a Bluetooth: Host: Add macros for contiuous scanner
It is often desired to maximize the chances of receiving advertising
when scanning. To achieve this, the scanner should be enabled all the time.

Some controller implementations (like Nordic's SoftDevice Controller)
handle scheduling differently when scan_window = scan_interval.
Having a macro that defines this scanning configuration simplifies
writing applications.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-03-14 17:03:44 -05:00
Jonathan Rico 074a541fb0 tests: Bluetooth: add minimal coverage for BT_RECV_WORKQ_SYS
Run the l2cap stress test so we have some minimal runtime coverage of that
config.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-14 10:21:23 +02:00
Emil Gydesen 8956642265 tests: bsim: Bluetooth: CAP Commander Change Microphone Gain
Adds bsim test of the CAP Commander Change Microphone Gain
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-12 17:56:09 +00:00
Alberto Escolar Piedras d592455cc0 tests/bsim mesh: Increase realtime timeout
One of these tests has been seen failing in older slower
computers due to timeouts, let's increase the timeout so
we don't break in those cases.
Note this timeout is just a safety to eventually kill
hung simulations even if nobody presses Ctrl+C.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-12 22:15:34 +09:00
Alberto Escolar Piedras e9c8856165 tests/bsim audio mcs_mcc: Increase realtime timeout
This test has been seen failing in older slower computers
due to timeouts, let's increase the timeout so we don't
break in those cases.
Note this timeout is just a safety to eventually kill
hung simulations even if nobody presses Ctrl+C.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-12 22:15:34 +09:00
Alberto Escolar Piedras 0888882262 tests/bsim broadcast_audio: Increase realtime timeout
This test has been seen failing in older slower computers
due to timeouts, let's increase the timeout so we don't
break in those cases.
Note this timeout is just a safety to eventually kill
hung simulations even if nobody presses Ctrl+C.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-12 22:15:34 +09:00
Nithin Ramesh Myliattil 6ce38c1aa7 bluetooth: id: fix adv sets with same id use different RPA
The fix is to check if any of the adv set's rpa expired
callback returns false, then all adv sets continues with
the old RPA.

Note: Fix is applicable only to adv sets which shares the
same id.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-03-11 14:24:41 +01:00
Aleksandr Khromykh aa87ed5d8a Bluetooth: Mesh: make models metadata const
Commit adds const qualifier to models metadata.
Specification claims: Composition Metadata Page 0
shall not change during a term of a node on the network.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-03-11 09:26:12 +01:00
Chang An 3605d57ae1 LE Audio: bt_bap_broadcast_sink_cb.syncable should provide the BIGInfo
Modify bt_bap_broadcast_sink_cb.syncable to provide the BIGInfo
instead of just the encryption field.

Signed-off-by: Chang An <chang.an_1@nxp.com>
2024-03-07 11:09:12 +00:00
Emil Gydesen 55bd06b03e tests: bsim: Bluetooth: Add bcast validation of bt_bap_ep_get_info
The broadcast sink and broadcast source will now use and verify
the info returned by bt_bap_ep_get_info.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-04 14:05:07 +01:00
Emil Gydesen a7fe853436 tests: bsim: Bluetooth: Add broadcast sink cfg data validation
Add additional validation of the config data in the broadcast
sink test, both ensuring that the BASE is properly parsed,
that the BASE contains mandatory information and that the
stream get the right values copied.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-01 16:04:19 +01:00
Emil Gydesen 8a6c1d9bfa Bluetooth: BAP: Broadcast source: Add LTV validation for LC3 data
When using the LC3 codec, all codec configuration are LTV encoded.
The broadcast source did not properly validate this, and it also
uncovered a bug in the bsim test for broadcast sources.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-01 16:04:19 +01:00
Pavel Vasilyev d1da07144e tests: bsim: bluetooth: mesh: Add short delay before suspending stack
The stack manages to suspend the advertiser before it finishes
transmitting the Outbound PDU Report message to confirm the transmission
of a Provisioning PDU. The test requires the server to become
unresponsive when the Provisioning PDU is sent to the unprovisioned
device to test timeout of the provisioning protocol.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-26 14:34:58 +01:00
Pavel Vasilyev febff796bb Revert "bsim: Bluetooth: Mesh: fix provision timeout"
This reverts commit c1bbd48659.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-26 14:34:58 +01:00
Pavel Vasilyev d6ce3e88b6 tests: bsim: bluetooth: mesh: Suspend advertiser from the start callback
Now, when the deadlock is removed from `bt_mesh_adv_disable` function,
the advertiser can be disabled from the `bt_mesh_send_cb`
callbacks.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-26 14:34:58 +01:00
Rubin Gerritsen f086afd47c samples: Bluetooth: Only connect to devices with rssi below -50
When the Bluetooth central samples in an open air environment
it is very likely that there are multiple devices nearby with
a received signal strength stronger than -70 dBm.

To avoid connecting to the wrong device, make the check stricter.

For tests using those samples, the NtNcable attenuation is changed
from the default 60 dBm to 40 dBm to satisfy the new requirement.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-02-26 14:34:07 +01:00
Vinayak Kariappa Chettimada c8dbb97170 tests: bsim: hci_uart: Fix execution timeout
Fix execution timeout to be atleast the simulation
length of the tests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-02-26 11:38:30 +00:00
Vinayak Kariappa Chettimada ff91408385 tests: bsim: hci_uart: Rename to hci_uart test name
Rename uart and uart_async bsim test to reflect
testing of hci_uart sample using UART driver
variants under bsim simulations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-02-26 11:38:30 +00:00
Jonathan Rico 1c73528a10 tests: Bluetooth: add host flow-control test
Verifies that there is no host RX buffer leak due to disconnections.

That is, not actual host buffer objects but rather the number of buffers
that the controller thinks the host has.

If there is a desynchronization between those two, the result would be that
the controller stops forwarding ACL data to the host, leading to an
eventual application timeout.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-02-26 11:32:36 +00:00
Alberto Escolar Piedras 65d49cd434 tests/bsim/bt/host: Split build script in 6
There are quite many BT host test images being built.
Today these are all built in parallel, causing a quite
high load.

Let's split them in their separate sub-scripts,
so we don't parallelize too many builds,
and users have more granularity if they only
want to build a subset.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-02-26 11:40:47 +01:00
Alberto Escolar Piedras 940d53e839 tests bsim/bt/ll: Split build script in 2
The CIS tests are building quite many
apps on their own.
Let's split them in their separate sub-script,
so we don't parallelize too many builds,
and users have more granularity if they only
want to build a subset.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-02-26 11:40:47 +01:00
Emil Gydesen 41a589c5fa Bluetooth: CSIP: Add support for dynamic SIRKs
Add support for dynamically change the SIRK in a CSIS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-25 22:28:26 -05:00
Emil Gydesen d78604e690 Bluetooth: Audio: Remove the BT_AUDIO_CODEC_LC3_CONFIG_X_Y
LC3 does not define any such configurations, and they are in
fact defined by the BAP. The LC3 header file should thus not
pretend that there are these specific configurations for LC3.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-25 22:26:57 -05:00
Emil Gydesen 341906a0fd tests: bsim: Bluetooth: CAP Commander Change Volume mute
Adds bsim test of the CAP Commander Change Volume mute
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-25 22:25:26 -05:00
Emil Gydesen 686a8c9e54 tests: bsim: Bluetooth: Add GATT encrypt tests
Add tests for the GATT permissions to read and write for
characteristics that require encryption and LESC encryption.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-19 20:46:28 +01:00
Emil Gydesen fa4a6f3c68 tests: bsim: Bluetooth: Fix GATT long read test
The test where it was supposed to read the long characteristic,
only read the "small" characteristic, due to setting the wrong handle.

With the right handle, the test failed and the test had to be
updated to store the data across multiple reads, and then do
the proper comparison.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-19 20:46:28 +01:00
Emil Gydesen 2fbc5b1ae2 samples: Bluetooth: Minor improvements for broadcast audio sink
Increases some of the timeouts so that when using this sample
against other interactive devices (such as a phone or the
Zephyr audio shell), then it's easier to do it in time.

Also updates a few of the printks and ensures that we are not
doing name filtering when we have been requested to sync to
a specific broadcast source by a broadcast assistant.

The test for the sample has also been modified to have a longer
timeout to accomodate for the new semaphore timeout values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-14 22:27:26 +01:00
Ping Wang 5ccd75b49b Bluetooth: Audio: define bt_bap_bass_subgroup struct.
The Broadcast Assistant API should be fully independent of the scan
delegator. Therefore the new struct bt_bap_bass_subgroup has been
defined to avoid a dependency.

Fixes: #68338

Signed-off-by: Ping Wang <pinw@demant.com>
2024-02-14 19:04:01 +01:00
Emil Gydesen 3e634268d6 Bluetooth: ISO: Introduce bt_iso_chan_send_ts
The bt_iso_chan_send function could take an optional
timestamp by using 0 as an indicator. The issue with
this approach was that a timestamp value of 0 is valid,
and could cause potential issue with syncing streams
in a group.

To fully support transmitting with and without timestamp,
bt_iso_chan_send_ts has been introduced, which is the only
function of the two (bt_iso_chan_send being the other) that
supports timestamps.

A new function, rather than adding a boolean to the existing,
was chosen as it simplifies the individual functions as well
as making it more explicit what the function does.

Since the bt_iso_chan_send function is used by LE audio, both
the BAP and CAP send functions have similarly been updated.
Likewise, all tests and samples have been updated to use the
updated function(s), and BT_ISO_TIMESTAMP_NONE has been
removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-12 13:13:10 +01:00
Pavel Vasilyev 30ccd55f4c tests: bsim: bluetooth: mesh: Add advertiser suspend test
Add a test that checks that both advertisers, the legacy and the
extended behaves identically when the stack is suspended, in particular:
- `bt_mesh_send_cb.end` callback is called with error code `0` for the
  advertisement that the advertiser already pushed to the ble host
  (called `bt_mesh_send_cb.start`),
- `bt_mesh_send_cb.start` callback with error `-ENODEV` is called for
  every advertisement that was pushed to the mesh advertiser using
  `bt_mesh_adv_send` function before the stack was suspended,
- `bt_mesh_adv_create` returns NULL when attempting to create a new
  advertisement while the stack is suspended.

The `bt_mesh_adv_disable` is called from the work because calling it
from the `bt_mesh_send_cb.start` callback will cause a deadlock.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 10:11:19 +00:00
Pavel Vasilyev b352301d80 tests: bsim: bluetooth: mesh: Change error code on timeout
This commit changes error code returned by `k_sem_take` when it times
out from `-EAGAIN` to `-ETIMEDOUT` because `bt_le_scan_start` also
returns `-EAGAIN` if bt device is not ready, which may lead to invalid
test behavior.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 10:11:19 +00:00
Luis Ubieda f59eb2f1e9 Tests: Bluetooth: Host: Add ext-adv test to iterate reconnections
Where advertisement, connection and disconnection is iterated over 5
times, to verify the reestablishment of extended advertisements when
iterating over multiple times. Additionally, the connection
unreferencing has been decoupled from the disconnect event on both
sides, to demonstrate the dependency of the recycle event.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-02-07 22:50:16 +01:00
Luis Ubieda 1f0346c45a Tests: Bluetooth: Host: Split ext-advertisements in separate builds.
Split into two separate builds: advertiser and scanner to emphasize
clarity and robustness during reestablishment of advertisements and
scanning.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-02-07 22:50:16 +01:00
Kamil Piszczek 129b73ce26 bluetooth: gatt: remove operation infix from authorization callback API
Removed the "operation" infix from the bt_gatt_authorization_cb
callback structure in the Bluetooth GATT header.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-02-07 15:36:25 +00:00
Emil Gydesen 7643526086 Bluetooth: BAP: Do not send PA term request on local remove
If the receive state is locally removed, then we should not
request permission from the application, as that is implicit
when removing the source locally.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-05 17:45:45 +01:00
Emil Gydesen cbc81b2a0f Bluetooth: Audio: Remove LC3 from the assigned numbers defines
The defines from the Bluetooth Audio assigned numbers are not
specific for LC3. This commit removes the LC3 infix and
the reference to LC3 in the documentation for them.

It also cleans up some of the documentation and
names of the enums.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-05 09:14:44 -06:00
Emil Gydesen 065253c173 Bluetooth: CAP: Make unicast stop more similar to unicast start
Modify the parameters for bt_cap_initiator_unicast_audio_stop
so that they are more similar to
bt_cap_initiator_unicast_audio_start.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-04 19:54:18 -06:00
Emil Gydesen ec549cebd5 Bluetooth: CAP: Make unicast update more similar to unicast start
Modify the parameters for bt_cap_initiator_unicast_audio_update
so that they are more similar to
bt_cap_initiator_unicast_audio_start.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-04 19:54:18 -06:00
Emil Gydesen f35e9871d5 Bluetooth: CAP: Remove unicast group param from unicast_audio_start
Since we can always lookup the group from the streams, the
group parameter had no purpose.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-04 19:54:18 -06:00
Emil Gydesen 954f2a09fb tests: bsim: Bluetooth: Audio: Add additional testing of discovery
Expand the babblesim tests for LE audio to verify that all the
discovery functions can be called multiple times without error.

HAS is an exception as that has an existing separate check
that disallows discovery multiple times.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-02 09:34:52 -06:00
Emil Gydesen ec41dd9ba6 Bluetooth: Audio: Use BT_GATT_SUBSCRIBE_FLAG_VOLATILE
The LE Audio implementations do not really support bonding yet,
and removing subs on disconnect is the most effective (and correct)
way of ensuring that we do not subscribe more than once when we
re-discover after reconnection.

The broadcast assistant and the media control client does not
support multiple connections as of this commit, so they needed
special treatment. In the case that we do discovery on multiple
ACL connections, it is important that the existing subscriptions
are removed correctly by calling bt_gatt_unsubscribe.

In order to implement this change properly on some of the clients,
thet had no proper connection references or support
for clearing the data on disconnects, they had to be updated
as well.

The csip_notify.sh test has been disabled, as that expected a
notification in the client, but since this commit removes that
(until bonding is properly supported in the clients), then the
test will fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-02 09:34:52 -06:00
Emil Gydesen 922ac3c7c1 Bluetooth: Audio: Add missing error checks for calls to bt_gatt_subscribe
Several places the LE Audio clients called bt_gatt_subscribe without
checking the return value, which could cause some issues in the worst
case, and in the best case, cause some unexpected behavior.

Some implementations had a bit more updating to handle the new
behavior.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-02 09:34:52 -06:00
Emil Gydesen 81a1826e13 tests: bsim: Bluetooth: CSIP: Increase EXECUTE_TIMEOUT to 30
Some of the CSIP tests take a while to run given the number of
devices, and some of them started to fail in CI because of a
timeout, so we increase the EXECUTE_TIMEOUT a bit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-01 17:00:47 +01:00
huajiang zheng 3d9f76b8e5 Bluetooth: Host: add unregister connection callback function
[Description]
tests: shell: Restart bt will register the same connection callback twice.
Callback next node point to itself, when link established callback function
loop infinitely.
[Fix]
Unregister the previous callback to avoid register repeatedly.
[Test]
After bt init/disable times, create connection successfully.

Signed-off-by: huajiang zheng <huajiang.zheng@nxp.com>
2024-02-01 16:05:38 +01:00
Luis Ubieda 7e5b2a79fc Tests: Bluetooth: Host: Added Test for extended Advertisements
Where extended advertising is restablished through the use of
recycled() callback, registers over bt_conn_cb_register().

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-02-01 14:31:27 +00:00
Andries Kruithof b7078286d2 Bluetooth: audio: test: add test for long write
Added a test for long write, long read, and notifications

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-02-01 14:37:40 +01:00
Stine Åkredalen fcb8fa7b02 tests: bluetooth: mesh: blob test bugfix
Added missing end marker to test instance

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-02-01 10:28:53 +00:00
Emil Gydesen 8459560448 tests: bsim: Bluetooth: CAP Commander Change Volume Offset
Adds bsim test of the CAP Commander Change Volume Offset
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-31 21:35:17 -05:00
Emil Gydesen 029afad6c1 Bluetooth: CSIP: Add bt_csip_set_member_unregister
Add support for unregistering a CSIS as the CSIP set member.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-31 21:34:27 -05:00
Emil Gydesen 01d0f1a566 Bluetooth: PBP: Fix parsing and return issue with bt_pbp_parse_announcement
bt_pbp_parse_announcement was defined as uint8_t return value function,
but returned errno values, so it was modified to return an int instead.
The return values are also now more granular and documented.

The function also triggered a coverity issue with the way that it
parsed the data->data, as it would be marked as tainted. This should
be fixed by using the net_buf_simple API, which also improves on
some other parts of the code.

Finally the meta argument for the function was changed from an
unknown sized buffer, where the caller somehow had to know the
size of the metadata before calling the parsing function, to
an output pointer. This also omits the requirement for the
caller to always copy the metadata, where now it just
gets a pointer to the metadata in the bt_data struct. The application
can now always decide whether to continue to parse the metadata or
to copy it, using the pointer and the return value of the function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-31 21:33:56 -05:00
Stine Åkredalen d5b68bad12 tests: Bluetooth: Mesh: add proxy solicitation bsim test
* Test that beacon is received after solicitation
* Test for replay attack

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-01-31 10:34:06 -06:00
Vinayak Kariappa Chettimada daf7c80c15 tests: bsim: Bluetooth: CAP broadcast AC testing updates
Update testing of the Audio Configurations from the BAP
spec using the CAP API.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-01-31 13:45:23 +01:00
Alberto Escolar Piedras 084f3cfc51 tests/bsim build: User kconfig option to set warnings as errors
Use the kconfig option COMPILER_WARNINGS_AS_ERRORS instead
of passing the compiler option directly to the build.
That allows us to do whatever needs to be done in cmake to ensure
warnings are treated as errors.

Also handle better options and paths with spaces on them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-29 14:27:27 +01:00
Alberto Escolar Piedras cf6a3824a0 tests/bsim host/privacy/peripheral: Minor fixes to allow equality check
Minor fixes in this test script to:
* Start with an empty flash even if there was a left over flash file
  on disk
* Not overwrite the simulation activity from the first part of the test
  in the second part of the test, to allow looking into the
  traffic and to allow rerunning the test in check mode, to ensure
  there is no radio activity changes when another change is done.
* Set the simulation id to something more unique (it was just
  "peripheral" before which is too easy to be repeated in another
  test)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-24 21:19:57 +00:00
Jonathan Rico 6fa5d1e6a5 Bluetooth: L2CAP: fix net buf frags handling
Fix the handling of buffers with fragments. What seems to have been
broken is the metadata reference that was not passed to the next frag in
the chain.

Add a test to regression too.

The main user of this is IPSP.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-24 14:56:16 +01:00
Vinayak Kariappa Chettimada d1e4c17e6d tests: bsim: Bluetooth: Mesh: Adjust timeout for Adv Extensions use
Adjust mesh test timing and timeout value for Advertising
Extensions use/fix in Zephyr Controller. The scanning in
Zephyr Controller is delayed when using extended scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-01-24 10:44:12 +01:00
Anders Storrø 93a6ee501a Bluetooth: Mesh: Add artificial beacon delay
After removing 20ms in advertiser, all subnetwork beacons are sent as high
dense packet of frames with minimal distance between them. That might
cause collisions if beacon interval on devices will coincide.

This commit adds an artificial delay between each subnet advertsing
beacons.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2024-01-23 10:02:00 +01:00
Emil Gydesen b857ef7f83 Bluetooth: BAP: Add ISO state callbacks
Add callbacks to the stream objects that reflects the
state of the isochronous channel. The connected callback
is called when the isochronous channel is connected, and
similarly the disconnected callback is called when it is
disconnected.

There is a special case for unicast, where if the ACL
disconnects first, then we won't get a ISO disconnect
callback. It should be assumed that the isochronous channel
is no longer valid when the BAP stream enters the idle state,
i.e. when the "released" callback is called.

The purpose of the new callbacks is to provide additional
information to the application. Especially the unicast client
can use this to determine when the stream_start function
can be called again, as there can only ever be 1 outstanding
CIS connection request at a time, but there can be multiple
GATT requests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-22 12:59:11 +01:00
Kamil Piszczek c16d9699a3 tests: bsim: bluetooth: host: gatt: general: improve conn ref handling
Improved the connection reference handling in the BabbleSim test
project in the Bluetooth Host category.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-01-22 10:32:41 +00:00
Kamil Piszczek a369eb7b36 tests: bsim: bluetooth: host: gatt: add authorization callback API test
Added a new BabbleSim test that validates the authorization callback API
from the Bluetooth GATT header.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-01-19 16:08:46 +01:00
Pavel Vasilyev 981c79b7ce Bluetooth: Mesh: Drop explicit support for Bluetooth Mesh 1.0.1
Bluetooth Mesh Protocol 1.1 is backward compatible with Bluetooth Mesh
Profile 1.0.1, therefore the stack can still be qualified for 1.0.1 if
needed. But explicit support for both versions requires additional
maintenance efforts and doubles the CI time. To make the stack
qualifiable for 1.0.1, the one needs to remove Private Beacons reception
and compile out SHA256 algorithm support.

What is changed:
- Removed `CONFIG_BT_MESH_V1d1` option.
- Removed `transport_legacy.c` which was using 1.0.1 implementation. The
  new transport layer has new SaR logic that should still be possible to
  qualify for 1.0.1.
- Removed the legacy transport Kconfig options. They are superseded by
  the new transport Kconfig options.
- Tester app: `overlay-mesh-v1d1.conf` is merged into
  `overlay-mesh.conf`.
- Removed BabbleSim tests for 1.0.1.
- Updated documentation.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-01-19 12:55:40 +01:00
Emil Gydesen c999e4600d tests: Bluetooth: CAP: Add test of change volume procedure
Add testing of the CAP Commander Change Volume procedure
in BSIM.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-17 12:00:09 -05:00
Alberto Escolar Piedras 53c121381f CI bsim workflow: Add UART tests to the bsim workflow
Add new workflow steps to the babblesim workflow to run
also the UART tests on the nrf52_bsim.
This commit:
* Enables the single device tests (which we may
move to the normal twister workflow once we fix the
requirement for a fixture)
* Adds as a placeholder the infra for multidevice tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 14:55:07 -05:00
Bi Jian 06fa287d45 Bluetooth: Audio: Update audio location definitions
The meaning of bit0 in the audio location bitmap will change to
mono audio, so we update the audio location macro and releated
test cases.

Refer to BT SIG ES-22266.

Signed-off-by: Bi Jian <bi_jian@qq.com>
2024-01-16 14:27:40 -05:00
Emil Gydesen fd3e334539 tests: Bluetooth: Audio: Fix channel allocation
The channel allocation was incorrect when setting up multiple
streams to a single device, in which case we should apply
individual bits to each stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-16 09:31:12 -06:00
Jonathan Rico 38c39af4df Bluetooth: L2CAP: Prepend SDU header immediately
Previously it was not always possible to prepend the header.

It was not possible if the application neglected to reserve the space
for headers.  This is bad because it forces a buffer segment allocation
even if the buffer had enough room for the headers. E.g. a payload of 10
bytes in a netbuf of 30 bytes would have been segmented.

We now explicitly reject the buffer if it does not have the headroom.

This allows us to do a nice thing; simplify L2CAP segmentation.

We convert the SDU from the application into a PDU payload, by
prepending the SDU header, i.e. the SDU length in the original buffer.

This PDU payload is ready to be chunked into PDUs without having to keep
track of where in the SDU we are. This has the effect of removing a
bunch of logic in the segmentation machine.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-01-16 11:29:43 +00:00
Aleksandr Khromykh 4e7d64b1b4 Bluetooth: Mesh: enable access responses randomization
Enable by default the access layer responses random delays.
Commit also adapts all mesh models, samples and
babblesim tests to use random delay functionality correctly.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-01-16 11:29:20 +00:00
Jonathan Rico 3e1a82226d tests: Bluetooth: use unique IDs for l2cap bsim tests
If $BASH_SOURCE is the empty string, then those two tests end up with
the same simulation ID. That's not a good time.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-12 09:33:44 -06:00
Emil Gydesen baf8c47473 tests: bsim: Bluetooth: GMAP broadcast AC testing
Add testing of all GMAP broadcast audio configuration with
GMAP broadcast presets.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Emil Gydesen 79af154ae7 tests: bsim: Bluetooth: CAP broadcast AC testing
Add testing of the Audio Configurations from the BAP spec using
the CAP API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Emil Gydesen 9310b34b44 tests: bsim: Bluetooth: BAP: Refactor bap_test_stream
Refactor the bap_test_stream struct and rename to audio_test_stream
so that it can be used by CAP as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Piotr Golyzniak a27ae686d3 tests: bsim: add testcase.yaml to bsim bis test
For better manageability of tests building, add possibility to build
BabbleSim Bluetooth BIS tests by Twister.

Signed-off-by: Piotr Golyzniak <metody159@gmail.com>
2024-01-10 12:10:58 +01:00
Alberto Escolar Piedras 009fcd70e5 tests bsim bt: Add basic connection test with HCI UART async controllers
Add a basic connection test between two devices,
in which the controllers are in separate nrf52_bsim devices
connected over UART to the devices running the host+app.
The controllers are running the HCI UART async sample.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Alberto Escolar Piedras 398e4b121a tests bsim bt: Add basic connection test with HCI UART controllers
Add a basic connection test between two devices,
in which the controllers are in separate nrf52_bsim devices
connected over UART to the devices running the host+app.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Emil Gydesen 3099520921 tests: bsim: Bluetooth: BAP Broadcast update to 2 bis
Update the bsim test for the BAP broadcast to use 2 bis.
This tests a larger part of the code, and also verifies
that we can send and receive on 2 BIS without any ISO errors.

This requires the ADV interval to be a multiple of ISO interval
- 10ms, so the advertising interval has been set to 80ms.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-09 09:59:42 +01:00
Daniela Andreea Dumitrache 3bfb2e3ab2 Bluetooth: Audio: Add implementation for PBP and dedicated sample apps.
PBP API allows sources to create a Public Broadcast Announcement.
PBP API to parse a Public Broadcast Announcement.

public_broadcast_source application starts extended advertising and
includes a Public Broadcast Announcement. The advertised broadcast
audio stream quality will cycle between high and standard quality.

public_broadcast_sink application scans for broadcast sources and
synchronizes to the first found source which defines a Public Broadcast
Announcement including a High Quality Public Broadcast Audio Stream
configuration.

Add bsim tests for Public Broadcast Profile APIs.

Add shell implementation for Public Broadcast Profile APIs.

Signed-off-by: Daniela Andreea Dumitrache <danielaandreea.dumitrache@nxp.com>
2024-01-09 09:59:23 +01:00
Håvard Reierstad 9c3ca4573a bsim: Bluetooth: Mesh: Add gatt suspension test
Adds two test-cases to `test_suspend.c`, both checking that gatt
advertisement is stopped when suspending Mesh, and that is started again
when Mesh is resumed.

The first test-case involves suspending and resuming Mesh, and
the second test-case involves suspending Mesh and disabling Bluetooth,
then re-enabling Bluetooth and resuming Mesh.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-01-08 13:21:58 -05:00
Håvard Reierstad 0480367d77 bsim: Bluetooth: Mesh: refactor suspend test
Renames tx to DUT and rx to Tester to clarify roles in test.

Re-uses the same body for suspend/resume and suspend/disable/resume
for DUT with a parameter to toggle disabling BT.

Re-uses the same Tester config in both existing test-cases as the
previous configs were duplicates.

Updates the dut suspension status in the message handler.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-01-08 13:21:58 -05:00
Håvard Reierstad ee337087fa bsim: Bluetooth: Mesh: extract common adv logic
Extracts logic related to waiting for packets from
`test_advertiser.c` and `test_beacon.c` to use in a sync mechanism.
Introduces a sync mechanism in bsim with the functions
`bt_mesh_test_send_over_adv` and `bt_mesh_test_wait_for_packet`

Extracts gatt-related logic from `test_advertiser.c` into a separate
file so it can be re-used.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-01-08 13:21:58 -05:00
Aleksandr Khromykh b4dc12b42b tests: Bluetooth: Mesh: optimize proxy beacon test
Emitting network beacons in parallel to proxy functionality
causes collisions. The commit disables network beacons and
allows the test scenario to be more precise.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-01-08 14:17:04 +01:00
Jonathan Rico 7127c2a733 tests: Bluetooth: Add debug options to host/l2cap/stress
Enable quality-of-life kconfig options.
Add destroy callbacks to track lifetime of app buffers.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-05 14:30:18 +01:00
Théo Battrel ba80bc7134 Tests: Bluetooth: Fix conn_stress compilation warn
On newer GCC version warnings were emitted because of a `memcpy`. The
size parameter was larger than the source's size because it was using
the size of the destination, which was a `bt_uuid_128` when the source
is a `bt_uuid_16`.

Fix the issue by creating a new variable for CCC UUID in both the
central and peripheral code. The variable need to be static because the
discover parameters must remain valid until the start of the discover
attribute callback.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-12-27 16:07:46 +00:00
Anders Storrø 7d373c7c28 Bluetooth: Mesh: Fix broken proxy adv test
Relaxes test requirements for proxy_adv_multi_subnet_coex
to resolve failing test on CI.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-20 11:48:18 +01:00
Aleksandr Khromykh ac4cfe9880 Bluetooth: Mesh: remove 20ms tx delay in adv bearer
The recommendation to have 20ms is fair for two
consecutive messages over a single bearer. When mesh
sends two messages it can be interpreted as two
bearers working in parallel. No need to keep
an artificial 20ms delay for that. Delay was
removed and all related bsim tests were fixed.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-12-19 16:20:36 +01:00
Aleksandr Khromykh 8d51a1dac5 tests: Bluetooth: Mesh: relax beacon test time conditions
Some beacon tests have strict time conditions and depend
on randomization interval that doesn't guarantee test pass.
This change fixes strict conditions.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-12-19 16:20:36 +01:00