Commit graph

524 commits

Author SHA1 Message Date
Omkar Kulkarni 11eed84775 Bluetooth: Mesh: Update models metadata API
This commit updates models metadata API to simplify the usage and
removes the metadata pointer in health server model context.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-05-01 10:54:50 -04:00
Vinayak Kariappa Chettimada 5258b528f7 tests: bsim: Bluetooth: Reduce multiple id test execution iterations
Reduce the iterations in multiple id multiple simultaneous
connections test, and tune the buffer counts to catch any
buffer leak related regressions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-01 10:53:06 -04:00
Emil Gydesen 353a05b116 Bluetooth: BAP: Unicast server depend on PACS
When in the BAP unicast server role, at least PAC sink
or PAC source shall be set.

In order to fulfill this new requirement, a few other Kconfig
options had to be changed to a `depends on` from `select` to
avoid recursive Kconfig requirements. This change may require
some applications to update their configurations according
to the migration guide.

The change from `select` to `depends on` is ideal anyhow
as that is the recommended way to add dependencies.

This can checked via the combined BT_PACS Kconfig value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-30 14:30:45 -04:00
Théo Battrel 8ba0ebab12 Bluetooth: Test: Add long AD test
Test that the Host give back the correct error when we try to set too
big advertising data. And ensure that long advertising data are
correctly transmitted.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-29 11:02:02 +02:00
Johan Hedberg d590bcb5e0 Bluetooth: Remove BT_HCI_RESERVE and BT_HCI_RAW_RESERVE
In most cases these were defined as 1. Saving one byte for the rest
doesn't really justify the added complexity that comes with these
options. Removing them also simplifies the interface between HCI
transports/drivers and the host stack, which in turn helps pave the way
for having HCI as a proper Zephyr driver API.

Fixes #71907

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-04-29 11:01:27 +02:00
Jonathan Rico 6435262284 Bluetooth: L2CAP: Handle REJECT_RSP for ECRED
We can (and do) open multiple channels with a single L2CAP command. If the
remote doesn't support dynamic channels at all, then it sends back a
REJECT_RSP.

We only destroyed the first channel that matched the command PDU
identifier. Fix that and remove all channels that match.

Also add a test that verifies the patch.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-26 19:21:46 -04:00
Aleksandr Khromykh dbc6017947 tests: Bluetooth: Mesh: optimization of blob and dfu bsim tests
Commit adds optimization of blob and dfu models bsim tests.
1. Makes general transfer size and block size smaller for blob.
2. Makes waiting time shorter for some blob bsim tests.
3. Splits long dfu srv persistence test suite into two.
4. Reduces retransmission for unicast messages till zero
   for blob and dfu tests.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-26 16:11:20 +02:00
Vinayak Kariappa Chettimada 6b27cb2b83 tests: bsim: Bluetooth: Testing BIG create and sync using LL interface
Update the bsim BIS tests to check BIG create and sync using
LL interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:26 +02:00
Vinayak Kariappa Chettimada 12dc399c4d tests: bsim: Bluetooth: central_hr peripheral_hr coverage
Add bsim test coverage for central_hr and peripheral_hr
samples.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Vinayak Kariappa Chettimada aed68169c6 tests: bsim: compile: Add support to supply EXTRA_CONF_FILE
Add support in bsim compile script to accept EXTRA_CONF_FILE
so that overlay conf files can be supplied at compile time.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Théo Battrel 9400823dcd Bluetooth: Tests: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

Update the tests that were relying on those options. A lot of test were
actually not using the name, for those the name have simply been
removed. For the others that were using the name, add it in the
advertising data or the scan response data.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Jonathan Rico 65abd2186c tests: Bluetooth: Add regression test to l2cap/stress
43de309b3e made a buffer leak.
It was not detected by this test.

Add another configuration, where the final buffer is sent without
fragments in order to exercise the leaky code path.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-22 06:49:54 -07:00
Alberto Escolar Piedras 5a329202c9 tests/bsim: sysbuild: Set primary MCU idx properly
When using sysbuild,
set the primary MCU index to be the app core
only when we are building the test app in the app core.

Otherwise, if the test app is build in the net core,
the test command line parameters won't be sent by default
to it, and tests will fail.

