Commit graph

16700 commits

Author SHA1 Message Date
Emil Gydesen
c999e4600d tests: Bluetooth: CAP: Add test of change volume procedure
Add testing of the CAP Commander Change Volume procedure
in BSIM.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-17 12:00:09 -05:00
Emil Gydesen
b09ce2fade Bluetooth: CAP: Commander set volume support
Add support for setting volume on one or more CAP
acceptors using the CAP Commander API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-17 12:00:09 -05:00
Daniel Leung
ea797f28b6 tests: smp_boot_delay: extend to test custom CPU start func
This extends the smp_boot_delay test to test the newly
introduced function k_smp_cpu_custom_start().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-01-17 11:57:20 -05:00
Daniel Leung
89b231e7e2 kernel: smp: introduce k_smp_cpu_start
This renames z_smp_cpu_start() to k_smp_cpu_start().
This effectively promotes z_smp_cpu_start() into a public API
which allows out of tree usage. Since this is a new API,
we can afford to change it signature, where it allows
an additional initialization steps to be done before a newly
powered up CPU starts participating in scheduling threads
to run.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-01-17 11:57:20 -05:00
Daniel Leung
ad87d2667c tests: kernel/smp_boot_delay: make test more generic
This makes the test a bit more generic so it can run on
other SMP enabled platforms. Though, we don't need CI
running this on every SMP platforms as this is not
testing the mechanism of bringing up a CPU. That is
being tested on the other SMP test. Therefore, only
enable qemu_x86_64 to be testing in CI so that this
feature will still be tested on CI.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-01-17 11:57:20 -05:00
Markus Swarowsky
dc7613865d modules: mbedtls: Add a mbedtls_ms_time implementation
MbedTLS 3.5.0 requires a implementation of mbedtls_ms_time giving a
time in ms for TLS 1.3
Therefor adding an alternative implementation using zephyrs
k_uptime_get

Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
2024-01-17 16:52:52 +01:00
Markus Swarowsky
11175c3ad3 tf-m: Change NS include path for TF-M 2.0.0
The place where TF-M places its non-secure api header files has changed
Therefore changing it for for all applications that use it.

Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
2024-01-17 16:52:52 +01:00
Bjarki Arge Andreasen
358f1ff934 tests: modem: cmux: Implement TRANSMIT_IDLE into test suite
Use transmit idle event to synchronize with data transmitted
through DLCI pipes to test TRANSMIT_IDLE implementation.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-17 09:20:50 -06:00
Daniel DeGrasse
c4e48b66bd tests: drivers: audio: add dmic API test
Add DMIC API test, intended to verify DMIC drivers are functioning
correctly within the DMIC API.

The test verifies the following:
- Mono channel audio
- Stereo channel audio
- Using maximum number of channels supported by DMIC IP
- Pausing/restarting channels
- Checks to make sure invalid channel maps are rejected by the DMIC.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-17 14:43:52 +01:00
Gerhard Jörges
13740696c7 tests: net: hostname: add test for net_hostname_set
Add test that sets the hostname.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2024-01-17 14:42:58 +01:00
Yong Cong Sin
98a631b5bc posix: pthread: allow oldstate & oldtype to be NULL
The POSIX standard doesn't specify if the argument to store
previous state/type in
`pthread_setcancelstate`/`pthread_setcancelstate` can be
`NULL`, but threading implementations in Linux & Apache NuttX
permit the arguments to be `NULL`.

This commit changes Zephyr's implementation to mimic that of
Linux & NuttX, so that user do not get caught off-guard by
NULL pointer dereferencing when porting code over from those
OSes.

Updated test accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-17 14:42:50 +01:00
Vinayak Kariappa Chettimada
60c0087555 Bluetooth: Controller: Fix ISO Sync Receiver time reservation calc
Fix missing ISO Synchronized Receiver radio event time
reservation that did not calculate for all the subevents.

Introduce BT_CTLR_SYNC_ISO_RESERVE_MAX Kconfig option to
allow using a minimal time reservation if needed to allow
other role to pre-empt ISO Synchronized Receiver in
pre-transmission and control subevents.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-01-17 14:42:32 +01:00
Bjarki Arge Andreasen
4403d8f4c6 tests: lib: devicetree: api: Add tests for IRQ_INTC_* macros
Extend api test suite to cover the new devicetree macros. This
includes extending the devicetree overlay with two new bindings:

- GPIO device which is also an interrupt controller
- interrupt holder using interrupts-extended to point to both
  existing interrupt controller test_intc, and the newly added
  GPIO device

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-17 13:18:00 +01:00
Yong Cong Sin
d4c2d4140b tests: posix: common: turn the fdtable init test into a testsuite
As there isn't any ZTEST under the `posix_apis` testsuite, its
the testsuite is skipped and its setup function never ran,
let's convert the fdtable initialization setup function into a
test of `posix_apis`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-17 05:41:37 -05:00
Yong Cong Sin
498529ea76 tests: posix: common: split posix_apis into multiple testsuites
Currently all components live under the `posix_apis` testsuite,
this commit split them into a testsuite of their own.

This commit also prefixed a few local functions/variables with
the `static` keyword.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-17 05:41:37 -05:00
Christopher Friedt
e223d01b67 tests: posix: shorten the filter in testcase.yaml
CONFIG_NATIVE_LIBC can be used in place of
CONFIG_NATIVE_BUILD and CONFIG_EXTERNAL_LIBC

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-17 04:59:16 -05:00
Jukka Rissanen
4c88169d03 tests: net: sockets: Add tests for SO_DOMAIN socket option
Make sure that the SO_DOMAIN is a read only value and it
returns correct socket domain (AF_INET or AF_INET6) in the
tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-17 09:55:40 +01:00
Tom Burdick
897553af17 logging: Remove hda log backend
The HDA log backend has been buggy for some time, and the fixes are well
understood. The issue with HDA log as it is implemented today means
there are concurrency and ISR issues where it can deadlock.

The fixes are effectively dropping the usage of ipc to communicate
status, using polling on the hda stream, and having a formatter per call
context (cores + isr) when log mode immediate is enabled to fix log
mangling. However it was found this had a lot of unintentional side
effects that made it difficult to make progress on when it came to
changes of the host side python tooling.

Meanwhile the feature has sat unused for nearly a year. Remove it, and
it can always be revisited in the future if something like it happens to
be needed.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-01-17 09:52:48 +01:00
Chekhov Ma
c78f583ed7 tests: drivers: gpio_basic_api add board mimx93_evk_a55
Add mimx93_evk_a55.overlay to tests: drivers: gpio_basic_api

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2024-01-16 20:50:11 -05:00
Alberto Escolar Piedras
53c121381f CI bsim workflow: Add UART tests to the bsim workflow
Add new workflow steps to the babblesim workflow to run
also the UART tests on the nrf52_bsim.
This commit:
* Enables the single device tests (which we may
move to the normal twister workflow once we fix the
requirement for a fixture)
* Adds as a placeholder the infra for multidevice tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 14:55:07 -05:00
Alberto Escolar Piedras
9af74504dd tests/drivers uart_mix_fifo_poll: Filter out repetitive tests
Do not run in CI all tests, as they have very similar configuration
and provide little extra coverage to justify the extra CI time.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 14:55:07 -05:00
Alberto Escolar Piedras
e6140f5422 tests/drivers uart_mix_fifo_poll: Allow configuring test length
This test is quite heavy and long in simulation,
but its length is meant to find unlikely issues which
may be triggered only very rarely.
Let's provide a kconfig value to chose how long the
test is, and set it to a lower value when running in simulation
(in CI) to save time.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 14:55:07 -05:00
Alberto Escolar Piedras
685c88308d tests/drivers uart_mix_fifo_poll: Speed up for nrf52_bsim
Increase the UART speed to 1Mbps for the simulated nrf52
to reduce the amount of time spent busy waiting, and
therefore the real time duration of the test.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 14:55:07 -05:00
Bi Jian
06fa287d45 Bluetooth: Audio: Update audio location definitions
The meaning of bit0 in the audio location bitmap will change to
mono audio, so we update the audio location macro and releated
test cases.

Refer to BT SIG ES-22266.

Signed-off-by: Bi Jian <bi_jian@qq.com>
2024-01-16 14:27:40 -05:00
Konrad Derda
982fc416f8 tests: net: buf: add tests for data matching
Add new test case for veryfing matching between net_bufs' contents and
a given data buffer.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-01-16 09:40:04 -06:00
Emil Gydesen
fd3e334539 tests: Bluetooth: Audio: Fix channel allocation
The channel allocation was incorrect when setting up multiple
streams to a single device, in which case we should apply
individual bits to each stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-16 09:31:12 -06:00
Anas Nashif
ead02284f0 tests: uart: filter by CONFIG_SERIAL_HAS_DRIVER
filtering by CONFIG_SERIAL always matches, we need a different filter
and be able to enable the driver if supported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-16 10:29:39 -05:00
Anas Nashif
54d177a3e7 tests: uart: do not filter if we know which platforms to use
No need for filtering in one of the tests, since we have platform_allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-16 10:29:39 -05:00
Amrith Venkat Kesavamoorthi
879e3a42b0 drivers: gpio: PCF857x: Modify PCF8574 driver
Modify existing PCF8574 driver as PCF857x for:
PCF8574 - 8 channel I/O expander
PCF8575 - 16 channel I/O expander

