Commit graph

2480 commits

Author SHA1 Message Date
Aleksandr Khromykh
ee3d089e37 tests: Bluetooth: Mesh: remove nrf51dk* and microbit for mesh tests
nrf51 has been discontinued. There is no reason to support
ble mesh tests for nrf51 DK platform. As alternative support
of nrf52840 has been added if there wasn't before.

Also, microbit lacks significant amount of RAM (about 800 bytes)
to build mesh test.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-03-03 14:08:24 +01:00
Emil Gydesen
6ecc6c3cec tests: Bluetooth: Audio: Add start stream to unicast tests
Add support for starting streams as the unicast client, which
will connect the CISes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-03 11:00:48 +01:00
Jamie McCrae
0bad35de45 samples and tests: Use non-environmental zephyr base variable
This drops using the environmental part when referencing ZEPHYR_BASE
as the environment value does not have to be set and, in most cases,
is no longer set at all.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:10 +01:00
Emil Gydesen
b1415c57e1 tests: Bluetooth: Add missing encryption value for CAP broadcaster
The field was uninitialized, causing the test to fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 13:49:07 +01:00
Emil Gydesen
a73d2fc1ff tests: Bluetooth: Add VCP Vol ctlr invalid BSIM tests
Call all VCP Vol ctlr APIs with invalid values and ensure that
they return an error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen
63e055b165 tests: Bluetooth: VCP: Move vol ctlr tests into smaller functions
Move the volume controller test steps into smaller functions for more
reusability and easier to expand with invalid test steps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen
9e23eb6a4b tests: Bluetooth: Add VCP Vol rend invalid BSIM tests
Call all VCP Vol rend APIs with invalid values and ensure that
they return an error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen
92530778e2 tests: Bluetooth: VCP: Move vol rend tests into smaller functions
Move the volume renderer test steps into smaller functions for more
reusability and easier to expand with invalid test steps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Andries Kruithof
a395093acb Tests: bluetooth: controller: add correct number of max connections
The number of connections for the tx_buffer_alloc needs to be at least 3
For one of the tests it was set to default 1, which leads to unspecified
behaviour.

This is fixed by setting the maximum nr. of connections to 4

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-03-02 10:01:51 +01:00
Jamie McCrae
af78cbdc99 samples and tests: Add REQUIRED to Zephyr find_package call
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-02 09:58:27 +01:00
Emil Gydesen
d192c1b1e4 Tests: Bluetooth: Fix missing CAP broadcast packing field
Set uninitialized packing field in the broadcast create
parameter.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-28 10:29:52 +01:00
Emil Gydesen
6760b9e68b Tests: Bluetooth: Add delay between IAS client write operations
Since there is no way for the client to read or get notified about
the state, we insert a delay between each operation to allow the
server to handle the alerts before getting a new alert request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-27 13:20:33 +01:00
Emil Gydesen
29eec51dc3 Tests: Bluetooth: Fix bad err check in ias_test.c
The error check was == 0 where it should have been != 0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-27 13:20:33 +01:00
Jonathan Rico
02edcd6494 Bluetooth: host: calculate GATT DB hash on settings load
Prevent race condtions between the stack and the low-priority thread by
calculating the hash (and acting on it, e.g. for marking peers
change-aware, sending SC indications, etc) in the settings_load() context.

Fixes #54773

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-27 10:48:15 +01:00
Jonathan Rico
b3671666e1 Bluetooth: host: clear ATT pending flag on failure to send
`ATT_PENDING_SENT` wasn't cleared when L2CAP reported an error when sending
the packet. This resulted in the channel being unusable for ever, since we
only clear that bit on a response (that will never be sent).

Found when setting `CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768` in the
`notify_multiple` test. The kicker was the bug didn't manifest when EATT
wasn't enabled:
- we were queuing two unsubscribes back to back in the test
- on UATT we have to wait for a req-rsp pair before enqueuing a new one
- on UATT we only have one channel anyways

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-27 10:32:13 +01:00
Andries Kruithof
226c99b455 tests: bluetooth: add prefix to exposed API
In ull_llcp* some functions used in unittesting did not have
the llcp_ prefix
Although this is not a big issue since they are only used when
testing the module this commit adds the prefix so that we
have a more consistent naming

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-24 11:46:39 +01:00
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