Commit graph

2414 commits

Author SHA1 Message Date
Ahmed Moheb
2254fab332 tests: bluetooth: host: Add UT for bt_foreach_bond()
Unit test project for bt_foreach_bond().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:29 +02:00
Ahmed Moheb
0d5a49e815 tests: bluetooth: host: Add UT for bt_keys_foreach_type()
Unit test project for bt_keys_foreach_type().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:14:10 +02:00
Ingar Kulbrandstad
8e6d5561f6 tests: Bluetooth: Mesh: adv test buffer management
The advertiser runs in a loop, pulling advertising buffers from a queue.
Features covered:
Queue overflow
Sending order
Buffer freeing
Dedicated buffer pools

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2022-10-11 11:11:57 +02:00
Troels Nilsson
6137e8bc60 tests: Bluetooth: bsim: Ext. adv. duration handling change fixes
Update bsim test to account for timing difference introduced
by Extended Advertising duration fixes.

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-10-10 13:55:37 +02:00
Emil Gydesen
02d6661d71 Bluetooth: Shell: Add support for sending sine tone with the audio shell
added `audio start_sine` and `audio stop_sine` to start/stop
sending an LC3 encoded sine tone.

This code is heavily inspired from the sine tone implementation
from the unicast_client sample implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-07 13:22:53 +02:00
Mariusz Skamra
28ce0a96b1 Bluetooth: audio: capabilities: Remove redundant direction parameter
The direction is used to identify the list to append the registered
capabilities. There is no need to keep it in the bt_audio_capabilities,
it can be provided as a function parameter instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-06 22:41:27 +00:00
Gerard Marull-Paretas
97ef197d05 include: add missing zephyr/ prefix
Some files still manage to get into the tree without the zephyr/ include
prefix (likely because they lack CI coverage).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 10:41:02 +02:00
Emil Gydesen
9e256681a4 Bluetooth: Audio: Fix syncing to multiple BIS for broadcast sink shell
Fixed an issue with syncing to multiple BIS as the broadcast
sink in the shell. Also changed a check in the broadcast
sink implementation from an assert to a `if` to provide
a better way of handling bad input.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-05 12:42:09 +02:00
Anders Storrø
bea54c5691 Bluetooth: Mesh: Shell: Make prov features dynamic
Alters several provisioning related features to allow commands to be
functional with application defined Provisioning properties &
capabilities.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-10-04 10:33:30 +02:00
Nirosharn Amarasinghe
c56f546670 tests: Bluetooth: controller: Disabled ISO-AL Unit Tests
Tests will be restructured in a future commit. Temporarily disabled to
partition the changes to allow tests to be a separate PR.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-10-03 13:22:13 +02:00
Nirosharn Amarasinghe
896049bae2 tests: bluetooth: controller: updated BSIM ISO ISO-AL emit callback I/F
Updated callback function parameters to match new interface parameters.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-10-03 13:22:13 +02:00
Mariusz Skamra
9ecbee2587 Bluetooth: audio: capabilities: Remove callbacks
This removes the callbacks from capabilities. The callbacks are used for
unicast server role only, while the capabilities are used for the
broadcast sink role as well. Thus the callbacks can be removed as there
is another bt_audio_unicast_server_cb API that is specific for unicast
server role.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-03 10:17:21 +02:00
Mariusz Skamra
124d66e885 Bluetooth: audio: tbs_client: Make GTBS client only build option
Refactor Kconfig to add a way to enable GTBS only client.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-03 10:15:03 +02:00
Troels Nilsson
a96dfe9ce9 tests: bluetooth: BSIM tests compile function enhancement
Allow ZEPHYR_MODULES to be specified to support non-west builds

Return the error code when/if a build fails instead of always 0

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-10-03 10:13:51 +02:00
Aleksandr Khromykh
be18ed7a98 tests: Bluetooth: Mesh: optimize mesh bsim compilation
Remove not used test suites from compilations for low latency
configuration.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-10-03 10:12:34 +02:00
Aleksandr Khromykh
bab80595df tests: Bluetooth: Mesh: add proxy mix mesh bsim test
The commit adds proxy mix advertiser test that checks
mix of transmission between pb gatt, proxy and adv bearers.
The exact test scenario is described in proxy_mixin.sh file.

