Commit graph

1568 commits

Author SHA1 Message Date
Yong Cong Sin
e54b27b967 arch: define struct arch_esf and deprecate z_arch_esf_t
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.

After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-04 14:02:51 -05:00
Dominik Ermel
9ea5aee810 tests/fs/littlefs: Allow tests to run on the nrf54l15pdk
The commit adds nrf54l15pdk/nrf54l15/cpuapp to list of allowed
platforms for default test configuration.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
7b36d34504 tests/dfu: Replace flash_area_erase with flash_area_flatten
Use flash_area_flatten instead of flash_area_erase; this allows
to run tests on devices that do not require explicit erase
before write or do not provide the callback.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
27f5291b94 tests/storage/stream_flash: Support for devices without explicit erase
Adds code that runs erase only when needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
7894474cf9 tests/settings: Move from flash_area_erase to flash_area_flatten
The Settings test wipe out areas to have a start clean,
so flash_arae_flatten will do that form them for program-erase
and no-erase devices.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
1ae352a760 tests/fs: Replace flash_area_erase with flash_area_flatten
Test of file systems use flash_area_erase to erase device
to have a clear start for tests; switching to flash_area_flatten
allows them to do the same with devices that do not explicit
call to erase procedure before write.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
bf7d25117a fs/nvs: Switch to use flash_flatten instead of flash_erase
The NVS currently requires explict erase capability of
a device to work, so usage of flash_erase has been replaced
with flash_flatten.
There has been additional LOG_WRN added to warn user that
NVS may not efficiently work with device that do not really
have erase.

Currently NVS relies on devices that require erase.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
64ccfb0479 fs/fcb: Replace flash_area_erase with flash_area_flatten
FCB depends on explicit erase characteristics of a device.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Dominik Ermel
a5f7ceff81 storage/flash_map: Add flash_area_flatten
Add equivalent of flash_erase, from Flash API, to Flash Map API;
idea is the same: function tries to erase area if driver provides
erase function, otherwise writes erase_value across the defined
area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Mathieu Choplain
8aa6ae43ce llext: add support for SLID-based linking
This commit introduces support for an alternate linking method in the
LLEXT subsystem, called "SLID" (short for Symbol Link Identifier),
enabled by the CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID Kconfig option.

SLID-based linking uses a unique identifier (integer) to identify
exported symbols, instead of using the symbol name as done currently.
This approach provides several benefits:
 * linking is faster because the comparison operation to determine
   whether we found the correct symbol in the export table is now an
   integer compare, instead of a string compare
 * binary size is reduced as symbol names can be dropped from the binary
 * confidentiality is improved as a side-effect, as symbol names are no
   longer present in the binary

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-06-03 15:29:34 -04:00
Luca Burelli
435b72dc18 llext: add a test for the pre_located feature
This test checks that the pre_located feature works as expected. It
creates a new extension that is manually relocated to a specific address
via the add_llext_command() CMake function invoking a custom linker
command. The test then loads the extension setting the pre_located
option and checks that the symbol is resolved properly.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-03 15:28:18 -04:00
Dominik Ermel
e801f1a9ad tests/fs/littlefs: Fix mimxrt1060_evk QSPI overlay
Changes to contents of boards directory for the board cause duplicate
definitions when combined with test overlay; the commit removes
duplicate partitions from overlay in test.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-03 05:06:29 -07:00
Mathieu Choplain
a07d493c9d llext: relocate all symbols regardless of type
In the current implementation, the LLEXT linker will only apply
relocations targeting a given symbol if it has a specfic symbol type.
This is overzealous and causes issues on some platforms, as some symbols
that need to be relocated are skipped due to being of a "bad" type.

Ignore the symbol type when performing relocation to solve this problem,
but also add checks to ensure we don't attempt to relocate symbols with
an invalid section index. If such a relocation is found, return an error
instead of ignoring the relocation entry to ensure that it is impossible
to execute code from a (partially) unrelocated LLEXT.

Also remove all hacks added to circumvent this issue:
* qemu_cortex_r5 exclusion from test cases
* unnecessary exclusion of some flags when building with LLEXT EDK

Fixes #72832.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-05-31 16:38:09 -05:00
RAJAGOPALAN GANGADHARAN
65c4ca1f05 fs: open: Add Truncate flag to zfs open
This commit has added new flag FS_O_TRUNC to support truncation
during file open. Modified fs_open to handle truncation based on
provided flags. Included unit tests for flag behavior with common
filesystems.

Signed-off-by: RAJAGOPALAN GANGADHARAN <g.raju2000@gmail.com>
2024-05-31 08:06:05 +02:00
Yong Cong Sin
0f6272e5bc tests: debug: symtab: add test
Add test for symtab.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-30 16:52:01 -05:00
Flavio Ceolin
8c5806472e tests: random: Move and rename rng test
Random number generator is a subsystem and although it is mostly used
in crypto, this is not its only utility.

