Commit graph zephyr/tests/bluetooth
Author SHA1 Message Date
Anas Nashif
0ee5b604af tests: bluetooth: init: fix twister config
fix extra_config -> extra_configs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-07-29 14:39:48 -04:00
Jamie McCrae
4e851c16b5 tests: bluetooth: init: Fix SoC Kconfig selection
Fixes changing a SoC selection for all devices when one of the
devices being tested is not that SoC

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-07-29 10:49:39 -07:00
Alberto Escolar Piedras
3d0a6f8179 tests: Bluetooth: Tester: Change twister definitions to use from tests
Change the twister definitions so we can refer to them from the bsim
tests yaml directly.

We merge the nrf52bsim and 5340bsim entries into a common one using
platform exclusive config overlays.
As a sideeffect we also now build using sysbuild for the nrf52_bsim, but
that is not a problem beyond a minimal buildtime overhead.

Meaning, instead of there being 4 entries, duplicated by platform, now
there is only 2, based solely on the actual application being built.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-15 19:03:26 -04:00
Anas Nashif
6f9853b74e tests: Bluetooth: host: cs: parameterize PCT parsing with ZTEST_P
test_parsing_success iterated over a 59-entry table of PCT byte
inputs and expected IQ samples inside one ZTEST body. A failure
reported as a single opaque test, with the offending vector only
identifiable from the printed loop index.

Convert the test to ZTEST_P so the framework runs the body once
per vector. The table is hoisted to file scope as a named
pct_test_vector type and reused as the parameter value set, and a
name_cb labels each case with the raw PCT bytes (e.g. 0xEFCDAB),
so a regression names the exact failing input. The vectors and
assertions are otherwise unchanged.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-07-10 22:32:36 +02:00
Piotr Narajowski
7e9938a757 tests: Bluetooth: tester: Fix attribute handle check in set_value
The set_value btp command incorrectly evaluated the cp->attr_id
against SERVER_MAX_ATTRIBUTES before using it as an index to a
server_db array. When running GATT/SR/GAN/BV-01-C qualification
test case, valid handle (e.g. 52) exceeded the maximum attribute
count limit which resulted in BTP command failure.

Fixes GATT/SR/GAN/BV-01-C qualification test case.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2026-07-10 08:53:19 -05:00
Alex Ciascai
8d8b976d69 bluetooth: BAP: fix BAP broadcast BIS stream setup
Initialize all broadcast stream parameters across
subgroups and attach per-BIS channel allocation
codec data. This fixes PTS reporting of audio
channel count/BIS count as zero in broadcast
source streaming

Signed-off-by: Alex Ciascai <ext-alexandru.ciascai@nordicsemi.no>
2026-07-10 08:53:06 -05:00
Szymon Janc
0a0e4047a0 tests: bluetooth: tester: Remove union uuid
This was added in early days, now there is proper API for this in
Zephyr so there is no need for custom wrappers.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-07-07 17:43:04 -04:00
Szymon Janc
ec85679b42 tests: bluetooth: tester: Fix stack buffer overflow in GATT service
struct bt_uuid was used for storage instead of struct bt_uuid_any
resulting in overflow when converting BTP UUID to bt_uuid.

==3608402==ERROR: AddressSanitizer: stack-buffer-overflow on address
    0xe02f5da2 at pc 0x0805a750 bp 0xe14e2048 sp 0xe14e2038