Additionally, the separate test configuration has been added.
All bsim mesh tests have been implemented not considering that
GATT frames are possible if PB-GATT or GATT Proxy are enabled.
The solution to avoid this misimplementation is to create
the separate configuration for tests with enabled
PB-GATT and GATT Proxy features. The commit adds this as well.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2022-10-03 10:12:34 +02:00
Anders Storrø
901767a47a Bluetooth: Mesh: Shell: Add cfg opt for health srv
Adds Kconfig option for the Mesh Shell Health server.

The shell implementation of Health Server test commands is
dependent on the user adding and initializing the shell Health
Server instance in their application to make the commands functional.
To prevent any confussion about how these commands work, a Kconfig
option has been added to allow conditional compilation of these
commands. In this way the user must actively enable this feature, making
the conditional requirements more clear.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-10-03 10:12:25 +02:00
Szymon Janc
f09220d050 test: Bluetooth: EDTT: Disable invalid tests
Some tests assume that if IUT accepted HCI_LE_Set_Data_Length command
than HCI_LE_Data_Length_Change event will always be sent. This is not
the case anymore as HCI_LE_Data_Length_Change is sent only if effective
parameters changed.

Those tests should be re-enabled when EDDT implementation is updated.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-10-03 10:08:34 +02:00
Szymon Janc
6673cb1f60 Bluetooth: Controller: Fix DLE HCI params parsing
LE Write Suggested Default Data Length and LE Set Data Length commands
are suggestions from host and should be validated only as per HCI
specification regarding internal setting of LLCP.

LLCP is allowed to use other values if needed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-10-03 10:08:34 +02:00
Ahmed Moheb
a341792ca0 tests: bluetooth: host: Remove unused definitions and inclusions
Clean up sources by removing unused definitions and inclusions.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-29 10:17:38 +00:00
Jonathan Rico
5f8e657a22 Bluetooth: att: limit EATT MTU to max buffer size
If a device sends an MTU that is bigger than our maximum tx buffer size,
that could cause assertion failures down the line.

This PR limits it to the maximum we support (CONFIG_BT_L2CAP_TX_MTU).

The issue has been observed with a gatt discovery procedure, but is likely
present in other places in att.c.

To reproduce it, we need two zephyr shell devices, with one having a larger
MTU than the other:
- connect
- do data length update to the bigger MTU
- set security to 2, EATT channels get connected
- launch a gatt discovery from the device with the larger MTU
- observe kernel panic on the other device when it attempts to add too much
memory to a net buf.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-29 10:16:57 +00:00
Herman Berget
a5ce3da6ab Bluetooth: Tests: Fix uninitialized value in eatt_notif test
The chan_opt field was not set, and on some platforms it ended up with
an invalid value. Explicitly set the field on all GATT parameter structs
and make the discovery params static.

Fixes #50520

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-09-28 13:12:08 +02:00
Erik Brockhoff
183370277b Bluetooth: controller: fixing slot reservation for connection setup
With introduction of refactored LLCP was also introduced an error
re. calculation of initial slot reservation in connection setups.

Due to this error a bigger slot was reserved, leading to failure due to
connection overlaps in multiple.sh test.
Also the removal of this 'overhead' in slot reservations calls for
bigger time-allowance for l2pcap_stress test.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-09-27 10:02:07 +00:00
Emil Gydesen
874c45241e Bluetooth: Audio: Remove caching ASE on release
Remove the support for caching ASEs on release.

This is mainly due to the 2-stage design in Zephyr: We
have the bt_audio_stream and the bt_audio_ep, where the
the latter represents an ASE in most cases.

However, once the endpoint goes into the codec configured
state, then a stream must be bound to it. This would be fine
(although a stream is technically not established at this point),
except that a stream is also, for unicast, specified for a
specific ACL. Once the ACL disconnects, the stream technically
becomes invalid, and if the stream is invalid, so is the endpoint.

