Commit graph

1568 commits

Author SHA1 Message Date
Guennadi Liakhovetski
dbea13a1c7 llext: fix read-only extension image
When using the LLEXT buffer loader we now avoid copying extensions
from storage to allocated memory by pointing directly into the stored
image. We then also perform linking and relocation in that memory,
which modifies its contents. However, this is impossible if that
storage is read-only. Add a Kconfig flag to distinguish between
writable and read-only storage types. Also use that flag to decide,
whether the extension image in test_llext_simple.c should be defined
as const or not.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski
b9bdae8c07 llext: add support for exporting symbols from extensions
Extensions should be able to selectively export their global symbols.
Add a LL_EXTENSION_SYMBOL() macro for that. Change the present
.sym_tab to be a temporary symbol table of all global symbols in an
extensions, used only during linking for internal purposes. Add a new
.exp_tab symbol table to store symbols, exported by an extension
permanently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski
a2acd7b2fb llext: add reference counting
Extend the llext_load() / llext_unload() API to let it be called
repeatedly for the same extension to increment or decrement its
reference counter respectively. We use a mutex to protect the counter
and make both llext_load() and llext_unload() return the use-count to
let the caller identify when the first loading and the last unloading
took place.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski
e5c8d181d4 llext: add Xtensa test support
Add support for running a modular "Hello world" example on Xtensa.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski
b0b4b0baa0 llext: make local relocations optional
Some applications can decide to link their loadable objects for
exactly the same addresses, where they will be loaded. In those cases
local relocations aren't needed any more and can in fact break the
object if applied while the object is in a temporary storage. Add a
parameter to skip such local relocations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Alberto Escolar Piedras
f981bf2fa0 tests/subsys/*: Switch integration platform to native_sim
Swith integration_platforms from native_posix(_64)
to native_sim(_64).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras
0f5a0327e6 tests/subsys/canbus/isotp/conformance: Replace native_posix in comment
Replace native_posix with native_sim in a comment.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras
345c25659c tests/subsys/bindesc/definition: Enable for native_sim
Enable bindesc.define also for native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Fabio Baltieri
c8f4455ef8 tests: input: api: dedup some test properties
Move some common properties in the common field.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-30 10:19:42 +00:00
Rodrigo Peixoto
2fa6a440ae tests: zbus: replacing K_NO_WAIT with K_FOREVER in integration tests
The zbus_chan_read with K_NO_WAIT was generating a fail in the
qemu_riscv32_smp board. This fix replaces the K_NO_WAIT with a K_FOREVER
on the test, which would not affect the test execution for other
platforms/boards.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2023-11-29 19:51:13 +01:00
Keith Packard
9f703b88f9 tests/log_output: Avoid printf stack overflow with old picolibc
Before picolibc version 1.8.5, the only version of printf available with
long long output support was the version including full support for
floating point numbers and positional parameters. That version uses more
stack space than the limited version causing an overflow.

Increase the ztest stack space by 128 bytes.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-11-28 15:32:12 -05:00
Carlo Caione
9025789064 tests: Add test for the memory allocator
Add a new test for the attribute-based memory allocator.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-11-27 19:56:48 +01:00
Alberto Escolar Piedras
b51f0ee4cd tests/subsys/testsuite/fff_fake_contexts: Enable for native_sim
Enable this test which runs in native_posix_64 in native_sim,
Switch from native_posix_64 to native_sim_64 as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
2231c3ab97 tests/subsys/usb/*: Enable for native_sim
Enable all these tests which run in native_posix in native_sim,
Switch from native_posix to native_sim as default test platform
And switch native_posix overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
1d64f1b397 tests/subsys/openthread: Enable for native_sim
Enable these test which run in native_posix in native_sim
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
e628a5b9d0 tests/subsys/logging/*: Enable for native_sim
For all tests which were enabled for native_posix
enable them also for native_sim.
For those with native_posix as integration_platform,
set native_sim instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
aa683e2a8b tests/subsys/logging/log_backend_fs: Simplify and enable for native_sim
* Simplify the test definition by using an EXTRA DTC overlay
  so we don't need one test per board
* Move native_posix overlays to native_sim
* Switch the default integration platform to native_sim
  from native_posix

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
bf937b0d92 tests/subsys/mgmt/mcumgr/*: Switch to native_sim
Enable all these tests which run in native_posix in native_sim,
For those with native_posix as default test platform,
which it to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
bb090128f6 tests/subsys/mgmt/ec_host_cmd/*: Enable for native_sim
Enable these test which run in native_posix in native_sim,
And set native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
c47702cb7e tests/subsys/shell/shell_flash: Enable for native_sim
Enable this test which runs in native_posix in native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
617616888f tests/subsys/bindesc: Enable for native_sim
Enable these tests which run in native_posix also in native_sim,
And add native_sim as default test platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Alberto Escolar Piedras
8d6421df04 tests/subsys/emul: Enable for native_sim
Enable this test which runs in native_posix in native_sim,
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Bjarki Arge Andreasen
bec7789862 tests: modem: backend: uart: Add fixture to test suite
Add fixture to test suite to allow for and signal that the test
must be run on real hardware.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2023-11-27 12:18:19 +00:00
Juliane Schulze
eeb6bf7dd9 input: make short-inputs optional
By making short inputs optional, the user can bypass short-events all
together if necessary (e.g. custom button-press listener).

Signed-off-by: Juliane Schulze <juliane.schulze@deveritec.com>
2023-11-23 09:51:57 +00:00
Krzysztof Chruściński
c143daf98d tests: logging: log_backend_uart: Disable backends other than UART
Test expects that there are no other backends enabled and some
may be enabled by default.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-11-23 10:02:45 +01:00
Fabio Baltieri
5efa5b2892 tests: drop input_ prefix from input tests
These are already in a "input" subdirectory, the prefix is redundant,
drop it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-22 23:22:38 +00:00
Alberto Escolar Piedras
6d762359a5 tests/subsys/storage/*: Switch to native_sim
Enable all these tests which run in native_posix in native_sim,
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:54:03 +01:00
Alberto Escolar Piedras
f59c9c0dde tests/subsys/input/*: Switch to native_sim
Switch from native_posix to native_sim as default test platform
And switch overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:54:03 +01:00
Alberto Escolar Piedras
13b7557fe1 tests/subsys/modem/*: Switch to native_sim
Enable all these tests which run in native_posix in native_sim
And add native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:54:03 +01:00
Alberto Escolar Piedras
1a2fc865d2 tests/subsys/fs/*: Switch to native_sim
Enable all these tests which run in native_posix in native_sim,
Switch from native_posix to native_sim as default test platform
And switch native_posix overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:54:03 +01:00
Alberto Escolar Piedras
b39d7c2c3d tests/subsys/pm/*: Switch to native_sim
Enable all these tests which run in native_posix in native_sim,
Switch from native_posix to native_sim as default test platform
And switch native_posix overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:54 +01:00
Alberto Escolar Piedras
81179bcd63 tests/subsys/mem_mgmt/mem_attr: Switch to native_sim
Enable native_sim for this test.
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:20 +01:00
Alberto Escolar Piedras
3d702e6ffa tests/subsys/dfu/*: Switch to native_sim
Switch from native_posix to native_sim as default test platform
And switch overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:20 +01:00
Alberto Escolar Piedras
b7fa935a0d tests/subsys/settings/functional/*: Switch to native_sim
Enable native_sim for these tests (platform_allow filter)
Switch from native_posix to native_sim as default test platform
And switch overlays from native_posix to native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:20 +01:00
Alberto Escolar Piedras
f27760ab47 tests/subsys/settings/file: Switch to native_sim
Switch from native_posix to native_sim as default test platform
And switch overlays to native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:20 +01:00
Alberto Escolar Piedras
3692675dcf tests/subsys/settings/fcb: Switch to native_sim
Switch from native_posix to native_sim as default test platform
Switch overlays from native_posix to native_sim.
And move overlays into a boards/ directory

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:53:20 +01:00
Keith Packard
1dc6279d12 tests/subsys/logging/log_backend_uart: Reduce printf size
When using picolibc before 1.8.5, the only way to get 'long long' support
was to use the full version, including floating point support. This is too
large for this testcase.

Reduce the size of the printf code by switching to the version without
64-bit integer support. This allows the test to pass when using older
picolibc versions, such as that included with SDK version 0.16.3.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-11-21 21:43:33 +01:00
Dawid Niedzwiecki
e6c7a4c968 tests: pm: add soc pm tests and sample for stm32f4x chip
Add soc power management test and blinky sample for the nucleo_f429zi
board.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-11-21 08:46:17 +00:00
Dmitrii Golovanov
23324fc5ba boards: qemu_xtensa: coredump: Enable coredump
Enable coredump on qemu_xtensa and qemu_xtensa_mmu.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-20 10:51:35 -06:00
Dmitrii Golovanov
5ed8bb74d4 tests: coredump: Adjust logging backend patterns to xtensa
Adjust tests/subsys/debug/coredump logging backend's output
matching pattern to Xtensa fatal errors handler's call sequence
difference.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-20 10:51:35 -06:00
Bjarki Arge Andreasen
d3f100355f tests: modem: backends: uart: Add UART backend test suite
The UART backend test suite performs 9 iterations of:

1. Open UART backend pipe
2. Transmit 8192 bytes of pseudo random data
3. Receive and validate bytes
4. close UART backend pipe

The test is run on real hardware, with the TX/RX pins
connected to each other to provide loopback functionality.

The test suite has been run on a STM32 and an nRF5340 board.
The test suite tests both the UART interrupt driven and
async APIs.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2023-11-20 13:03:08 +01:00
Lucas Tamborrino
16629cbabd tests: coredump: Remove matching pattern
On xtensa architectures the string "ZEPHYR FATAL ERROR"
comes after the coredump itself. The ordered regex will
incorrectly fail for this arch.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-11-16 09:30:19 +01:00
Yong Cong Sin
f5a27bcfe3 tests: logging: uart: increase test coverage
The test should work on any boards with UART console, so
increase the test coverage by adding `CONFIG_UART_CONSOLE`
filter and using `qemu_x86` as `integration_platforms` instead
of `platform_allow`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-14 12:26:48 -05:00
Dat Nguyen Duy
18a0660be0 samples/tests: skip samples/tests disable MPU for s32ze series
On SoC series s32ze, Zephyr application cannot run with MPU
disabled, skipping relevant samples/tests

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-11-13 09:48:43 +01:00
Dmitrii Golovanov
4d394f9d23 tests: coredump: Fix backend.logging test misconfig
The debug.coredump.backends.logging testcase did use 'console'
Twister harness whereas the test suite itself and the rest of
the testcases are implemented as Ztest. This misalignment
allowed to check basic output expected from the logging backend,
but caused inconsistency of the test suite results because
the 'console' Twister Harness can't use test cases' ID provided
by the 'Ztest' Twister Handler.
It is decided to focus the debug.coredump.backends.* suite
on the coredump backend API testing with Ztest.
The logging backend's resulting output should be tested
by its dedicated test suite debug.coredump.logging_backend
(tests/subsys/debug/coredump).

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-13 09:48:22 +01:00
Dmitrii Golovanov
1032fe3b5c tests: coredump: Extend backends test coverage
Extend coredump_backend tests:
 * fix COREDUMP_CMD_VERIFY_STORED_DUMP test was not executed.
 * add tests for these coredump commands:
   - COREDUMP_QUERY_GET_STORED_DUMP_SIZE,
   - COREDUMP_CMD_INVALIDATE_STORED_DUMP,
   - COREDUMP_CMD_ERASE_STORED_DUMP,
   - COREDUMP_CMD_CLEAR_ERROR.
 * extend the out-of-the-treee example 'empty' backend to
   execute the new tests.
 * fix the test's cmake project name.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-13 09:48:22 +01:00
Jamie McCrae
1855fd16f7 tests: mgmt: mcumgr: Add os_mgmt_datetime test
Adds a test which tests datetime set/get and hook callbacks

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-11-13 09:48:13 +01:00
Yong Cong Sin
6d9fcd83a9 test: logging: add testcase for multi-instance log backend uart
Add testcase for the multi-instance log backend uart using
emulated uart.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-13 09:47:06 +01:00
Yong Cong Sin
b89095cf12 tests: logging: log_syst: set backend ctx to its cb ctx when enable
Set the backend's context to its control block's context
instead of NULL when doing `log_backend_enable`, as the log
backend UART uses that later.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-13 09:47:06 +01:00
Dmitrii Golovanov
c88a7b659b tests: coredump: Extend matching patterns
Extend test matching patterns and fix cmake project name.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-10 10:40:33 +01:00