WRITE of size 2 at 0xe02f5da2 thread T7
    #0 0x805a74f in btp2bt_uuid zephyr/tests/bluetooth/tester/src/btp_gatt.c:212
    #1 0x805d31c in get_handle_from_uuid zephyr/tests/bluetooth/tester/src/btp_gatt.c:2149
    #2 0x804f12c in cmd_handler zephyr/tests/bluetooth/tester/src/btp.c:122
    #3 0x807c582 in z_thread_entry zephyr/kernel/sys/thread_entry.c:60
    #4 0x807cdd2 in posix_arch_thread_entry zephyr/arch/posix/core/thread.c:124
    #5 0x80ff2bd in nct_thread_starter zephyr/scripts/native_simulator//common/src/nct.c:291
    #6 0xeb1949a3 in asan_thread_start ../../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
    #7 0xeaea5136  (/lib32/libc.so.6+0x8b136) (BuildId: 798ae816ef14b98dc77560340190445fb200634a)
    #8 0xeaf39de7  (/lib32/libc.so.6+0x11fde7) (BuildId: 798ae816ef14b98dc77560340190445fb200634a)

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-07-07 17:43:04 -04:00
Mathieu Choplain
55d0d82a69 tests: bluetooth: controller: ctrl_isoal: don't use quotes in module-str
This test creates a custom logging Kconfig option using the template as
done in many other places in tree, but wrapped the logging module's
name in quotes for the `module-str` variable which is not correct.

Update the test's Kconfig to drop the quotes.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-07-07 17:42:23 -04:00
Anas Nashif
032e50fb91 tests: bluetooth: rename testcase.yaml to tests.yaml
Rename the test metadata file(s) in this area from testcase.yaml to
tests.yaml so sample and test metadata share one consistent filename
across the tree. Pure rename, no content change.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-07-03 19:24:17 -04:00
Emil Gydesen
7139b387c9 Bluetooth: Host: Disallow setting BT_MAX_PAIRED=0 when BT_SMP=y
The text states that the minimum is 1, but it is possible to
set the value to 0 even when CONFIG_BT_SMP=y.

This commit changes this so that the option and text matches.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-30 11:52:40 -04:00
Etienne Carriere
f89bf10662 tests: use <> to include Zephyr headers instead of ""
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.