Based on that, there's no reason (or even option) to keep the
endpoint in a codec configured state, as it would not
have a valid stream associated with it.

If we want to support an ASE going into the codec
configured state on ASE release (or ACL disconnect),
the relationsship between ASEs and streams needs to
be redefined.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-09-27 09:16:21 +00:00
Vinayak Kariappa Chettimada
9b30a91e9b tests: Bluetooth: Upload Launch Studio Project and ICS
Uploaded the Bluetooth Launch Studio generated projects and
ICS files. These files can be imported into Bluetooth users
Launch Studio, with their Bluetooth SIG account, and
generate the test plans.

This file provide detailed information in Launch Studio of
the supported Core features, Host Services and Profiles,
and Audio services.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-26 13:21:08 +02:00
Ahmed Moheb
fab9c5a140 tests: bluetooth: host: Add UT for bt_keys_get_addr()
Unit test project for bt_keys_get_addr().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-26 13:05:47 +02:00
Ahmed Moheb
fd888df41d tests: bluetooth: host: Add mocks for keys.c
Add required mocks to be able to compile and test /bluetooth/host/keys.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-26 13:05:47 +02:00
Jonathan Rico
77e1a9dcad Bluetooth: host: l2cap: add alloc_seg callback
This callback allows use-cases where the SDU is much larger than the l2cap
MPS. The stack will then try to allocate using this callback if specified,
and fall-back on using the buffer's pool (previous behavior).

This way one can define two buffer pools, one with a very large buffer
size, and one with a buffer size >= MPS, and the stack will allocate from
that instead.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-26 11:05:04 +02:00
Jonathan Rico
7a6872d837 Bluetooth: host: add l2cap stress-test
This test reproduces more-or-less #34600.

It has a central that connects to multiple peripherals, opens one l2cap CoC
channel per connection, and transmits a few SDUs largely exceeding the MPS
of the channel.

In this commit, the test doesn't pass, but when it passes (after the
subsequent commits), error and warning messages are expected from the
stack, as this is not the happy path.

We can later debate on whether these particular error messages should be
downgraded to debug.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-26 11:05:04 +02:00
Aleksandr Khromykh
43fe45af0f tests: Bluetooth: Mesh: add adv tx complete cb tests
Add bsim tests to check tx callback behavior for advertiser.
Feature coverage:
TX Complete callback execution
Callback order
Packets are freed before the end callback is called

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-09-15 16:30:34 +00:00
Aleksandr Khromykh
0cc0249fe4 tests: Bluetooth: Mesh: create skeleton for adv bsim tests
Create skeleton for bsim adv tests with stub for
tx complete callback tests.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-09-15 16:30:34 +00:00
Michał Barnaś
dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Ahmed Moheb
db5ef779c4 tests: bluetooth: host: Add UT for bt_buf_get_type()
Unit test project for bt_buf_get_type().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb
e544792ae1 tests: bluetooth: host: Add UT for bt_buf_get_evt()
Unit test project for bt_buf_get_evt().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb
13203cc801 tests: bluetooth: host: Add UT for bt_buf_get_cmd_complete()
Unit test project for bt_buf_get_cmd_complete().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb
4abff8a625 tests: bluetooth: host: Add UT for bt_buf_get_rx()
Unit test project for bt_buf_get_rx().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb
cb5ba5bea8 tests: bluetooth: host: Add mocks for buf.c
Add required mocks to be able to compile and test /bluetooth/host/buf.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Szymon Czapracki
1e4960b28e Bluetooth: Add IAS tests
Add babblesim tests for IAS.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-09-09 10:05:46 +02:00
Szymon Czapracki
ac6c35728a Bluetooth: Add IAS shell
This commit adds IAS functionality to the shell.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>