Signed-off-by: Amrith Venkat Kesavamoorthi <amrith@mr-beam.org>
2024-01-16 15:19:14 +00:00
Jonathan Rico
38c39af4df Bluetooth: L2CAP: Prepend SDU header immediately
Previously it was not always possible to prepend the header.

It was not possible if the application neglected to reserve the space
for headers.  This is bad because it forces a buffer segment allocation
even if the buffer had enough room for the headers. E.g. a payload of 10
bytes in a netbuf of 30 bytes would have been segmented.

We now explicitly reject the buffer if it does not have the headroom.

This allows us to do a nice thing; simplify L2CAP segmentation.

We convert the SDU from the application into a PDU payload, by
prepending the SDU header, i.e. the SDU length in the original buffer.

This PDU payload is ready to be chunked into PDUs without having to keep
track of where in the SDU we are. This has the effect of removing a
bunch of logic in the segmentation machine.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-01-16 11:29:43 +00:00
Aleksandr Khromykh
4e7d64b1b4 Bluetooth: Mesh: enable access responses randomization
Enable by default the access layer responses random delays.
Commit also adapts all mesh models, samples and
babblesim tests to use random delay functionality correctly.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-01-16 11:29:20 +00:00
Yuval Peress
2d09f1f566 test: bmi160: rename test directory
Rename the test directory to more accuratly reflect what's being
tested.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
b58b03196b bus: emul: Update i2c/spi emulators with mock transport
Adding a hook for tests to inject a mock transport and migrating the
accel test to test bmi160 specific things. The old version of the test
which checks for read values is now covered by the generic test in
the sensor build_all target.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
9898b2fc3f bmi160: Make changes to align driver to datasheet
The logic in the driver was not aligned to the datasheet. Also,
temperature reading was not being done in fetch, but in channel_get.
There was also some extra conversions from SI->register->SI when
setting the range, this was causing the register value calculation to
produce an incorrect scale in some cases.

Tests were added to cover these cases.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
be563239c8 sensor: testing: Update sensor emul backend
Update the backend for sensor emulators to include a function for
setting the offset as well as a function to query an attribute's
metadata such as bounds and increment size. Additionally, add
backend support for setting the _xyz channel values.

Make the appropriate test changes to accomodate.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Jukka Rissanen
eb22110365 tests: net: socket: Add correct path to socket.h for POSIX_API
If CONFIG_POSIX_API is enabled, then the socket.h is found under
zephyr/posix/sys/socket.h etc. This allows one to compile the
socket test applications without error prints.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-16 10:00:45 +01:00
Jukka Rissanen
6ea6326e79 tests: net: socket: service: Add tests for socket service API
Simple tests that verify that the socket service API works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-16 10:00:45 +01:00
Emil Gydesen
68f8c8ff29 Bluetooth: Audio: Fix off-by-one error in codec.c:ltv_set_val
The function did not move data correctly when increasing
or decreasing the size of a value that was not the last value
in the LTV array.

Added a few tests to verify the fix, using the CCID list as the
main way of verifying it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-16 10:00:04 +01:00
Christopher Friedt
9074feabf6 tests: posix: separate suite for pthread_t and pthread_attr_t
In order to make state more manageable among the other
posix api tests, create a separate ZTEST_SUITE() called pthread
and another ZTEST_SUITE() called pthread_attr.

The tests in the pthread suite mainly operate on the pthread_t
type, while tests in the pthread_attr suite mainly operate on
the pthread_attr_t type.

The pthread_attr testsuite is moved to a separate file
(pthread_attr.c).

Having separate test suites allows us to narrow the scope of
the tests and have a better degree of control over the state.

Some effort went in to highlighting undefined behaviour at the
API level. This was quite intentional, as we will need to be
be able to test / verify that we do in fact have deterministic
outcomes when users attempt operations that result in undefined
behaviour (e.g. assert).

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-16 00:35:45 -05:00
Christopher Friedt
a2a3140a74 tests: posix: common: move barrier test to barrier.c
Move the one barrier test to its own file and create
a ZTEST_SUITE() for barrier.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-16 00:35:45 -05:00
Christopher Friedt
414868aace tests: posix: common: move condattr test to cond.c
Move posix_apis.test_pthread_condattr to cond.c .