Move the current random number generator test to it is own space
(tests/subsys/random) and rename it to rng.

We need more and better tests for rng, this is an initial commit
to organize it and get ready for further tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-30 16:48:31 -05:00
Mathieu Choplain
42731a04cb tests: subsys: llext: exclude apollo4 platform
Exclude the Apollo4 platform from LLEXT tests for now,
as they currently break CI due to #72775.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-05-30 11:55:35 +01:00
Alberto Escolar Piedras
b4d8b44d0f tests settings/file: Add missing overlay for native_sim//64
native_sim//64 is one of the allowed platforms
but lacks an overlay which causes the test to fail
to build.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-05-29 14:01:27 +02:00
Tom Burdick
054f453ea7 rtio: Callback chaining and testing
Callbacks were a bit neglected in terms of test coverage, especially
when used in chains. It was clear from the code that chained callbacks
may not actually work, and callback ordering then was hard to verify.
Test callbacks chained to transactions work as expected.

The test iodev had built up some cruft over time and in the process
showed a few bugs once callback chaining was fixed so the test iodev now
better matches typical iodev implementations at this point.

Cancellation testing now includes an added case for cancelling a the
second submission in the chain prior to calling submit noting that no
completions notifications should be given back for those.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-05-29 08:41:12 +02:00
Tomi Fontanilles
b9a7c18ce4 tests: mgmt: mcumgr: fs_mgmt_hash_supported: add unsupported platforms
- `stm32h745i_disco/stm32h745xx/m4` says "#error Flash driver on M4 core
  is not supported yet".
- `mpfs_icicle/polarfire/smp` fails in the compilation of the `spi_nor`
  flash driver.
- `cyw920829m2evk_02` fails to build because of undeclared
  `cyhal_nvm_*()` functions.