shell fixes
2022-09-09 10:05:46 +02:00
Vinayak Kariappa Chettimada
b304eaa29b Bluetooth: Controller: Add Kconfig for experimental AD Data Chaining
Add a Kconfig for Advertising Data Chaining in Extended and
Periodic Advertising, permitting AD data lengths of upto
1650 bytes. The implementation is experimental and needs
further testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-08 10:12:56 +02:00
Vinayak Kariappa Chettimada
34154e3efe Bluetooth: Controller: Fix BT_CTLR_ADV_DATA_LEN_MAX Kconfig dependency
Fix BT_CTLR_ADV_DATA_LEN_MAX and other Kconfig dependencies,
and clean up the use of PDU_AC_LL_SIZE_MAX which is used to
allocate scratch packet to be atleast able to accommodate
the minimum 31 bytes AD data such that it is sufficient to
transmit and/or receive scan response PDUs when either
broadcaster or observer alone is supported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-08 10:12:56 +02:00
Anders Storrø
36e34fce41 Bluetooth: Mesh: Add CDB depend on to prov Kconfig
The current implementation of provisioning features is dependent on CDB
to compile, which is reflected poorly in the Kconfig options for mesh.

This commit alters the Kconfig options for provisioning to be dependent
on the CDB option to compile.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-09-06 12:35:48 +02:00
Gerard Marull-Paretas
79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Michal Narajowski
5c27067dcd Bluetooth: Mesh: Align Config Client API with Health Client API
This PR adds a `*_cli_*` infix to the Config Client API to match
the changes in Health Client. The old API is marked as deprecated.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-09-05 13:56:25 +03:00
Torsten Rasmussen
abc3be5965 cmake: remove obsolete CONFIG_ZTEST_NEW_API from CMakeLists.txt
Follow-up: #49243, #48732

With the introduction of Kconfig for unit_testing board and setting
ZTEST_NEW_API in testcase.yaml, the need and support of setting this
directly in CMakeLists.txt is obsolete.

Remove the code line.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-05 10:24:10 +02:00
Emil Gydesen
0753ec558d Bluetooth: Shell: Remove nRF board overlays
The board overlays were added to increase the baud rate,
which was useful when scanning when there were many devices.

For that scenario it is probably better to use the
scan filters.

The changed baudrate in the overlays made it harder
to easily switch between e.g. the BT shell and other
applications, as the default baudrate is different, and
you'd need to restablish a connection to the boards UART
to handle the changes.

The other values in the overlays also do not really
provide any advantage to have for just the shell
application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-09-05 10:17:31 +02:00
Herman Berget
02894c720c Bluetooth: Test: Add test to verify L2CAP sending not changing user data
Regression test for an issue where in cases where sending a buffer over
L2CAP failed, the buffer user data was not restored.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-09-01 14:58:08 +00:00
Aleksandr Khromykh
85fdede4b4 tests: Bluetooth: Mesh: make ext adv default in bsim mesh
Make extended advertiser as deafult advertiser for
general and persistent bsim BLE Mesh tests.
Leave legacy advertiser as default advertiser for
low latency bsim BLE Mesh tests.

The legacy advertiser provides quite poor performance.
Even more, it is not fully compatible with specification
since might spur more frames occasionally then requested.
This is fundamental issue since it cannot stop an advertisement
in exact time. The extended advertiser doesn't have such problem.
However, it is not well tested yet. Since extended advertiser is
not experimental anymore in both controller and host this is
the right time to make ext advertiser as a default in Mesh either.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-08-31 21:55:53 +00:00
Erik Brockhoff
7719bc6785 Bluetooth: controller: llcp: fix unhandled rsp in periph phy upd proc
Re. peripheral phy update procedure: UNKNOWN_RSP from central was not
handled, leading to stall of procedure and subsequent procedure timeout

Proper handle and unit test for case added.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-08-26 11:56:33 +02:00
Vinayak Kariappa Chettimada
649a6250bf tests: Bluetooth: bsim: Verify multiple broadcaster and chain PDU
Added BabbleSim test to reuse the Broadcaster Multiple and
Oberver samples to verify multiple advertising sets and
transmission of Extended Advertising Chain PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-08-23 16:21:00 +02:00