Create a separate cond ZTEST_SUITE().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-16 00:35:45 -05:00
Bjarki Arge Andreasen
325bc953a8 tests: modem: pipe: mock: Implement TRANSMIT_IDLE event
Implements TRANSMIT_IDLE event notification for mock
modem_pipe.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-15 15:11:50 +01:00
Grzegorz Swiderski
460b6ef122 code_relocation: Add NOKEEP option
When using the code and data relocation feature, every relocated symbol
would be marked with `KEEP()` in the generated linker script. Therefore,
if any input files contained unused code, then it wouldn't be discarded
by the linker, even when invoked with `--gc-sections`.

This can cause unexpected bloat, or other link-time issues stemming from
some symbols being discarded and others not.

On the other hand, this behavior has been present since the feature's
introduction, so it should remain default for the users who rely on it.

This patch introduces support for `zephyr_code_relocate(... NOKEEP)`.
This will suppress the generation of `KEEP()` statements for all symbols
in a particular library or set of files.

Much like `NOCOPY`, the `NOKEEP` flag is passed to `gen_relocate_app.py`
in string form. The script is now equipped to handle multiple such flags
when passed from CMake as a semicolon-separated list, like so:

   "SRAM2:NOCOPY;NOKEEP:/path/to/file1.c;/path/to/file2.c"

Documentation and tests are updated here as well.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-01-15 13:20:17 +01:00
Alberto Escolar Piedras
972a4d9f6f tests/kernel/context: Improve to resist parallel threads interrupting
This test assumes that nothing will wake the CPU apart from
the timer set by the test.
But that is not necessarily the case.
Some other platform thread started at boot
may be waking the CPU every now and then.

Let's allow for some spurious wakes while we are testing k_cpu_idle,
while at the same time ensuring we are not just busy waiting
all the way.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-15 09:58:26 +01:00
Krzysztof Chruściński
dc99da6a4f tests: logging: log_api: Extend to cover frontend runtime filtering
Extend test to cover runtime filtering for frontend.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-15 09:57:54 +01:00
Dmitrii Golovanov
68d1a52417 posix: sched: Implement get APIs for scheduling parameters
Initial implementation of `sched_getparam()` and `sched_getscheduler()`
POSIX APIs as a part of PSE53 `_POSIX_PRIORITY_SCHEDULING` option group.
Both functions are actually placeholders and just return `ENOSYS`
since Zephyr does not yet support processes or process scheduling.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-01-15 09:57:44 +01:00
Dmitrii Golovanov
b184fc3a62 posix: sched: Add CONFIG_POSIX_PRIORITY_SCHEDULING
Add `CONFIG_POSIX_PRIORITY_SCHEDULING` Kconfig option to select
APIs from PSE53 `_POSIX_PRIORITY_SCHEDULING` option group.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-01-15 09:57:44 +01:00
Lucas Tamborrino
11fc182315 soc: esp32: refactor esp32_net
SOC_ESP32_NET is now SOC_ESP32_APPCPU, following espressif's
naming convention in the same manner as ESP32S3 app cpu.

SOC_ESP32_APPCU is now a subset of SOC_SERIES_ESP32.

This commit also changes the necessary files, samples and tests
for bisect purposes.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-01-13 00:22:24 +00:00
Alberto Escolar Piedras
cee40d1d49 tests/drivers/uart/uart*: Allow on nrf52_bsim
Add the nrf52_bsim to the platform_allow list
for tests which had such a filter.

Note that for this test to pass, you need
to connect the uart in loopback, passing the command
line option `-uart0_loopback` to zephyr.exe

Note this tests do not run right now by default in CI
as the fixture is preventing it.
They can be run with:

twister -T tests/drivers/uart/ -v -p nrf52_bsim \
  --fixture gpio_loopback -- -uart0_loopback

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-12 11:27:23 -06:00
Alberto Escolar Piedras
f82f6cdeae tests uart/uart_async_api: Improve filter
These tests were filtering by CONFIG_UART_CONSOLE,
but that does not seem a strick requirement.
It seems the requirement would just be CONFIG_SERIAL,
but that is implicit if CONFIG_SERIAL_SUPPORT_ASYNC,
which is required for all these tests, so let's
just remove CONFIG_UART_CONSOLE.

(The simulated nrf5x boards do not set CONFIG_UART_CONSOLE
by default, as by default the console is routed to the
process stdout instead)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-12 11:27:23 -06:00