As a bonus, group the excluded platforms under the common part to
avoid repeating them.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-29 08:39:26 +02:00
Tomi Fontanilles
3efdbe6c0c modules: mbedtls: rename CONFIG_MBEDTLS_MAC_*_ENABLED and rm duplicates
Remove the `_MAC` part because those Kconfig options enable only hash
algorithms, nothing MAC-related, and the `_ENABLED` part to align the
naming to the Mbed TLS defines (plus we don't need such a part).

As a bonus, enabling SHA-256 does not automatically enable SHA-224
anymore.

See the migration guide entries for more details on the practical
changes.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-29 08:39:26 +02:00
Yong Cong Sin
bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Bjarki Arge Andreasen
000784b91d modem: chat: Add runtime APIs for chat scripts
Add runtime APIs for chat scripts.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-28 10:02:06 +02:00
Bjarki Arge Andreasen
2a575a6bf5 modem: chat: Add runtime API to modem_chat_script_chat
Add APIs allowing for modifying the modem_chat_script_chat
safely at runtime.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-28 10:02:06 +02:00
Bjarki Arge Andreasen
8b4822861b modem: chat: Add runtime API to modem chat matches
Add APIs for changing the contents of modem chat matches
safely at runtime.

This allows for reusing a single modem_chat_match at the cost
of placing the match and its buffers in RAM.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-28 10:02:06 +02:00
Swift Tian
cf5a273aa5 tests: subsys: fix emul test compile
Add CONFIG_EMUL=y to the test .conf

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-05-24 18:03:44 -04:00
Flavio Ceolin
3fb4e70306 tests: pm/device_runtime: Test pm_device_runtime_usage
Add tests covering possible branches in pm_device_runtime_usage()

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-22 15:08:39 -05:00
Flavio Ceolin
7ded97ee85 tests: pm/power_mgmt: Increase test coverage
Test device API for when a device does not implement device pm.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-22 15:08:39 -05:00
Krzysztof Chruściński
a5931c716f tests: debug: Add test for MIPI STPv2 decoder
Add test suite.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-05-21 16:48:28 -04:00
Jukka Rissanen
7bfbc937e6 tests: openthread: Disable native_posix board
Eventfd is not compatible with native_posix so disable testing
for it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-20 14:25:44 +03:00
Jukka Rissanen
d3df57afd4 tests: openthread: Add CONFIG_NET_TEST to make self contained
Add CONFIG_NET_TEST=y to make the test self contained and not
trying to create native_posix Ethernet interface which will
normally fail.
This prevents this error from printing

[00:00:00.000,000] <err> eth_posix: Cannot create zeth (-1)

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-20 14:25:44 +03:00
Johann Fischer
29003ff264 usb: bos: cleanup Binary Device Object Store header
We could reuse the BOS header, but there are parts that are only needed
in the legacy device support or used internally and the tests. Move this
parts to the appropriate places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Mahesh Mahadevan
d44a414574 tests: pm: power_mgmt_soc: enable testing on rd_rw612_bga
Enable the SoC power management test suite on the NXP RW612 EVK
development board.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-05-16 18:53:51 -04:00
Mateusz Michalek
dc59cb56ed tests: storage: flash_map: _NODE macros
adds API checks for fixed partitions access macros that are
called with nodes as an argumet.

Signed-off-by: Mateusz Michalek <mateusz.michalek@nordicsemi.no>
2024-05-16 16:21:34 +02:00
Daniel DeGrasse
1a256c7c21 tests: subsys: sd: report bus frequency, report timing correctly
Report bus frequency, and use correct names for the timing modes when SD
cards do not support UHS modes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-16 09:21:03 +02:00
Jordan Yates
23ca74b756 convert: use k_uptime_seconds
Replace usage of `k_uptime_get() / MSEC_PER_SEC` and
`k_uptime_get() / 1000` with dedicated function.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-05-14 09:32:01 +02:00
Corey Wharton
bf114c6b1a logging: add API to trigger immediate processing of logs
There are use cases where it's beneficial to trigger the log
thread to process log messages as soon as able instead of waiting
for the processing timer or threshold triggers. An example would be
to flush the log buffer before entering the idle thread after
forcing a system power state.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2024-05-13 16:06:11 -04:00
Corey Wharton
2b9c552050 logging: fix logging.async test
Test has code to test conditions where CONFIG_LOG_PROCESS_THREAD=y
but this option was not enabled in any of the tests. This code was
using removed APIs and did not build anymore. This change enables
the log thread for the logging.async and fixes the tests.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2024-05-13 16:06:11 -04:00
Tomi Fontanilles
73da457dca tests: mgmt: mcumgr: fs_mgmt_hash_supported: make CI green
Exclude some more platforms from the tests.
They provoke devicetree-related build errors which weren't introduced
by the changes in this PR (#71947).

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-10 18:24:38 -04:00
Tomi Fontanilles
6002abe519 mgmt: mcumgr: replace Tinycrypt by PSA
As part of ongoing work to move away from TinyCrypt and towards PSA
(#43712), make fs_mgmt use either PSA (when available) or MbedTLS
(as a fallback) for SHA-256.

The use of PSA is guarded by CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT
which requires a locally-built PSA core for devices without TF-M.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-10 18:24:38 -04:00
Guennadi Liakhovetski
8704a23cd7 llext: add a multi-file test case
Add a case, testing building an llext from multiple files, calling
functions and accessing data across files.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-09 10:28:50 +02:00
Johann Fischer
69e3e3a90d tests: usb: add usb_set_config() call to desc_sections test
With the previous changes, usb_set_config() is no longer called by
default at boot time, causing the test to fail.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-08 12:00:46 +02:00
Bjarki Arge Andreasen
330b23bd8b tests: modem_chat: Add test for timeout script chat command
Adds test for timeout script chat command, which is a script
chat command where only the timeout parameter is set. The
script will simply wait for the timeout duration, then move
on to the next script chat.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-07 15:09:21 -05:00
Hess Nathan
a5b1b3045b coding guidelines: comply with MISRA Rule 20.9
- avoid to use undefined macros in #if expressions

Signed-off-by: Hess Nathan <nhess@baumer.com>
2024-05-06 14:59:03 +01:00
Jeferson Fernando
4810914d00 tests: subsys: lorawan: add channels mask configuration tests
Checks the behavior of configuration of channels mask for LoRaWAN.
Are passed wrong masks sizes as argument, NULL pointer instead channels
mask buffer and the right case to validate the expected returns.

Signed-off-by: Jeferson Fernando <jeferson.santos@edge.ufal.br>
2024-05-03 09:51:46 +02:00
Martin Jäger
9e341b49c8 tests: subsys: lorawan: add frag_decoder unit-test
The unit test allows to test the frag decoder algorithms using random
binary data.

The coded fragments are created on the fly using the encoder algorithm
described by Semtech in the LoRaWAN TS004-1.0.0 document.

Signed-off-by: Martin Jäger <martin@libre.solar>
2024-05-02 16:54:43 +02:00
Mykola Kvach
5019f93258 tests: add h3ulcb and salvator xs m3configs to perf disk tests
Add MMC related cfgs/overlays of arm64 gen3 rcar boards to perf and
susys/sd/mmc tests.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2024-05-01 10:55:11 -04:00
Fabio Baltieri
02114bf822 tests: shell: add tests for "device list"
Add tests for the "device list" output with the various configuration of
device power management.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-05-01 10:31:03 +02:00
Fabio Baltieri
3574050ed2 tests: shell: add a test for shell_device_filter
Add a test for shell_device_filter and shell_device_lookup.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-30 19:30:15 -05:00
Anas Nashif
aa2b72d32a tests: logging: remove userspace testing
This test is disabled upstream for a while and only run on zephyr
toolchains. Logging is missing the support needed for userspace, see
releated issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-04-25 09:55:08 +00:00