Commit Graph

154 Commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
6ed100bdc9 Bluetooth: Controller: Add BT_CTLR_SW_SWITCH_SINGLE_TIMER coverage
Add BT_CTLR_SW_SWITCH_SINGLE_TIMER coverage in BabbleSim
tests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-22 12:02:02 +02:00
Emil Gydesen
cdc84f7867 tests: Bluetooth: CAP initiator unicast invalid param tests
Add tests for testing invalid parameters for the CAP
initiator unicast APIs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen
bd069c36be tests: Bluetooth: CAP initatior broadcast invalid param testing
Add testing of using invalid parameters for the CAP initiator
broadcast APIs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen
cf39633c80 tests: Bluetooth: CAP Initiator broadcast test to smaller functions
Split the CAP Initiator broadcast test into smaller functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen
23b4105b9a tests: Bluetooth: Broadcast Sink test resync
After stopping the sync, try to sync again to see
that the broadcast sink can be restarted.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-15 15:26:04 +02:00
Emil Gydesen
a16dbbc76c tests: Bluetooth: BAP Broadcast Sink invalid testing
Add invalid parameter testing for the BAP Broadcast Sink.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-15 15:26:04 +02:00
Emil Gydesen
7b3db7c15d Revert "tests: Bluetooth: Audio: Enable EATT for bsim tests"
This reverts commit f6405d993178c1d1c134981f1457347837bfd05a.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-13 02:29:05 +09:00
Emil Gydesen
2fedefa237 tests: Bluetooth: Audio: Add long metadata for unicast test
Add a 128-octet long metadata for the capabilities to
test the long read functionality.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-12 15:29:17 +02:00
Erik Brockhoff
3daa01c191 Bluetooth: test: adding bsim basic conn test of multiple re-connects
Adding a test that confirms ability to perform 20 (re)connections
between simple peripheral and central

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Erik Brockhoff
5582c009a4 Bluetooth: test: fixing callback declaration in basic conn bsim test
Using the macro for declaring the callback struct does not make
sense in this construct, where test_connect1/2 are compiled into one
image and specific test functionality is selected via test ID

This reverts change made by #8e1682d which is incorrect for the cases
where the compile happens to include more than one declaration of the
callback struct.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Vinayak Kariappa Chettimada
4f928af21a tests: bsim: Bluetooth: Update the ACL group CIS test to 4 connections
Update the ACL group based scheduling with ACL first being
connected to use 4 connections and 4 streams to be
consistent with the test that does ACL the CIS one after
the other.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-12 12:28:51 +02:00
Vinayak Kariappa Chettimada
d2602a54c2 tests: bsim: Bluetooth: Use defines for parameters in CIS tests
Use defines for scan, create connection, connection and ISO
parameters in the tests.

Also, use same advertising interval for legacy and extended
advertising test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-12 12:28:51 +02:00
Nithin Ramesh Myliattil
8d6b206064 subsys/bluetooth/host: Make rpa same for adv sets with same id
Add check to see if RPA is already generated for adv sets
with same id. If generated use the same address for all adv sets
with same id else create new RPA.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2023-05-11 08:31:24 +00:00
Emil Gydesen
4b31f8c6f5 tests: Bluetooth: CSIP: Add no rank, size and lock char tests
Add tests for cases where the rank characteristic, the size
characteristic and the lock characteristics are not set on the
set members.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Emil Gydesen
65808bb102 tests: Bluetooth: Split CSIP tests to multiple scripts
Split the CSIP tests to multiple scripts to make them
more specific and able to run in parallel.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Emil Gydesen
41fd5b80df Bluetooth: CSIP: Add missing and fix Set Coordinator set info
The set info returned by the Set Coordinator did not contain
information about the lockable state. Furthermore the
set info was not properly initiated, as it was missing the
rank, which was set somewhere else.

This commit adds the lockable state to the set info.
This commit removes the rank from internal structure,
and uses a reference to the set info instead, and only
store the rank there.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Alberto Escolar Piedras
90b3425320 tests/bsim: run_parallel: Do not set exe permissions if missing
This script tried to be too nice with users, and if they forgot
to set the scripts as executable, set it for them.
But this leads to too many testcases commited to main without
executable permissions.
Which then leads to other developers needing to set those
locally and end with dirty workspaces.

Instead let's not have run_parallel set the executable bit,
and have these tests fail in CI, so developers realize and fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-09 13:04:19 +02:00
Alberto Escolar Piedras
f11e9ec6a5 tests/bsim: Set all tests scripts 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-05-09 13:04:19 +02:00
Alberto Escolar Piedras
cb21f7c1c2 tests/bsim: On timeout print info to stderr
To ease diagnosing why a test fails in CI when the
CI safety timeout triggers, have the timeout command
print to stderr a message in which it indicates it has
just killed the underlaying process.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-08 16:20:40 +02:00
Emil Gydesen
a180c013db Bluetooth: Audio: Modify broadcast_id prints/logs to use 24-bit
Always print/log the 24-bits (as hex) of the broadcast ID to better
use it with e.g. the shell.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-08 13:27:33 +02:00
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