Commit graph

2414 commits

Author SHA1 Message Date
Andries Kruithof
e6ba1eed90 bluetooth: controller: update unittests for LLCP to use proper ZTEST API
Update unittests for the following areas/controll procedures
- API
- collision handling
- invalid PDUs
- unsupported procedures
- buffer allocation
- TX queue
- Data Length Update
- PHY update
- Encryption
- Ping
- Version
- Channel map update
- Min. used channels
- Connection update
- SCA
- Terminate connection
- CTE request
- CIS create
- CIS terminate

Also moved the internal API tests from the ull_llcp* files
to the proper unittest C-file

Unused files  are removed

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-24 11:46:39 +01:00
Jonathan Rico
219e8b3b1a test: Bluetooth: split compile.sh
Split into layers for now, we can have more granular splits later.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-23 14:35:05 +01:00
Jonathan Rico
2a9eda226b tests: Bluetooth: restructure bsim_bt directory
This commit separates each test by layer level.

Obviously the tests will run the whole stack, but they should be separated
by which component/layer they intend on testing.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-23 14:35:05 +01:00
Théo Battrel
a95811e677 Bluetooth: tests: Add tests for Bluetooth privacy
Add tests to check the following aspects of the Bluetooth privacy feature:

- On device privacy mode, scanner shall accept advertising packets from
  peer with any address type. That, even if they have previously exchanged
  IRK;
- After devices have exchanged IRK, they must correctly resolve RPA.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-02-23 09:08:25 +01:00
Théo Battrel
7753f77461 Bluetooth: Add test for the CCM function
Add a test for the cryptographic function CCM.

