Commit graph

734 commits

Author SHA1 Message Date
Alberto Escolar Piedras
84ba03ae3f tests: bsim: CIS: Increase timeouts
These tests take relatively long to run.
The runtime timeout (CI safety timeout) is too short.
Increase it so it does not fail at random in CI.

The only penalty of increasing this timeout, is that
if one of these tests actually hangs, we will not detect it
until the timeout expires, wasting a bit of CI time.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-08 12:34:07 +02:00
Alberto Escolar Piedras
2d5d9fdf77 tests/net: For nrf52_bsim use flash model
Now that the nrf52 HW models support it,
let's use their flash model instead of falling back
to the openthread RAM settings backend.

Note that the flash model defaults to just keeping the
flash content in the Linux process heap.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-08 10:08:35 +02:00
Pavel Vasilyev
e40ebcdc46 tests: Bluetooth: Mesh: Fix incorect model pointer usage
dummy_vnd_model can't be used like this as it is not part of device
composition data.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-05-08 09:58:56 +02:00
Emil Gydesen
426bc4545a Bluetooth: Use BT_BYTES_LIST_LEXX macros for encoding of data
Modify the BT_UUID_XX_ENCODE and BT_LE_SUPP_FEAT_XX_ENCODE
macros to use the SYS_ENCODE_LEXX macros, instead of re-inventing
the encoding.

