Commit graph

16700 commits

Author SHA1 Message Date
Alberto Escolar Piedras
7ef23e1573 tests uart/uart_pm: Fix kconfig warning
The option CONFIG_NATIVE_UART_0_ON_STDINOUT
is only usable for the native_sim/posix(_64) targets,
but this test is only allowed for the nrf52840dk_nrf52840.
Building with this option set causes a kconfig warning.
Let's just remove it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-12 11:27:23 -06:00
Alberto Escolar Piedras
51f9af86e4 tests/drivers uart_pm: Fix for too fast targets
On the async configurations, the first part of the test
(test_uart_pm_in_idle) can interfere with the second part
of the test, if the device has a fast enough CPU.
This is due to the first part of the test ending
as soon as it queues the last byte for transmission.
If the device is fast enough (and the simulated
nrf52 is), the 2nd part of the test will start executing
enabling the UART Rx, which can result in either
the Rx being enabled mid frame, which can result in a frame
error or even before the Tx HW started pushing the byte
in the line (resulting in that byte being received).
Neither of these cases are handled by the 2nd test,
which sees a spurious error or received byte
and fails.

Let's just add a small delay at the end of the first test
to allow the Tx of the last byte to be done.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-12 11:27:23 -06:00
Jonathan Rico
3e1a82226d tests: Bluetooth: use unique IDs for l2cap bsim tests
If $BASH_SOURCE is the empty string, then those two tests end up with
the same simulation ID. That's not a good time.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-12 09:33:44 -06:00
Mahesh Mahadevan
37158ebf15 tests: counter: Add LPC RTC 1KHZ counter
Add counter test support for the RTC 1KHz counter

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-01-12 13:34:19 +01:00
Yuval Peress
4efa11ebf7 bbram: Add tests
Add emulation testing for it8xxx2, npcx, and mcp7940n. The test is made
to be generic and uses the backend API in order to verify both read and
write functionality. Additional tests are made for the API's limits when
reading/writing out of bounds.

Fixes #65018

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-12 09:59:31 +01:00
Gerard Marull-Paretas
f885763b50 arch: riscv: drop RISCV_HAS_CPU_IDLE
Because it was exclusively used by the "common" RISC-V privileged code
to build CPU idle routines that are now handled by arch level code.
Also, all platforms defaulted to "y", making it pointless in practice.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-12 09:58:31 +01:00
Krzysztof Chruściński
04edca7a9f tests: unit: util: Add test for CONCAT macro
Add test for CONCAT.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-12 09:57:57 +01:00
Anisetti Avinash Krishna
62c8b066c0 tests: drivers: uart: uart_async_api: Enable test for adl_crb
Enable uart_async_api test for ADL_CRB

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2024-01-11 15:41:42 -06:00
Alberto Escolar Piedras
30c660162f tests/kernel/context: Fix for nrf5340bsim_nrf5340_cpunet
This test assumes nothing else is running in the background
but when the logger is on, this board will by default
start the RTC sync mechanism, which will awake the CPU
every now and then.
Let's disable this mechanism to avoid disturbing the test.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-11 11:44:09 -05:00
Henrik Brix Andersen
b7854c08be tests: drivers: build_all: adc: add build test for the mcp320x driver
Add build-only test of the mcp320x ADC driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-11 17:32:28 +01:00
Emil Gydesen
baf8c47473 tests: bsim: Bluetooth: GMAP broadcast AC testing
Add testing of all GMAP broadcast audio configuration with
GMAP broadcast presets.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Emil Gydesen
79af154ae7 tests: bsim: Bluetooth: CAP broadcast AC testing
Add testing of the Audio Configurations from the BAP spec using
the CAP API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Emil Gydesen
9310b34b44 tests: bsim: Bluetooth: BAP: Refactor bap_test_stream
Refactor the bap_test_stream struct and rename to audio_test_stream
so that it can be used by CAP as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-11 16:13:00 +00:00
Bjarki Arge Andreasen
9176e5c568 modem: pipe: Add test suite
Add test suite for the modem_pipe module.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-11 16:09:44 +00:00
Bjarki Arge Andreasen
4d99c69e4a modem: backend: tty: Implement transmit idle event
Implement transmit idle notification for TTY backend. Since TTY
has an "infinite" transmit buffer, we invoke transmit idle
immediately after writing the data to the TTY file.