The tests data are from the
[RFC3610](https://www.rfc-editor.org/rfc/rfc3610).

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-02-22 12:19:39 +01:00
Alberto Escolar Piedras
e20862f0e8 tests: bsim_bt: edtt tests: Use latest EDTT without the bridge
The latest EDTT does not use the bridge anymore.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-02-22 12:17:42 +01:00
Emil Gydesen
928e5bbcf0 Bluetooth: Audio: CAP inittiator broadcast stop procedure
Implemented support for stopping and deleting a
CAP broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Emil Gydesen
9d0ec99315 Bluetooth: Audio: CAP initiator broadcast metadata update
Add support for the update metadata for broadcast audio
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Emil Gydesen
a64281d904 Bluetooth: Audio: Expand CAP tests for CAP broadcast
Expand the CAP tests to also have a test case for CAP
acceptor and CAP initiator broadcast, which is heavily
inspired from the BAP broadcast tests.

The tests only tests that a broadcast source can be created
with the CAP API and that the metadata is correct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Magdalena Kasenberg
69a6ead783 bluetooth: tester: Add PACS test handling
Add support for testing Published Audio Capabilities Service server
with PTS.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-02-20 11:19:42 +01:00
Krzysztof Kopyściński
f31b3f03ad Tests: Bluetooth: Tester: improve stability by Flow Control and UARTE
Some tests may be unstable because of missing data from BTP frames.
Enabling Flow Control fixes the issue, but seems to work reliably
only along with UARTE.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-02-20 09:55:09 +01:00
Troels Nilsson
c57095740f Tests: Bluetooth: Update EDTT and add new test cases
Updates EDTT to newest version and adds the new test cases

Update _controller_tests_inner.sh to support using packet inspection
and the new low-level device feature in EDTT

Build configs for the BSim test apps updated to support extended
advertising

Signed-off-by: Troels Nilsson <trnn@demant.com>
2023-02-20 09:54:54 +01:00
Alexandre Dauphinais
cd95f1cf88 tests: Bluetooth: bsim: Added tests for RPA
This adds two tests to ensure the resolvable
private address is rotated for the peripheral
and central after their respective timeout.

Signed-off-by: Alexandre Dauphinais <alexandre.dauphinais@nordicsemi.no>
2023-02-20 09:51:09 +01:00
Magdalena Kasenberg
460ca5bac8 tests: bsim: audio: Add example usage of foreach ase
and get ase info to verify its correctness in CI.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-02-20 09:49:09 +01:00
Alberto Escolar Piedras
70830b5b88 tests: bsim_bt: audio: Do not reuse sim_ids
Even if the tests are not run in parallel
do not reuse sim_ids as that overwrites the result data
preventing re-running in check mode, and inspecting
the test results.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-02-19 20:59:04 -05:00
Jonathan Rico
3ad452663e tests: Bluetooth: reproduce gatt settings bug
Reproduce #54470.

- client connects
- client writes to CF & CCC
- client bonds
- server reboots

After this, we would expect to have the CCC and CF values be correctly
restored from settings but they are not.

Additionally add the same test with BT_PRIVACY=y, which shows that the
feature is broken with that config (fixed in a subsequent commit).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-16 00:21:07 +09:00
Jonathan Rico
67236de058 Bluetooth: host: add test for some GATT settings bugs
This test is designed to check the soundness of GATT caching across
reboots.

It will fail if the fixes for #54173 and #54172 are not present.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-13 12:55:02 +01:00
Pierce Lowe
205a077118 tests: bluetooth: added bsim test for longer per adv data
Added a bsim_bt host test to test the handling of periodic adv
report data received across multiple packets

Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
2023-02-09 13:12:24 +01:00
Lars Knudsen
333d48b56d Bluetooth: has: Fix uninitialized bt_has_register_param
Zero initialize has_param in BSIM test.
Also, specify all bt_has_register_param members in hap_ha sample.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
2023-02-08 08:14:23 -08:00
Emil Gydesen
bebb98efb1 tests: Bluetooth: Unicast client BSIM used group size as stream_cnt
Instead of setting the stream_cnt based on the number
of streams configurer, we use the number of streams actually
added to the group, and then configure that amount.

This should ensure that we do not try to configure any
streams that we have not already added to the group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Emil Gydesen
b18fcdbade tests: Bluetooth: Expand unicast audio BSIM tests
Expands the unicast audio babblesim tests up until
the start procedure (which is not yet supported by the
babblesim). This increases the test coverage of the unicast
implemetations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Emil Gydesen
54d31d0a13 tests: Bluetooth: Unicast client remove CIG guards
The unicast client will now actually create the CIG in the
test regardless of the `CONFIG_BT_CTLR_CENTRAL_ISO` value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Andries Kruithof
5329319d7a Tests: bluetooth: Fix failing df unittests
Due to recent refactoring following unittests are failing:
tests/bluetooth/df/*
tests/bluetooth/ctrl_user_ext

This commit fixes these by adding the include files containing the
missing type definitions

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-02 17:59:45 +01:00
Jonathan Rico
c2e4029aad Bluetooth: host: resume advertising even when BT_EXT_ADV=y
When using extended advertising commands, the advertising set is not
considered to be over until we receive `BT_HCI_EVT_LE_ADV_SET_TERMINATED`
from the controller. Only then do we clear the `BT_ADV_ENABLED` flag.

The problem is that `bt_le_adv_resume` is called on connection established,
which can happen before adv set terminated, and in that case it will
early-return because `BT_ADV_ENABLED` is still set.

This change triggers `bt_le_adv_resume` when we get
`BT_HCI_EVT_LE_ADV_SET_TERMINATED`.

Fixes #53048

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-02 17:05:48 +02:00
Vinayak Kariappa Chettimada
5e3117d44e tests: Bluetooth: Enabled Controller Connected ISO support
Enable Controller Connected ISO support in bsim_bt_audio
test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada
cd2796e047 Bluetooth: Controller: Refactor ll_setup_iso_path
Refactor ll_setup_iso_path to support Synchronous Receiver
and Connected ISO to be built together.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada
8cf58edb8b Bluetooth: Controller: Use instant_latency to detect event skipped
Use instant_latency at the CIG start event count to detect
skipped connection event around the instant. In the future
add implementation to compensate for skipped ACL connection
event and adjust the CIS event count at CIG start.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada
aba5176340 Bluetooth: Controller: Fix CIG offset and add time reservations
Fix CIG offset such that it follows after the ACL connection
time reservation to avoid overlapping.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada
6f0b6ec90b Bluetooth: Controller: Fix ISO Buffer allocation for SDU fragmentation
Fix ISO Tx Buffer allocation counts considering required SDU
fragmentations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada
4d3f8697a3 Bluetooth: Controller: Make PDU octet3 vendor specific
Make Data, ISO, BIS and CIS PDU structure's octet 3 vendor
specific.

This will allow vendors not supporting the octet 3 or
CTEInfo (8 bits) to save 1 octet in their PDU structures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Vinayak Kariappa Chettimada
117bdbbf64 Bluetooth: Controller: Use len instead of length in PDU structs
To be consistent in naming as len instead of length in PDU
struct definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Vinayak Kariappa Chettimada
cc1f937d61 Bluetooth: Fix endianness of cryptographic toolbox function h8
Convert endianness of supplied parameters before calculating
the AES-CMAC. Bluetooth stores values in little-endian and
crypto traditionally operates on big-endian storage.

Relates to commit e9c542ab5b ("Bluetooth: Add the
cryptographic toolbox function h8").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Hein Wessels
1480b2083e tests: bluetooth: edtt_ble_test_app: NATIVE_TASK has no return value
Remove the return value of edtt_stop because it's ignored by NATIVE_TASK.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-26 09:30:36 +01:00
Morten Priess
921846731e Bluetooth: controller: Hotfix auto-merge error
Remove introduced duplicate mock function.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-01-24 15:43:36 +01:00
Vinayak Kariappa Chettimada
c104fda34f Bluetooth: Controller: Fix filter accept list and privacy default
Fix filter accept list and privacy feature Kconfig default
based on whether host has them enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-24 15:13:36 +01:00
Vinayak Kariappa Chettimada
00dbf6188c Revert "Bluetooth: Controller: Fix filter accept list and privacy default"
This reverts commit 59eef60665.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-24 15:13:36 +01:00
Alberto Escolar Piedras
1e7d2c83aa tests: bsim_bt compile: Provide more info during errors
As we are now compiling in parallel all apps, build errors
are not anymore next to the compile line, so let's tell
developers for app we are printing the build output
to ease debugging.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-24 14:20:33 +01:00
Morten Priess
a982c9f9f6 Bluetooth: controller: Start CIG immediately if instant is next event
To be able to timely start the first CIS/CIG, if the requested instant
is the next connection event, call ull_peripheral_iso_start directly
from rp_cc_state_wait_rx_cis_ind instead of waiting for next time
through the state machine.

To enable ULL/LLL to prevent adding latency when LLCP is waiting for
instant, local- and remote procedures with instant now expose a function
for checking this state.

Fixed event_counter function to prevent one-off in RX path. Unified to
use single function ull_conn_event_counter.

Fixed LLCP unit tests and added new mock function.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-01-24 11:09:51 +00:00
Emil Gydesen
64f3bccdb7 tests: Bluetooth: Add per_adv sync with privacy
Add test where privacy is enabled and where
the two devices are bonded and have exchanged IRK
before doing the periodic advertising sync.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Emil Gydesen
11945688fb tests: Bluetooth: Add per_adv connection tests
Expand the periodic advertising tests with connections,
to verify that two devices can simultaneously be connected
and keep a periodic advertising sync.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Emil Gydesen
2db5d4d790 tests: Bluetooth: Add per_adv BSIM tests
Adds a test suite exclusively for testing
periodic advertising sync.

The first test added is a simple test that does a periodic
advertising sync, and passes afterwards.

The test suite will be expanded with testing PA syncs
with PAST (both from remote and local transfer) as well
as privacy handling.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Aleksandr Khromykh
83207d4a9a tests: Bluetooth: Mesh: use overlays for mesh bsim
Add the overlays usage for bsim mesh configurations instead of
multiple configurations that duplicate each other a lot.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-01-24 09:43:38 +01:00
Szymon Czapracki
7941a88121 bluetooth: tester: Add VCP & IAS test handling
This commit introduces Volume Control Profile and
Immediate Alert Service into btp.

VCP includes:
Audio Input Control Service
Volume Control Service
Volume Offset Control Service

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-01-20 16:12:15 +01:00
Andries Kruithof
f0c610ce0d bluetooth: controller: update unittests for improved ZTEST framework
Update the unittests for feature exchange to use the new ZTEST API
Here we only update the feature exchange procedure. The remaining
unittests will be done in a next PR

Mocks, helper routines and the Unit Under Test are splitted out as
a library instead of adding them to the file list

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-20 14:35:08 +01:00
Vinayak Kariappa Chettimada
d6c3e04eb8 Bluetooth: Controller: Central maximum data PDU size time spacing
Use the maximum data PDU size time reservation space
considering the Data length could be updated from default
27 bytes to maximum support size.

If maximum time reservation is disabled then time space
reservation corresponding to the default data length at the
time of the start/enable of Central role is used.

Note, currently this value is only used to space multiple central
connections and not for actual ticker time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-20 12:16:43 +01:00
Vinayak Kariappa Chettimada
680e29dd0e Bluetooth: Controller: legacy: Fix conn param request to be cacheable
Fix connection parameter request  procedure to be cacheable
if a remote control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-20 12:16:43 +01:00
Andries Kruithof
e7d60e3ed6 Bluetooth: controller: fix post DLE/PHY update event length
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-19 11:18:51 +01:00
Andrei Emeltchenko
5bdb1faffe tests: bluetooth: Fix memset() wrong buffer size
Use correct structure in sizeof().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-19 10:15:40 +01:00
Mariusz Skamra
f30eb1b9fb tests: bsim: audio: Create unicast group prior stream configuration
This updates the test to create the unicast group with non-configured
streams.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-01-18 09:56:52 +01:00
Mariusz Skamra
36058480e7 Bluetooth: audio: Improve stream coupling for CIS as the unicast client
Allow  the streams to be paired when creating unicast group. This will
allow to reuse the same ISO for the paired streams.

Fixes: #51796
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-01-18 09:56:52 +01:00