This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
    `grep -rsl "#include \"zephyr/" tests/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-30 06:49:18 -04:00
Szymon Janc
0dad43468b tests: bluetooth: tester: Enable all supported DIS features
Fixes following qualification test cases:
 - DIS/SR/SGGIT/CHA/BV-07-C
 - DIS/SR/SGGIT/CHA/BV-08-C
 - DIS/SR/SGGIT/CHA/BV-10-C
 - IOPT/DIS/SR/GATTDB/BV-01-I

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-06-29 13:59:53 -05:00
Emil Gydesen
db44a526c9 Bluetooth: CAP: Ini: Compare cfg/qos in get_next_proc_param
Compare the actual values of the codec configuration
or qos configuration when in the codec configured state,
the QoS configured state or the enabling state.

In the case that the stream is one of the these states
and the parameters to set differ from what is already there,
the appropriate actions should be taken to set the right
values, even if it does not mean an actual state change.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-29 13:45:36 -05:00
Emil Gydesen
78f2cdc47c Bluetooth: BAP: Fix bugs with codec configuration
This commit fixes 2 bugs:
1) Bad/missing err return from bt_bap_stream_reconfig
2) Missing handle of codec_cfg fields that are not part of the
ASCS notifcations: path_id, ctlr_transcode, target_latency and
target_phy.

To be able to set these, we need to store them somewhere, and it
makes sense to attach the ep->codec_cfg earlier so that we can store
them in there.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-29 13:45:36 -05:00
Emil Gydesen
69ce056f38 Bluetooth: Audio: Shell: Increase OTS objects
Set the number of objects to 20 as that is number of objects
that the media player need to register.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:48 -04:00
Emil Gydesen
8e733660cd Bluetooth: OTS: Change BT_OTS_MAX_OBJ_CNT to int from hex
Providing a number of objects as decimal (e.g. 48) is
more intuitive than hex (e.g. 0x30) for humans.

Additionally the max number of objects when the directory
listing object is support has also been changed to more
accurate depict the actual maximal number of objects based on
CONFIG_BT_OTS_OBJ_MAX_NAME_LEN instead of using the absolute
max value. Since Kconfig does not support such calculations,
this maximum has been moved to a BUILD_ASSERT.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:48 -04:00
Emil Gydesen
f96bff2581 Bluetooth: CAP: Shell: Fix issues with cap_ac_11
The command did not count correctly in the unicast_streams
array, and the number of streams support did not match the
audio configuration.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:42 -04:00
Emil Gydesen
f75389213d tests: Bluetooth: CAP: Add unittest for bt_cap_handover_[un]register
Add unittests for the bt_cap_handover_register_cb
and bt_cap_handover_unregister_cb functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:14:53 -04:00
Emil Gydesen
ff92be44a9 Bluetooth: Audio: Improve test labels for LE audio
Modify several places to use bluetooth.audio correctly
Add sample.bluetooth.audio to the tests under the MAINTAINERS file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-24 13:59:25 -04:00
Nicolas Pitre
97fac4b782 kernel: mmu: remove LINKER_USE_PINNED_SECTION and __pinned_* tagging
CONFIG_LINKER_USE_PINNED_SECTION is the second half of the selective
kernel-pinning model removed in issue #108773. With the kernel image
now always resident at boot (previous commit), the __pinned_*
attribute family is a no-op: every page they would have segregated is
already pinned by z_mem_manage_init()'s whole-image loop, so the
tagging contract neither adds safety nor remains maintainable.

Drop it.

Mechanical removals:

* All ~219 in-tree uses of __pinned_text, __pinned_rodata,
  __pinned_data, __pinned_bss, __pinned_noinit, and __pinned_func
  across arch/x86, drivers/interrupt_controller, drivers/timer,
  arch/common, kernel, lib/libc, subsys/portability/posix, tests, and
  the syscall code generator (scripts/build/gen_syscalls.py).

* The assembly aliases PINNED_TEXT/RODATA/DATA/BSS/NOINIT used in
  arch/x86/core/ia32/*.S and drivers/interrupt_controller/
  intc_loapic_spurious.S become plain TEXT/RODATA/DATA/BSS/NOINIT.

* K_KERNEL_PINNED_STACK_DEFINE, K_KERNEL_PINNED_STACK_ARRAY_DEFINE,
  K_KERNEL_PINNED_STACK_ARRAY_DECLARE, K_THREAD_PINNED_STACK_DEFINE,
  and K_THREAD_PINNED_STACK_ARRAY_DEFINE are removed. The few
  in-tree callers (kernel/init.c, arch/arm/core/cortex_a_r/smp.c,
  arch/arm64/core/fatal.c, arch/rx/core/prep_c.c,
  arch/x86/core/prep_c.c, kernel/include/kernel_internal.h,
  tests/bluetooth/hci_uart_async) move to the corresponding
  non-pinned macros.

Machinery removals:

* Kconfig.zephyr drops CONFIG_LINKER_USE_PINNED_SECTION.
  qemu_x86_tiny and qemu_x86_atom_virt drop their =y overrides.

* include/zephyr/linker/section_tags.h drops the __pinned_* macro
  definitions (both arms). __isr collapses to an empty macro since
  its only purpose was to alias __pinned_func.

* include/zephyr/linker/sections.h drops PINNED_TEXT_SECTION_NAME,
  PINNED_BSS_SECTION_NAME, etc. and the bare PINNED_TEXT/RODATA/etc.
  forwarders, plus the _APP_SMEM_PINNED_SECTION_NAME constant.

* include/zephyr/linker/linker-defs.h drops the lnkr_pinned_*
  externs, the _app_smem_pinned_* externs, and the lnkr_is_pinned()
  / lnkr_is_region_pinned() inline helpers.

* include/zephyr/linker/utils.h drops the lnkr_pinned_rodata branch
  in linker_is_in_rodata().

* include/zephyr/linker/app_smem_pinned{,_aligned,_unaligned}.ld
  are deleted; cmake/linker/ld/target_configure.cmake stops
  configuring them.

* boards/qemu/x86/qemu_x86_tiny.ld and
  include/zephyr/arch/x86/ia32/linker.ld drop their pinned-section
  blocks and the now-redundant #ifndef CONFIG_LINKER_USE_PINNED_SECTION
  conditionals throughout the body. The
  LIB_KERNEL_IN_SECT / LIB_ARCH_X86_IN_SECT / LIB_ZEPHYR_IN_SECT /
  LIB_C_IN_SECT / LIB_DRIVERS_IN_SECT / LIB_SUBSYS_LOGGING_IN_SECT /
  LIB_ZEPHYR_OBJECT_FILE_IN_SECT / ZEPHYR_KERNEL_FUNCS_IN_SECT macros
  in qemu_x86_tiny.ld are deleted; they existed only to feed the
  pinned text/rodata/data/bss/noinit sections.

* kernel/mmu.c drops the mark_linker_section_pinned(lnkr_pinned_start,
  ...) call. The mark_linker_section_pinned() helper survives but is
  now gated only on CONFIG_LINKER_USE_BOOT_SECTION.

* arch/common/init.c and include/zephyr/arch/common/init.h drop
  arch_bss_zero_pinned(); arch/x86/core/ia32/crt0.S drops the call
  to it.

* arch/x86/core/userspace.c drops the eager k_mem_page_in() of the
  thread's privileged stack on user-mode entry. With the kernel
  image fully resident the stack is already mapped.

* arch/x86/gen_mmu.py drops map_region("lnkr_pinned") and the
  set_region_perms() calls for lnkr_pinned_text / lnkr_pinned_rodata.

* CMakeLists.txt drops the LINKER_USE_PINNED_SECTION block that
  generated APP_SMEM_PINNED_* variables and the
  pinned_partitions target property feeding gen_app_partitions.py.
  cmake/modules/extensions.cmake removes the PINNED_RODATA /
  PINNED_RAM_SECTIONS / PINNED_DATA_SECTIONS zephyr_linker_sources()
  location keywords and their snippet files.
  scripts/build/gen_app_partitions.py drops --pinoutput /
  --pinpartitions arguments and the pinned-output branch.
  subsys/testsuite/coverage/CMakeLists.txt drops its
  CONFIG_DEMAND_PAGING-conditional fork.

* scripts/build/gen_kobject_list.py drops the
  app_smem_pinned_start / _end fallback for kobject placement
  validation.

* tests/arch/x86/pagetables and tests/kernel/mem_protect/userspace
  drop their lnkr_pinned_text / lnkr_pinned_rodata branches.

* include/zephyr/arch/x86/ia32/arch.h folds IRQSTUBS_TEXT_SECTION
  to the unconditional ".text.irqstubs" form.

* tests/subsys/llext/src/syscalls_ext.c drops a stale comment about
  syscalls landing in .pinned_text.

Targeted retentions:

* arch/x86/core/bootargs.c keeps multiboot_cmdline and efi_bootargs
  in .noinit (was __pinned_noinit, which decayed to __noinit when
  LINKER_USE_PINNED_SECTION was unset). The multiboot and zefi loader
  paths write these buffers before Zephyr's BSS-zero step, so
  zeroing them at boot loses the cmdline.

* arch/x86/core/ia32/fatal.c keeps _df_esf and _df_stack in .noinit.
  They are scratch space written by the double-fault handler and have
  no zero-init requirement; keeping them in .noinit also preserves
  the historical post-noinit alignment that gen_mmu.py relies on
  (z_mapped_size is computed before CMake-injected iterable sections
  are appended to the linker script, so the post-noinit page padding
  is what keeps those sections within the mapped region).

* include/zephyr/arch/x86/ia32/syscall.h and
  include/zephyr/arch/x86/arch.h wrap the per-arch
  arch_syscall_invoke* / arch_is_user_context / arch_k_cycle_get_*
  implementations in @cond INTERNAL_HIDDEN. The public Doxygen
  contract lives on the prototypes in
  include/zephyr/arch/arch_interface.h; the per-arch implementations
  are internal. Without this, removing the __pinned_func attribute
  exposes the implementations to the doxygen-coverage delta check
  as 10 newly-undocumented APIs.

Documentation updates are deferred to a separate commit.

Issue: #108773

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-06-23 09:11:08 -04:00
Rubin Gerritsen
b766b8d728 Bluetooth: HCI: Add unit test for hci_ext_adv_report_process
This function has some complex state tracking. Adding a unit
test will therefore make it easier to check the correctness.

The unit test case
two_interleaved_chains__first_chain_has_unavailable_last_buffer
shows that there is something missing in the implementation:

Step 3 and 4 now report buffers from advertiser B.
Step 5 and 6 report the partial reports from advertiser A. This
makes the host believe that these advertising reports from
step 1. This will be fixed separately.

The implementation of this API was added in PR #106374.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2026-06-22 18:01:53 -04:00
Yago Fontoura do Rosario
32e0ab566c tests: add Bluetooth LE address resolution tests
* Test newly added bt_addr_le_rpa_resolve api

Assisted-by: Copilot:GPT-5.3-Codex
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2026-06-19 22:48:04 +02:00
Aleksandr Khromykh
d2536d7d3f tests: bluetooth: mesh: add chunk allocation by data length test
Add test_chunk_alloc_by_data_len to verify that chunk allocation
is based on actual data length and not buffer capacity.

Fix test_chunk_reallocation to reset the reused buffer between
bt_mesh_delayable_msg_manage() calls since the function drains
buf->len via net_buf_simple_pull_mem().

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-19 14:55:18 +02:00
Anas Nashif
e12bc68df2 tests: fix various typos
Fix various typos under tests/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 10:12:27 -04:00
Emil Gydesen
b9d82d19b4 Bluetooth: CCP: Add support for bearer technology
Add support for setting and getting the bearer technology
using the CCP API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:43:26 +02:00
Szymon Janc
be7e247123 tests: Bluetooth: Bump qualification materials to Core Spec 6.3
This enables Bluetooth Core 6.3. No functional changes but enables
some addition tests specific for 6.3 Core version.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-06-15 12:13:34 -04:00
Johan Hedberg
d441f331a8 tests: bluetooth: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
9cda39e08c Bluetooth: Host: Add bt_conn_drop() API
Add a new bt_conn_drop() function that atomically drops a connection
reference and clears the source pointer in a single step. This mirrors
the recently added net_buf_drop() API and replaces the common pattern:

  bt_conn_unref(conn);
  conn = NULL;

The new API handles a NULL pointer internally, so any guard around it
is unnecessary.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Lyle Zhu
4af3a60041 tests: bluetooth: tester: add RFCOMM service support
- Add BTP_SERVICE_ID_RFCOMM to supported services when CONFIG_BT_RFCOMM
  is enabled
- Replace hardcoded response length (4U) with calculated
  SUPPORTED_SERVICES_RSP_LEN macro based on BTP_SERVICE_ID_COUNT

It ensures the supported services response properly scales with the
number of services and correctly reports RFCOMM support.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-09 22:53:58 +02:00
Gal Raifen
7a08649188 tests: bluetooth: Remove ns nrf5340 from memory leak testcase
Remove nrf5340ns from memory leak testcase
The memory leak test case assumes CONFIG_MBEDTLS_PSA_CRYPTO_C is enabled
This cannot be the case for a non secure application

Signed-off-by: Gal Raifen <galraifen15@gmail.com>
2026-06-04 11:06:43 +02:00
Benjamin Cabé
28633b9f86 tests: drop redundant Kconfig options from test configs
Remove Kconfig settings in tests/ .conf files that have no effect:
- Driver/subsystem enables that are already `default y` and gated by a
  `DT_HAS_<compat>_ENABLED` dependency.
- Board/SoC overlay (boards/<board>.conf, socs/<soc>.conf) lines that
  duplicate, with the same value, an option already set in the test's
  prj.conf.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-04 08:42:10 +02:00
Johan Hedberg
91f9bf6d6d Bluetooth: Remove error return from bt_hci_recv()
Most HCI drivers have never handled the return value from the
driver-to-host receive path in any way, and they haven't really needed to
either since the buffer was always consumed regardless of success or
failure.

To be aligned with Zephyr coding guidelines without having to add
minimal value code to every driver, change bt_hci_recv() to return void
instead. A new bt_hci_recv_err() API is also added for any use case where
access to the error is needed.

There's also a related semantic change to the recv callback (passed to
bt_hci_open()) in that it's now expected to *not* consume the buffer in
case of error. There was only a single place in the host that needed an
update for this, while e.g. HCI raw always returned success.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Johan Hedberg
2f3cd95376 drivers: bluetooth: Remove unnecessary driver data structs
There's no point in having driver specific data structs if the only thing
they contain is the common data struct. Just declare the common data struct
directly as dev->data.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Johan Hedberg
7f3c897f96 drivers: bluetooth: Handle recv() callback in common layer
Now that we have a common data struct, we can take advantage of it and
move the recv callback into it. This way the common layer takes care of
assigning, dispatching and clearing the callback. Drivers now have to use
the new bt_hci_recv() API to pass data to the layer above them (typically
a host stack). Additionally, the drivers no longer get a recv parameter as
part of their open() callback, since that's all handled by the common
layer.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Emil Gydesen
aaccb51555 Bluetooth: ASCS: Introduce ascs.h
Introduce a new header file for ASCS as a step
towards decoupling ASCS and BAP.

BAP has a depdendencey on ASCS, but ASCS does not have one
for BAP, and the code should reflect that.

This is a first step that simply removes the requirement
of the BAP Unicast Server in ASCS with minimal changes.

Tasks to follow up with:
- Remove any depedency on bap.h from ascs.c
- Rename everything from ascs.h from bt_bap to bt_ascs where
  applicable
- Add unit tests specific for BAP unicast server
- Move any BAP-only requirements from ASCS to the BAP unicast
  server implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-02 11:41:03 +02:00
Tomi Fontanilles
e564449161 modules: mbedtls: add CONFIG_TF_PSA_CRYPTO_MODULE_DIR
To allow specifying a different TF-PSA-Crypto paths when using
CONFIG_TF_PSA_CRYPTO_CUSTOM.

This is useful as Mbed TLS automatically compiles with include
directories pointing to TF_PSA_CRYPTO_DIR.

The Kconfig option is made available even when CONFIG_MBEDTLS
is disabled because there are tests that manually make use
of the TF-PSA-Crypto path, and enabling CONFIG_PSA_CRYPTO
makes them crash somehow (at least net.lwm2m.lwm2m_engine
on mps2/an385).

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-05-28 11:11:22 +01:00
Lyle Zhu
cf8e49f23d tests: bluetooth: tester: Make L2CAP data pool count configurable
Replace the hardcoded calculation of DATA_POOL_COUNT with a new Kconfig
`CONFIG_BTTESTER_L2CAP_DATA_POOL_COUNT`. This allows users to configure
the data pool size based on their specific requirements.

The new configuration is only available if both `BT_CLASSIC` and
`BT_L2CAP_RET_FC` are enabled. And the default value of the configuration
equals to `BT_L2CAP_MAX_WINDOW_SIZE`, with a valid range from
`BT_L2CAP_MAX_WINDOW_SIZE` to `255` (`UINT8_MAX`).

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-05-27 15:18:34 +01:00
Alberto Escolar Piedras
fba3f901ad tests/bluetooth/audio/cap_initiator: Be sure to free all malloc'ed memory
One of the tests is purposedly overwriting the stream pointer to NULL.
Which means it is lost and can't be free'd.
To avoid a memory leak warning, let's make sure we free it at the end
of each test by keeping the cap_streams ptr in the fixture.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-05-25 18:19:24 +02:00
Alberto Escolar Piedras
ab12d96334 tests/bluetooth/audio/bap_base: Free a malloc variable
To avoid a memory leak warning with valgrind.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-05-25 18:19:24 +02:00
Jeremy Truttmann
ef61590755 Revert 'test: bluetooth: tester: disable optimizations for native_sim'
This reverts commit e386c63c4b.

Signed-off-by: Jeremy Truttmann <jetstreeam.code@outlook.com>
2026-05-22 18:24:18 +02:00
Emil Gydesen
f825a8745f tests: Bluetooth: Audio: apply U suffix to unsigned integer literals
Apply the U suffix to unsigned integer literal constants used in
contexts involving unsigned types (uint8_t, uint16_t, uint32_t,
uint64_t, size_t, etc.) with coding guideline 40  which requires that
"A u or U suffix shall be applied to all integer constants that are
represented in an unsigned type".
In addition to this requirement, this commit also ads U to any unsigned
literal integer for the sake of completeness.

Changes are limited to literal values in assignments, initializations,
comparisons, and for-loop bounds where the context is unambiguously
unsigned.

Assisted-by: GitHub Copilot:claude-sonnet-4.6

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-19 12:53:46 +02:00
Szymon Janc
0a086fa0b8 tests: Bluetooth: Update ICS to TCRL pkg103
Updated to TCRL pkg103. Enabled all supported DIS characteristics.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-05-18 15:23:54 +01:00
Lingao Meng
32a66035fc tests: bluetooth: tester: fix missing bt_conn_unref in get_attr_val
bt_conn_lookup_addr_le() increments the reference count of the returned
connection object. get_attr_val() was not calling bt_conn_unref() after
use, causing a connection reference leak.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-05-18 15:22:58 +01:00
Emil Gydesen
47ca72394b tests: Bluetooth: Audio: Fix MISRA 13.3 violations
Fix expressions where increment or decrement operators are combined
with other side effects in the same full expression, violating
MISRA-C Rule 13.3.

Separate the increment and decrement operations into standalone
statements to ensure each full expression contains at most one
side effect.

Assisted-by: GitHub Copilot

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-18 15:18:51 +01:00
Emil Gydesen
f38c0cf7e5 tests: Bluetooth: CAP: Handover u->b unittests
Adds unittests for the handover from unicast to broadcast
APIs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-18 15:13:55 +01:00
Emil Gydesen
a2110e70fa Bluetooth: TBS: Rename features to optional opcodes
The characteristic name and definitions in the TBS spec for
the values are "optional opcodes" instead of "support features".

Additionally, the field is 16-bit, instead of the current 8-bit
in the register parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-18 10:14:52 +01:00
Emil Gydesen
0f653263ae tests: Bluetooth: Audio: Add missing error checks
Add missing error checks for any function calls in the
affected files, as that is required by the Zephyr coding guidelines.

Assisted-by: Copilot:claude-sonnet-4.6

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-15 12:57:17 +02:00
Tomi Fontanilles
6c8a0473ff samples/tests: stop enabling CONFIG_MBEDTLS_PSA_CRYPTO_C
This is the old way of doing things, it's used as a means
to enable PSA Crypto as historically it was the only way.

But other PSA Crypto implementations than Mbed TLS are
available (for example, TF-M) and since CONFIG_PSA_CRYPTO
has been introduced it's what should be used when wanting
to enable PSA Crypto.

The build system automatically takes care of choosing
the correct implementation (and enabling
CONFIG_MBEDTLS_PSA_CRYPTO_C when relevant) under the hood.

Replace all occurrences by `CONFIG_PSA_CRYPTO` instead
(or just remove it in cases where nothing is needed).

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-05-14 21:55:23 +02:00
Tomi Fontanilles
b97f0ae81d modules: mbedtls: remove CONFIG_PSA_CRYPTO_CLIENT
It doesn't really serve a purpose since the addition of
CONFIG_PSA_CRYPTO.

Replace remaining uses of the former by the latter.

TF-M now implies CONFIG_PSA_CRYPTO the same way as
CONFIG_MBEDTLS because otherwise we get build failures
if we build Mbed TLS without CONFIG_PSA_CRYPTO enabled.
Hopefully we can remove these two in a later PR.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-05-14 21:55:23 +02:00