The test suite for the TTY backend has been updated to match the
new behavior.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-11 16:09:44 +00:00
Tristan Honscheid
0f95b6fbb0 sensors: Add Bosch BMA4xx-series driver
This is a driver targetting the Bosch BMA 4-series accelerometers. It
has been specifically developed for the BMA422 but should be compatible
with others in that line, excepting the BMA400. Supports key attributes
and async RTIO one-shot operation. I2C operation is supported, with
stubs for a SPI implementation provided for future improvement.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2024-01-11 09:58:29 -06:00
Guennadi Liakhovetski
aee2d1a677 llext: provide an example of tristate Kconfig option
Add a tristate Kconfig option to the llext hello-world twister test.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-11 10:26:04 -05:00
Bjarki Arge Andreasen
7d7f7aaf03 tests: subsys: modem: cmux: Update resync unit test
Update the unit test to expect the new simplified resync
behavior, and validate that new resync is working.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-11 13:53:25 +01:00
Yong Cong Sin
b42e362fa8 tests: posix: pthread: add test for sigprocmask()
Refactor the existing `pthread_sigmask` test function to
get its function-under-test via arg and test `sigprocmask` with
that.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-11 07:49:26 -05:00
Yong Cong Sin
73da1e80f4 posix: signal: implement sigprocmask()
Implement `sigprocmask()` by simply redirecting call to the
`pthread_sigmask()` as they are identical.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-11 07:49:26 -05:00
Peter Mitsis
9852e8e15b tests: Add thread suspend-resume SMP stress test
Adds a test to stress k_thread_suspend() and k_thread_resume() on
an SMP system. The test should take about 30 seconds.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-11 10:05:02 +01:00
Lucas Tamborrino
2ca4ed205f tests: pwm: esp32s3: add internal loopback
Add internal loopback for testing purposes

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-01-11 10:04:34 +01:00
Lucas Tamborrino
76997374c3 tests: pwm: esp32: add internal loopback
Add internal loopback for testing purposes and
change wroom for wrover, which is default board
for testing.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-01-11 10:04:34 +01:00
Jun Lin
833495675a test: spi_loopback: add npcx evbs to the spi_loopback test suite
This commits adds the npcx4/npcx9/npcx7 evaluation boards to the
spi_loopback test suite.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-01-11 10:04:21 +01:00
Fabio Baltieri
e5974b2aac input: gpio_keys: implement polling mode support
Some MCU have limitations with GPIO interrupts. Add a polling mode to
the gpio-keys driver to support those cases.

This required a bit of a refactoring of the driver data structure to add
a instance wide data, and move the pin specific pointer in the config
structure.

For polling, reuse the button 0 delayed work so we minimize the resource
waste, the two work handler functions are only referenced when used so
at least those are discarded automatically if no instance needs them.

Fix a bug in the PM structure instantiation as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-01-10 18:21:49 +00:00
Jonathan Hamberg
9c1a45cc00 posix: Fix name collision with __bswap
__bswap_ in zephyr/sys/byteorder.h conflicts with __bswap_ in host's
byteswap.h. byteswap.h from host compiler used in posix_native_64 boards
causes a compilation issue.

This commit renames __bswap_ to BSWAP_ to prevent collision.

Before this commit a compilation error can be created by adding #include
<byteswap.h> to samples/net/sockets/echo/src/socket_echo.c

This does not change external API to byteorder.h, but does change
internal implementation which some other source files depend on.

Replaced manual byteswap operations in devmem_service.c with APIs from
byteorder.h which automatically converts to CPU endianess when necessary.

Fixes #44324