Luckily, these tests are only built in CI using sysbuild
when we target the 5340bsim app core, and in all but 2,
even if sysbuild was used, this setting was propagated
to the zephyr build if we had separate net and app core
images.
The issue was introduced during the transition to
hwmv2.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-18 08:05:55 -07:00
Alberto Escolar Piedras becf4c1c81 tests/bsim: Fix not detecting failures
b0339136c1
Broke the check for failed bsim tests.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-15 16:24:12 +02:00
Vinayak Kariappa Chettimada 7ece6aed16 Bluetooth: Controller: Fix regression in BT_RX_STACK_SIZE use
Fix regression in BT_RX_STACK_SIZE use due to
commit b91728619c ("Bluetooth: host: remove
`CONFIG_BT_RECV_BLOCKING`").

Profiling of Controller Rx thread has been mentioned in
commit 586ba9fd13 ("Bluetooth: Controller: Increase
BT_RX_STACK_SIZE for BT_HCI_RAW enabled").

Also, move the TX_STACK_SIZE value as default in Kconfig
from the explicit value being set in hci_ipc sample.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-12 13:48:57 +02:00
Erik Brockhoff dca085e155 bluetooth: controller: refactor node_rx_pdu for memory optimization
Generic node_rx_hdr struct contains data not used for done event, so this
pdu specific data is moved to node_rx_pdu to minimize memory usage for
MFIFO_done alloc.

This however calls for a considerable write-through replacing the generic
node_rx_hdr with node_rx_pdu when relevant and needed.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-12 09:19:08 +02:00
Jonathan Rico 43de309b3e Bluetooth: l2cap: Remove (net/buf) frag support
It's needless complexity, and the terminology clashes with
Bluetooth (HCI frags).

It has one user, IPSP, that is going away soon.

Removing frag support will allow a future optimization, removing the
need for HCI and L2CAP fragment buffer pools, saving memory.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 14:40:32 +02:00
Jonathan Rico f818cbd8cc tests: Bluetooth: Add example bsim test
This test is intended to teach the conventions and best practices to a
potential contributor that wants to add a test, for say a new feature.

It is liberally commented on purpose, so new contributors don't have to
spend two weeks understanding the intricacies of the simulator, the bsim
test framework, the native builds, backchannels, etc..

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-10 07:43:41 -04:00
Jonathan Rico 389192a94d tests: Bluetooth: Add common helpers for bsim
This code can be found (kinda) duplicated all over
`tests/bsim/bluetooth`.

Put it in a common place.

Refactoring the current tests will be done in a future commit.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-10 07:43:41 -04:00
Alberto Escolar Piedras 936598ddf1 tests/bsim/common sh: Improve getting test name/relative path
Improve function which guesses the test name so the calling
script can be invoked from any folder, not just Zephyr's
base.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-10 07:43:21 -04:00
Dominik Ermel 5a0ecb9641 flash: Move dependency on FLASH_PAGE_LAYOUT where it belongs
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
 FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-10 10:01:40 +02:00
Emil Gydesen 50b37cb564 tests: bsim: Bluetooth: CAP Commander Change Microphone Mute
Adds bsim test of the CAP Commander Change Microphone Mute
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-05 12:21:38 +02:00
Alberto Escolar Piedras 082f283271 tests/bsim: Remove too small timeouts
Remove explicit timeouts which are either the same as the
default one or smaller.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-28 17:05:49 -05:00
Alberto Escolar Piedras 7d7188e792 tests bsim: Increase runtime timeouts
Let's increase the timeout for a few tests whose
timeout is less than 3x a typical execution time in CI.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-28 17:05:49 -05:00
Alberto Escolar Piedras 693ae8635a tests bsim edtt: Kill stuck processes in the same way as other tests
This test keeps its own partial way of running tests.
Let's have it kill stuck processes in the same way as
the rest (sending another kill 5 seconds after, and printing
a message about what happened)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-28 17:05:49 -05:00
Alberto Escolar Piedras b0339136c1 tests bsim: run_parallel: Print how long tests take
To give an idea of which tests are taking
too long either on CI or locally.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-28 16:02:06 -05:00
Alberto Escolar Piedras dfe34ca03a tests/bsim/run_parallel: Create folder for results xml if missing
Create the folder for the results if it does not exist.
Fixes these warnings in CI:
```
touch: cannot touch '/__w/zephyr/zephyr/./bsim_bt/
53_bsim_results.xml': No such file or directory
realpath: /__w/zephyr/zephyr/./bsim_bt/
53_bsim_results.xml: No such file or directory
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-28 14:45:17 +00:00
Jukka Rissanen 0512e7ffae tests: net: sockets: Remove use of NET_SOCKETS_POSIX_NAMES
The setting is deprecated so change the code to either use the
native zsock_* API or enable POSIX_API to use the BSD socket API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Aleksander Wasaznik d4d84b0ac9 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-27 14:33:31 +00:00
Aleksander Wasaznik b91728619c Bluetooth: host: remove CONFIG_BT_RECV_BLOCKING
This config selects a variant of the HCI driver interface that spills
out host internals unto the drivers and even the Zephyr controller. It
will now be removed in favor of driver interfaces that hide the
internals of the host.

The new default is `CONFIG_BT_RECV_WORKQ_BT`.

Any references to the removed kconfig are refactored out.

Any out-of-tree driver using the removed interface can be easily adapted
by copying the following implementations into the driver as private
functions:

 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV_PRIO`
 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV`
 - `hci_driver.h:bt_hci_evt_get_flags`
 - `hci_raw.c:bt_recv_prio`

In combination these symbols function as a interface adapter. These
symbols will be removed in this PR in subsequent commits.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Aleksander Wasaznik 03d234d593 Bluetooth: tests: hfc: Avoid reconnecting too fast
The host refuses to connect to a peer with an address that is also used
by a connection object in disconnected state.

Add a guard to prevent `-EINVAL` from `bt_conn_le_create`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Alberto Escolar Piedras 6514b3b88d bsim tests|samples: Remove uses of the nrf5340bsim hwmv1 boards
Using the old hwmv1 board names is not supported anymore.
So we don't need to handle them specially in the sysbuild
files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-26 10:35:34 -05:00
Alberto Escolar Piedras a5f255d604 tests/bsim sh scripts: Reduce boilerplate
Remove the boilerplate which is not necessary beacuse
it is already provided by the common scripts

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 13e31b2736 tests/bsim/compile.source: Provide common check and default
Provide a common check for BSIM_COMPONENTS_PATH
and a default WORK_DIR
So we avoid boilerplate in other scripts

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 13206221b0 tests/bsim: build scripts: Use hwmv2 board names
Use the hwmv2 board names instead of the hwmv1 ones.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras fd8857539d tests/bsim: All scripts: Use boardtarget string instead of BOARD
In all scripts, where we were using the BOARD variable
let's use BOARD_TS which is the full BOARD target string
with "/" replaced with "_"
This is neccessary to support hwmv2 board names

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 1d231dda33 tests/bsim/bluetooth/host/gatt: Use common scripts
Use the common functions instead of replicating functionality

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 42d97fdf99 tests/bsim/bluetooth/ll/conn: Use common scripts
Use the common functions instead of
replicating functionality and do a minor cleanup

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras ab3e4d4bbe tests/bsim/bluetooth/audio: Use common scripts
Use the common functions instead of
replicating functionality and do a minor cleanup

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras a7ea72cee0 tests/bsim bt host/id/settings: Test scripts cleanup
Use the common scripts to perform common functions
and do a cleanup.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras a7d381854e tests/bsim bt host/iso/*: Test scripts cleanup
Use the common scripts to perform common functions
and do a cleanup.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 8002730b65 tests/bsim bt host/security/*: Test scripts cleanup
Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

Some of the _compile scripts were rotten => Fix them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 06326dc8c2 tests/bsim bt host/privacy/*: Tests scripts cleanup
Ensure we call the common source script before using
the BOARD variable;
Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

And for the 2 parts of the peripheral rpa sharing
test, use different sim_ids, so the traces for each
part can be checked.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras e9c6f37daf tests/bsim bt host/misc: Tests scripts cleanup
Ensure we call the common source script before using
the BOARD variable;
Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

And return !=0 on error.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 769910b3e9 tests/bsim bt host/l2cap: Tests scripts cleanup
Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras f1aaff5115 tests/bsim bt gatt/settings: Use common scripts
Use the common scripts and do a minor cleanup

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 48e813ed6e tests/bsim bt gatt/ccc_store: Minor cleanup
Ensure we call the common source script before using
the BOARD variable, and let's not set things
which are already set to the same by default

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 39c9a995cb tests/bsim bt host/att: Test scripts cleanup
Use the common scripts so we have a consitent way of
running the tests, report failures in the same way,
can stop them with ctrl+C, properly wait for
all processes to exit..
Let's also place the test scripts in the test_scripts/
folder as it is convention.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>

(f) ests/bsim bt att:  Use common s
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 5acc7c4815 tests/bsim bt host/adv: Tests scripts cleanup
Ensure we call the common source script before using
the BOARD variable;
Use the common scripts to perform common functions
and do a cleanup.
Do not set variables to their defaults, set things
closer to were they are needed;
Do not perform unnecesary checks;
And in general avoid unnecessary complexity.

Also, remove all timeouts which were unnecessarily too short

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00
Alberto Escolar Piedras 0053f03d59 tests/bsim/sh_common.source: Add function to guess test name
Some developers want to programmatically get the
test name instead of hardcoding it.
So let's have a common function for this.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-25 16:17:13 +01:00