Also apply the macros for several other places.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-08 09:56:56 +02:00
Vinayak Kariappa Chettimada
bdbbb9ee7f tests: bsim: Bluetooth: Review rework changes for multiple CIS support
Assorted review rework changes for multiple CIS support test
implementation commits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Vinayak Kariappa Chettimada
c00cd03e07 tests: bsim: Bluetooth: Test script clean up
Test script clean up related to common code moved in
commit add1397e4a ("tests/bsim/bluetooth: Tests scripts
refactor").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Vinayak Kariappa Chettimada
63df595842 tests: Bluetooth: bsim: Add peripheral multiple CIS in a CIG test
Add BabbleSim test to verify creation of peripheral multiple
CIS in a CIG, connect ACL to one peripherals and create nine
CIS to that peripheral device.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Vinayak Kariappa Chettimada
1ff913868a tests: Bluetooth: bsim: Central multiple CIS with ACL group
Add BabbleSim test to verify creation of Central multiple
CIS in a CIG, connect ACL to three peripherals in a group
in the timeline and create CIS to each peripheral.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Vinayak Kariappa Chettimada
2f9820fca6 tests: Bluetooth: bsim: Add Central multiple CIS in a CIG test
Add BabbleSim test to verify creation of Central multiple
CIS in a CIG, connect ACL to nine peripherals and create
CIS to each peripheral.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Vinayak Kariappa Chettimada
4f8b3fa116 tests: bsim: Bluetooth: Add BT_TICKER_EXT_EXPIRE_INFO coverage
Extend tests to cover use of BT_TICKER_EXT_EXPIRE_INFO
feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Emil Gydesen
6b817bcc15 tests: Bluetooth: Audio: Enable EATT for bsim tests
Enable EATT for the LE Audio BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-05 11:26:11 +02:00
Jonathan Rico
fb10381328 Bluetooth: iso: use kconfig for userdata size
Use BT_CONN_TX_USER_DATA_SIZE when defining pools of buffers that will go
through `bt_conn_send_cb()`.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-05-03 10:02:44 +02:00
Aleksandr Khromykh
5bd41f6b6f tests: Bluetooth: Mesh: run bsim mesh tests from non-preemtible thread
BLE Mesh stack has been designed to work in non-preemtible
environment. The PR fixes running bsim mesh test from main thread
that is preemptible. Running mesh tests causes reentering in the
same mesh functionality twice and rewriting ongoing data.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-05-02 13:25:40 -04:00
Kumar Gala
340ed20c12 samples, tests: cleanup void main usage.
Some samples, tests got missed in the switch from void main() to
int main().  Cleanup those samples/tests to use int main().

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-28 20:39:14 +02:00
Alberto Escolar Piedras
e1fabfa9a4 bsim: cmake: Remove unnecessary references to environment
These variables are now provided by the FindBabbleSim
cmake module, which finds them in the environment or thru
west.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-28 20:38:48 +02:00
Emil Gydesen
c7778963fb tests: Bluetooth: CAP: Fix CAP initiator guard that should be source
Fixed a guard that should have been BROADCAST_SOURCE instead
of BROADCAST_SINK.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-28 10:31:19 -05:00
Alberto Escolar Piedras
1bcffb2a45 tests bsim: Do not check for the simulator in apps cmake files
Let the board check for it instead, as it now does it
smarter and can try to find it using west if it was
fetched with the Zephyr manifest.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-28 13:57:21 +02:00
Jonathan Rico
3b0fd2906f tests: Bluetooth: build host/adv/resume without BT_CENTRAL
For the second test (test_2):
Build the DUT image without BT_CENTRAL.

The Softdevice Controller uses different memory pools for the central &
peripheral roles. In the configuration where BT_CENTRAL=y, BT_PERIPHERAL=y
and BT_MAX_CONN=2, the SDC will only have room for one central and one
peripheral role.

The test then won't pass as it expects the controller to have room for two
peripheral connections, and the SDC ends up with only one.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-28 10:31:56 +02:00
Jonathan Rico
c0ca7734c2 tests: Bluetooth: change host/adv/resume scan params
When running with the Softdevice Controller, the controller's scheduling
results in missing all of the advertising packets.

This only happens with this particular configuration (scan & adv params,
multirole device).

Use a smaller scan window & interval to work around that (test IUT is not
controller implementation, rather the host).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-28 10:31:56 +02:00
Jonathan Rico
249741b6c4 tests: Bluetooth: change ifdef in host/adv/periodic
The host APIs shouldn't be gated by controller ifdefs.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 20:07:14 +02:00
Jonathan Rico
1bf036536b tests: Bluetooth: remove sleeps from host/att/eatt/reconfigure
Since the test didn't get deleted after #55976 as expected, use
backchannels to sync both sides instead of finicky sleeps.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 20:06:55 +02:00
Jonathan Rico
2809bace65 Bluetooth: host: l2cap: send only 1 credit
The API doesn't allow the stack to make any guarantees about the number of
available buffers that the app has.

Only send 1 credit at a time, as that is the only guarantee the stack can
give to the peer.

We can send MTU/MPS's worth of credits once we have acquired an SDU buffer
from the application (that is, on the first PDU of the SDU). Though we
still have to cap that to the buffer size we have just acquired.

------

The testcase added here shows a scenario where the relationship
between the number of credits and the number of available buffers does not
hold true any more:

In this test, the app only has one buffer in its pool.

The central will queue SDUs that are bigger than the stack's
buffers (so the user allocator is necessary) but lower than the
channel's MTU.

The device receiving the SDU keeps a reference to the buffer before
returning from the `recv` callback. It releases that reference after a
small delay.

The central will still have credits, so it will queue another SDU, but the
peripheral will not be able to receive the next SDU (as the allocator will
fail) and will close the channel.

To see the test fail, just revert the `l2cap.{c,h}` changes.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 13:53:08 +02:00
Jonathan Rico
68355349f6 tests: Bluetooth: make l2cap stress test fail
Running with a higher SDU length makes the devices get stuck at the start
of the transfer. To be fixed by next commits.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 13:53:08 +02:00
Jonathan Rico
3b97d8f181 tests: Bluetooth: refactor l2cap stress test
- move all the context for a channel in its own custom struct
- allow -EAGAIN when sending, try sending again later

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 13:53:08 +02:00
Jonathan Rico
bb9f7b3293 tests: Bluetooth: add l2cap MPS test
This test verifies the l2cap MPS workaround: when the other
side (non-zephyr host) sends PDUs that are < MPS.

The DUT is a host, while the Tester is a thin layer over the controller,
allowing fine control over l2cap packet contents.

Note that this test fails as-is. It is fixed by the next commits in the PR.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-26 13:53:08 +02:00
Krzysztof Kopyściński
f428a93eba Tests: Bluetooth: Mesh: Add BLOB Transfer on LPN/Friend node BSIM tests
Tests if BLOB Client running on Friend Node can execute BLOB Transfer
with multiple LPNs running BLOB Server.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-04-24 19:52:22 +02:00
Krzysztof Kopyściński
34eeddc624 Tests: Bluetooth: Mesh: extract LPN callbacks from test_friendship.c
This allows to establish friendship in othem tests outside of friendship
ones using same callbacks. This allows to avoid code duplication for
other tests that require friendship.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-04-24 19:52:22 +02:00
Pavel Vasilyev
c4fa085ec4 Bluetooth: Mesh: Add async API for Large Comp Data Client
Add asynchronous API for Large Composition Data Client.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-04-24 13:31:27 +02:00
Aleksander Wasaznik
f90a70d003 Bluetooth: Host: Test GATT read buffer size
This test ensures the data from a charachteristic read callback is not
truncated anywhere. This test illuminates an existing failure, so it's
failing in this commit. The fix is in the same PR.

The test comes with an experimental "library" with easy-to-use
wrappers/utilities for Bluetooth API. The library starts its life in the
directory of the test, but it will be moved outwards when more tests
start using it. It is designed to not interfere with other users of the
Bluetooth API. The library does work just as well on real hardware,
outside of BabbleSim, so it can be used for target tests and
proof-of-concept applications.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-04-24 13:31:18 +02:00
Aleksandr Khromykh
3f4468a970 tests: Bluetooth: Mesh: make msg_mesh tolerant to tx time volatility
msg_mesh bsim test is run in almost all configurations.
The test uses manual polling with hardcoded delays. This PR removes
manual polling to fully relay to mesh friendship implementation
in the aspect of time management. Also, it adds different xmit settings
for the third (not in the friendship) device to avoid collisions.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-04-21 16:27:05 +02:00
Alberto Escolar Piedras
ad3c3909ae tests/bsim: Add a script to generate coverage reports
For users convenience, as it is a typical usecase to
want to see the actual coverage of a set of tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-21 16:23:35 +02:00
Alberto Escolar Piedras
f0a6205831 tests/bsim: Clarify the compile scripts descriptions
And add an again an extra file for the top level.
(It was removed when the CI workflows for network and BT
were split, but the common script is still usefull).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-20 10:51:58 +02:00
Alberto Escolar Piedras
3661f91762 tests/bsim README: Expand with more information
Including the conventions the tests follow.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-20 10:51:58 +02:00
Emil Gydesen
f08990588b tests: Bluetooth: BSIM: Add missing BAP prefix for BAP tests
Some of the BAP test were missing the BAP prefix.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-19 04:52:46 -04:00
Emil Gydesen
7fcd2fba93 tests: Bluetooth: BAP Uni cli bsim test fix check for g_streams
There was a check that checked if a stream was NULL, but the
value compared to NULL was an address of (&) which can never be
NULL. Check is removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-19 04:52:12 -04:00
Krzysztof Kopyściński
ed3f8761a7 Tests: Bluetooth: Mesh: Add persistent storage test for SAR TX/RX
This tests if SAR RX/TX configuaration is saved in and loaded from
persistent storage correctly.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-04-18 15:22:32 +02:00
Martí Bolívar
26d3157ed4 apps: misc void main -> int main fixes
Fix some additional cases in in-tree applications (samples and tests).

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-18 05:45:36 -07:00
Aleksandr Khromykh
e7f1856143 Bluetooth: Mesh: add experimental support mbedtls psa
Commit adds experimental support mbedtls psa as crypto
backend for ble mesh. It were run only on bsim tests.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-04-17 16:31:20 +02:00
Aleksandr Khromykh
77c72aa67b Bluetooth: Mesh: get rid of host dependency for dh key for mesh
Commit gets rid of host dependency to generate DH key.
Mesh uses its own function for it that has synchronous
behavior and correct endianism. It simplifies the provisioning
state machine since it doesn't require waiting for the host HCI
handler.
Also, it removes hidden cross-dependency between BLE Mesh and
SMP in the aspect of competition for the same DH key
(https://github.com/zephyrproject-rtos/zephyr/issues/23292)

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-04-17 16:31:20 +02:00
Alberto Escolar Piedras
c9d500cd2e tests bsim net echo_test: Minor fixes
Two minor fixes:
* The wait time mention in the description was wrong.
* The possible argument passed to the scripts is meant to target the
  phy itself, but it was sent to the channel library.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-17 10:19:25 +02:00
Alberto Escolar Piedras
87911544d9 tests bsim bap_bass_client_sync: Set script as executable
Test scripts need to have executable permissions.
Otherwise, run_parallel will change the mode in CI,
and users need to set them locally which results
in a not clean git workspace.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-17 10:19:13 +02:00
Jonathan Rico
6857755292 tests: Bluetooth: fix privacy/device test case
Fixes two problems:

1. bad argument type, leading to wrong test vector values

2. The central side was not verifying the type of the scan report. When
running with a different controller, it was then too quick to stop the
scanner, before the peripheral had received a scan request.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-17 10:16:31 +02:00
Alberto Escolar Piedras
26590cbf9e tests bsim EDTT: Remove references to the bridge
The EDTT bridge use was removed in e20862f0e8
Now the EDTT bsim transport connects directly to the simulated
devices.
So let's change the code and comments accordingly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-17 10:16:22 +02:00
Krzysztof Kopyściński
893de36842 Tests: Bluetooth: Mesh: Add BLOB Server persistent storage BSim tests
These tests stop BLOB Transfer after BLOB Server reaches every phase
by rebooting devices. After restart, Server recovers transfer and client
continues to the next one. On second pass, Server stops after first
block completes and suspends itself, and after reboot continues to
completion.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-04-17 10:15:56 +02:00
Théo Battrel
c700adafaf Bluetooth: Tests: Add bsim test for EAD sample
Add a new BabbleSim test that run the encrypted advertising sample and
check that the exchanged key material and data are correct.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-04-17 10:15:04 +02:00
Jonathan Rico
1588eaa2a4 tests: Bluetooth: move host/gatt/write bsim test to ll
The pass criteria for the test very much depends on the controller's
implementation.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-04-14 14:04:05 +02:00
Keith Packard
5681f942a8 tests/bsim: Switch main return type from void to int
These changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
    ...
-	return;
+	return 0;
    ...
}

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Keith Packard
0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Krzysztof Kopyściński
bfebfc6e44 tests: Bluetooth: Mesh: add bsims test for DFU Client losing all targets
Test that if all targets are lost because of failing each DFU Transfer
step `target_lost` callback is called on every one, and `end` callback
is called as procedure aborts.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-04-13 16:13:12 +02:00
Nirosharn Amarasinghe
dc21de3acd tests: bluetooth: controller: Unit test for SDU interval consideration
-- Unit test to check that the correct payload number is selected based
   on the SDU packet number and the time stamp when fragmenting SDUs
   into PDUs.
-- Ran clang-format on isoal_test_tx and isoal_test_rx

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-04-13 16:09:39 +02:00