Signed-off-by: Jonathan Hamberg <jonathanhamberg@gmail.com>
2024-01-10 18:13:44 +00:00
Daniel Leung
78790a85aa tests: net: lwm2m_engine: workaround stack overflow on qemu_x86
When running on qemu_x86, the test test_socket_state failed on
stack overflow. Setting CONFIG_TEST_EXTRA_STACK_SIZE to 1024
seems to fix the issue. So add a board specific config for
qemu_x86 so this test would pass.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-01-10 10:09:18 -05:00
Fabio Baltieri
bd8cee8683 drivers: input: add an analog-axis driver
Add an input driver to read data from an analog device, such as a
thumbstick, connected to an ADC channel, and report it as an input
device.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-01-10 15:05:35 +01:00
Nicolas Pitre
e5b3231354 tests: posix: semaphore: assorted adjustments
- Adjust refcount checks with regards to previous commit.

- Remove redundant zassert_not_null() on local pointers after a
  sem_close(). There is no implicit reference passing in C.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-01-10 07:18:19 -05:00
Nicolas Pitre
cf74f22524 posix: semaphore: optimize named semaphore implementation a bit
- Regroup refcount decrement and semaphore destruction by making the
  linked state into a counted reference for it. This allows for
  simplifying the code and cleanly adding a few assertions in a common
  location.

- Remove redundant initialization to NULL on memory about to be freed
  and local pointer in nsem_cleanup().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-01-10 07:18:19 -05:00
Yong Cong Sin
b8662b97f2 tests: posix: semaphore: run normal semaphore test with named semaphore
Run the normal semaphore test with a named semaphore.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-10 07:18:19 -05:00
Yong Cong Sin
3bfcf123a7 tests: posix: semaphore: refactor test_semaphore
Localize a few public variables and refactor the test and
functions so that they are reusable.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-10 07:18:19 -05:00
Yong Cong Sin
abb21d48d9 posix: semaphore: implement sem_open(), sem_unlink() & sem_close()
Implements `sem_open()`, `sem_unlink()` & `sem_close()`
functions and added tests for them.

Updated existing tests and POSIX docs.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-10 07:18:19 -05:00
Piotr Golyzniak
a27ae686d3 tests: bsim: add testcase.yaml to bsim bis test
For better manageability of tests building, add possibility to build
BabbleSim Bluetooth BIS tests by Twister.

Signed-off-by: Piotr Golyzniak <metody159@gmail.com>
2024-01-10 12:10:58 +01:00
Alberto Escolar Piedras
892e8ef47a tests/drivers uart_async_*: Provide overlays for nrf52_bsim
For uart_async_api, uart_mix_fifo_poll & uart_pm:
These test can be run fine in the simulated nrf52_bsim board,
just connecting the UART Tx and Rx in loopback,
but we need an overlay just like for the real boards.
Let's provide it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Alberto Escolar Piedras
c7d179f895 tests/drivers uart_async_api: Fix build error with host gcc
For some reason the host gcc (11 & 12) does not believe
rx_buf_size is constant. Let's work around it by using the
sizeof() expression it is initialized to instead.

This fixes a build error when targetting native targets
which use the host gcc:

tests/drivers/uart/uart_async_api/src/test_uart_async.c:236:34:
error: expression in static assertion is not constant
  236 |         BUILD_ASSERT(rx_buf_size <=
  sizeof(tdata.rx_first_buffer), "Invalid buf size");

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Alberto Escolar Piedras
37f26174ea tests/drivers uart_async_rx: Fix for integration_platforms
The test was actually filtered out in the integration platforms
(native_sim) as SERIAL was not enabled in its prj.conf
and that is not enabled by default for this target.
Let's just enable it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Alberto Escolar Piedras
009fcd70e5 tests bsim bt: Add basic connection test with HCI UART async controllers
Add a basic connection test between two devices,
in which the controllers are in separate nrf52_bsim devices
connected over UART to the devices running the host+app.
The controllers are running the HCI UART async sample.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Alberto Escolar Piedras
398e4b121a tests bsim bt: Add basic connection test with HCI UART controllers
Add a basic connection test between two devices,
in which the controllers are in separate nrf52_bsim devices
connected over UART to the devices running the host+app.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-10 10:01:37 +01:00
Anas Nashif
91841587d6 ztest: fix ztest_run_test_suite usage and macros
Fix usage of ztest_run_test_suite that was missed when introducing shell
support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-09 08:15:22 -05:00
Henrik Brix Andersen
1ebaa293a1 dts: bindings: adc: ti: lmp90xxx: use common io-channel-cells naming
Use the common io-channel-cells name "input" instead of "positive" and
"negative" to make this binding work with the various ADC DT macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-09 10:04:18 +01:00
Jukka Rissanen
59a7915d11 tests: net: tcp: Add tests for last FIN handling
Make sure the connection is closed by the timer if the final
fin is lost.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Jukka Rissanen
d94914d315 tests: net: tcp: Shorten the test execution
Make the retransmission timer much shorter so that the test
is run faster (about 50% faster test run in qemu_x86).

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Jukka Rissanen
9b11fbd54c tests: net: tcp: Verify termination at closing state
Make sure the connection is closed by the timer if the final
ack is lost in closing state.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Emil Gydesen
3099520921 tests: bsim: Bluetooth: BAP Broadcast update to 2 bis
Update the bsim test for the BAP broadcast to use 2 bis.
This tests a larger part of the code, and also verifies
that we can send and receive on 2 BIS without any ISO errors.

This requires the ADV interval to be a multiple of ISO interval
- 10ms, so the advertising interval has been set to 80ms.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-09 09:59:42 +01:00
Daniela Andreea Dumitrache
3bfb2e3ab2 Bluetooth: Audio: Add implementation for PBP and dedicated sample apps.
PBP API allows sources to create a Public Broadcast Announcement.
PBP API to parse a Public Broadcast Announcement.

public_broadcast_source application starts extended advertising and
includes a Public Broadcast Announcement. The advertised broadcast
audio stream quality will cycle between high and standard quality.

public_broadcast_sink application scans for broadcast sources and
synchronizes to the first found source which defines a Public Broadcast
Announcement including a High Quality Public Broadcast Audio Stream
configuration.

Add bsim tests for Public Broadcast Profile APIs.

Add shell implementation for Public Broadcast Profile APIs.

Signed-off-by: Daniela Andreea Dumitrache <danielaandreea.dumitrache@nxp.com>
2024-01-09 09:59:23 +01:00
Anas Nashif
afc319e3fa ztest: shell: add shell support
- Support for listing both testcases and testsuites
- Support for running single suites or single test cases
- Support shuffling tests and repeating execution based on command line
  arguments.

For example, build with

west build -p  -b qemu_cortex_m3  tests/kernel/sleep   -t run -- \
-DCONFIG_ZTEST_SHUFFLE=y -DCONFIG_ZTEST_SHELL=y

Following commands are available:

uart:~$ ztest
ztest - Ztest commands
Subcommands:
  run-all          :Run all tests
  shuffle          :Shuffle tests
  list-testsuites  :List all test suites
  list-testcases   :List all test cases
  run-testsuite    :Run test suite
  run-testcase     :Run testcase

shuffle accepts two arguments --suite_iter and --case_iter which allows
repeated exercution of testcases or suites.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-09 09:58:57 +01:00
Anas Nashif
6ba0e9c797 tests: sleep: reduce verbosity
Reduce verbosity and debug messages on the screen.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-09 09:58:57 +01:00
Gerard Marull-Paretas
4a0d880350 soc: riscv: ite: reorganize SoC folder
Follow the vendor structure [1]:

- Family: ITE Embedded Controller SoCs
- Series: IT8XXX2
- SoCs: IT81202BX, IT81202CX, etc.

[1]: https://www.ite.com.tw/en/product/category?cid=1

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-09 09:40:07 +01:00
Gerard Marull-Paretas
0106e8d14c arch: riscv: introduce RISCV_PRIVILEGED
Introduce a new arch level Kconfig option to signal the implementation
of the RISCV Privileged ISA spec. This replaces
SOC_FAMILY_RISCV_PRIVILEGED, because this is not a SoC specific
property, nor a SoC family.

Note that the SoC family naming scheme will be fixed in upcoming
commits.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-09 09:40:07 +01:00