Commit graph

1519 commits

Author SHA1 Message Date
Bjarki Arge Andreasen add09f389b tests: modem: Add tests for sync script run functions
This commit adds tests to validate the behavior of the
new script run functions.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-18 14:11:40 +01:00
Gerard Marull-Paretas 724274247a tests: pm: move all devices to POST_KERNEL
There's no need to use APPLICATION level.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
YuLong Yao 6c3e5be8f7 tests: drivers: debug: add esp32c3_luatos_core
add overlay for esp32c3_luatos_core board

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-09-15 14:17:50 +02:00
Carlo Caione e4a125b6a4 dt: Make zephyr,memory-attr a capabilities bitmask
This is the final step in making the `zephyr,memory-attr` property
actually useful.

The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.

With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.

The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).

For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_VOLATILE |
			       DT_MEM_NON_CACHEABLE |
			       DT_MEM_OOO )>;
   };

The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-region = "NOCACHE_REGION";
       zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
   };

See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).

The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
			       DT_MEM_SW_ALLOCATABLE )>;
   };

Or maybe we can leverage the property to specify some alignment
requirements for the region:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_CACHEABLE |
			       DT_MEM_SW_ALIGN(32) )>;
   };

The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).

When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`

Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory  region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-09-15 12:46:54 +02:00
Mahesh Rao 80a863f947 tests: sip_svc: Add a stress test for sip_svc subsystem
Add a stress test for sip_svc subsystem using
INTEL SOCFPGA AGILEX platform.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-09-15 09:26:49 +02:00
Bjarki Arge Andreasen 40b9f51ee5 modem: pipe: Reinvoke receive ready on attach
This PR makes the modem_pipe instances track if they have
data ready to receive, and invoke the RECEIVE_READY event
every time they are attached if the backend implementing
the pipe has notified that receive is ready.

This mechanism ensures that modules attaching to a pipe
get the async RECEIVE_READY event immediately after
attaching to a pipe if there is data ready, instead of
having to poll the pipe, or worse, wait until newer data
becomes available.

The addition revealed a timing issue in the cmux test
suite. Specifically the CMUX instance now immediately
receives the response to a command which the CMUX
instance has not sent yet, causing it to drop the
response.

The CMUX test suite now uses the transaction
mechanism of the mock_pipe to wait for the command
before sending the response.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-14 16:44:04 -05:00
Gerard Marull-Paretas 691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Martin Jäger ef77fe3402 tests: canbus: isotp: conformance: fix global variable usage
Even though it was leading to the same result, the function should use
its parameter and not the global variable for desired frames.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-14 08:34:09 +02:00
Martin Jäger a816180b16 tests: canbus: isotp: conformance: add mode_check test
Add a test to check error codes if attempting to use ISO-TP with CAN FD
mode even though the controller supports classical CAN only.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-14 08:34:09 +02:00
Grant Ramsay 9e9cbd8ce4 tests: canbus: isotp: conformance: Add tests for CAN-FD support
Allow existing tests to run with CAN-FD.
Add new CAN-FD specific tests.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-14 08:34:09 +02:00
Andrei Emeltchenko c16218e3eb tests: ibecc: Update IBECC test README
Use :menuselection: for BIOS menu selection rendering.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-13 17:32:52 -04:00
Bjarki Arge Andreasen 4129b10b69 modem: tests: Add test case for partial matches
This commit adds a test for the partial matches.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-12 14:50:17 +02:00
Martin Jäger f13791d5ba canbus: isotp: use flags for configuration in isotp_msg_id
The previous design with dedicated bits in the structure required a
user to explicitly set each bit.

Using one flags variable allows to extend the features more easily
in the future and avoids breaking existing code.

This change is particularly useful for the FDF and BRS flags required
for CAN-FD support.

See also previous similar change for the CAN driver in
f8a88cdb27

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-07 09:43:56 +02:00
Martin Jäger 1ab434edda tests: canbus: isotp: implementation: enable for native_posix
The ISO-TP tests were disabled for native_posix in the past because of
timing issues.

The implementation test is working well with native_posix now and
should also be run in CI.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-04 19:19:44 +02:00
Damian Krolik 49fb5f0a1a nvs: replace CRC with better hash function for lookup cache
NVS lookup cache currently uses CRC8/16 as a hash function
to determine the cache position, which is not ideal choice.
For example, when NVS lookup cache size is 512 and 256
subsequent NVS IDs are written (that is, 0, 1.., 255), this
results in 128 cache collisions.

It is better to use a dedicated integer hash function. This
PR uses one of the 16-bit integer hash functions discovered
with https://github.com/skeeto/hash-prospector project. The
hash function was additionally tested in the context of NVS
lookup cache using simple NVS ID allocation patterns as well
as using real device NVS dump.

Also, add a test case to verify that the hash function is
not extremely bad.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2023-09-04 18:21:20 +02:00
Mykola Kvach 26c9721b67 fs: littlefs: add alignment arg to FS_LITTLEFS_DECLARE_CUSTOM_CONFIG macro
Add alignment parameter to FS_LITTLEFS_DECLARE_CUSTOM_CONFIG macro, it
speeds up read/write operation for SDMMC devices in case when we align
buffers on CONFIG_SDHC_BUFFER_ALIGNMENT, because we can avoid extra copy
of data from card bffer to read/prog buffer. See, how 'card_read_blocks'
function works.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-09-01 17:44:15 +02:00
Andrei Emeltchenko 2e3694c94f tests: modem: Fix using wrong size of char array
Convert pointer to string literal to array of char so that sizeof()
can correctly calculate size. Currently sizeof(msg) is effectively
sizeof(char *).

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-01 16:37:34 +02:00
Krzysztof Chruściński cebd140bee logging: log_output: Add optional tid formatting
Add option to prefix log message with thread ID or thread name.
Align tests and add test case to the log_output test.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-08-31 14:08:19 +02:00
Bjarki Arge Andreasen 10ac828776 tests/subsys/modem: Added unit tests for modem modules
The tests test each module independently using the mock pipe,
which implements the modem_pipe API, making it compatible
with the modem modules.

The modem_ppp module is slightly different from the others
since it also interacts with the network stack. To acheive
this, a mock implementation of the PPP L2 net iface has
been implemented in the test suite for the modem_ppp.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-08-30 13:48:51 +02:00
Rodrigo Peixoto 6880b8501d tests: zbus: fix tests to work with iterable sections observers
Adjust the `runtime_observers_registration` and `unittests` tests to work
with iterable sections channel observation. Add a sequence check for the
runtime observers. Add a tests for iterator functions for channels and
observer to work with `user_data` pointer.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2023-08-29 10:18:55 +02:00
Jamie McCrae 28e94dca06 tests: mgmt: mcumgr: all_options: Add settings_mgmt
Enables building the test application with settings management
group enabled to ensure it builds successfully.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-25 10:54:06 +01:00
Jamie McCrae a21a80ceb5 tests: mgmt: mcumgr: Add settings_mgmt test
Adds a test which checks settings_mgmt functionality.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-25 10:54:06 +01:00
Fabio Baltieri 7ca4eeaaf9 emul: change stub driver priority to kernel device default
Change the emulator stub driver priority to
CONFIG_KERNEL_INIT_PRIORITY_DEVICE. Makes this play well with build time
priority checking.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-25 10:31:02 +02:00
Anas Nashif 71eee6da4b tests: fs: add more tags
Add module names as tags, to trigger CI on those tests when module has
changed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-24 13:41:26 -04:00
Anas Nashif 7f201f4ccc samples/tests: littlefs: tag littlefs samples/tests
Tag with required module name to make the tests run when the module has
changed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-24 13:41:26 -04:00
Alberto Escolar Piedras 9eeb78d86d COVERAGE: Fix COVERAGE_GCOV dependencies
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.

Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.

When building for the native targets, all this was
unnecessary.

=> Fix the dependency.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-24 15:36:31 +02:00
Fabio Baltieri 058f256ea1 Kconfig.zephyr: check priorities by default
Enable build time initialization priority check by default.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Martin Jäger f7134c488e tests: canbus: isotp: conformance: remove shadow variables
Remove shadow variables found by -Wshadow by using the global recv_ctx
consistently throughout all the internal test helper functions.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-08-22 18:06:27 +02:00
Martin Jäger 387fdc9528 Revert "tests: canbus: rename shadow variables"
This reverts commit 505c17ed7b.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-08-22 18:06:27 +02:00
Daniel Leung 1f7e0de004 tests: storage: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung 19939dc7de tests: portability: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung a206764878 tests: pm: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung 59d859eb37 tests: mgmt: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung 04820d38d8 tests: logging: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung 505c17ed7b tests: canbus: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Jaxson Han 13ec85954f tests: subsys: rtio: Set to 1cpu as it is not SMP-safe
The current api rtio_mpsc_pop is not SMP-safe. When muilti threads on
SMP are racing to pop the node, it will likely break the queue. Set
CONFIG_MP_MAX_NUM_CPUS to 1 to temporarily fix the issue.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-08-21 13:27:07 +02:00
Jamie McCrae 5c88d45544 treewide: mgmt: mcumgr: Change "ret" to "err" for SMP version 2
This is a stable API treewide change changing the newly introduced
"ret" response to "err" as it was overlooked that the shell_mgmt
group already used "ret" to return the exit code of the command
and this created a collision. Since SMP version 2 was only recently
introduced, there should not be any public implementations of it
as of yet, but the original function has been kept and marked as
deprecated.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-21 10:18:50 +02:00
Florian Grandel 137a7edd6e drivers: ieee802154: nRF5: TX timestamp now refers to start of PHR
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel eacec3dad2 modules: openthread: radio: encapsulate OT 32-bit timestamp
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.

This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Johan Hedberg 03905f7e55 boards: x86: Add intel_ prefix to Elkhart Lake boards
This follows the same convention that has already been adopted by Intel
Alder Lake and Raptor Lake boards.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-08-15 11:24:35 +00:00
Julio Cesar 5e15e8cb48 boards: xtensa: Add support for YD-ESP32 board
Add `yd_esp32` board:

- Model name: YD-ESP32
- Manufacturer: VCC-GND® Studio
- Espressif module: ESP32-WROOM-32E

Signed-off-by: Julio Cesar <hi@jcsx.dev>
2023-08-15 11:15:39 +00:00
Fabio Baltieri a534169ed4 input: rename callback define macro to INPUT_CALLBACK_DEFINE
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it
feels like it's a bit overloaded. Rename it to a simpler
INPUT_CALLBACK_DEFINE.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-10 08:15:10 +00:00
Dino Li b4f88dcdc1 tests/cmsis_rtos_v2: increase main thread sleep time
In the mutex and semaphore tests, main thread will sleep for 10 ticks
to wait for test thread to finish its work. And test thread will wait
5 ticks for timeout test. This means that test thread has 5 ticks to
finish its job.
On platform where idle thread has low power mode enabled
(e.g. it8xxx2_evb), latency in waking up from low power mode will cause
main thread to wake up early before test thread has finished its work.
This symptom will break next test (osThreadGetCount() not equal to 2).
This change makes the test threads have a full 10 ticks to finish its job.

fixes: #57557

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-08-09 09:05:42 +00:00
Fabio Baltieri 693b19d0f2 input: add zephyr/ prefix to the event code sample and docs
The system still takes both prefixed and unprefixed dt-bindings files,
but let's use zephyr/ prefixed in the examples and documentation.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-04 10:41:57 +02:00
Franciszek Zdobylak 2e2a3cbd44 tests: fs: ext2: Add ext specific tests
Create tests specific for ext2 implementation.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 1169e09fab tests: fs: ext2: fix after changes in mkfs
Remove 'lost+found' dir in test that expects empty layout of directory.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 10364b756f tests: fs: ext2: Add basic fs test
Use test_fs_basic test in ext2 tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 6d0b831213 tests: fs: Make common fs_basic test
Make test_fs_basic test common.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak deea6a070b tests: fs: ext2: Add dirops test
Use test_fs_dirops in ext2 tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak aa3daba6e3 tests: fs: Make common dirops test
Make test_fs_dirops test common.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 9b5bbcfd50 tests: fs: ext2: Open flags test
Use common test_fs_open_flags test in ext2 tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 7ebb5f0e15 tests: fs: Move testfs_utils to common directory
Move utils for file system tests into common directory to allow other
tests to use them.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 7b7b334bc3 tests: fs: ext2: use fs_stat in directory tests
Use fs_stat function in tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak d86e880f6d tests: fs: ext2: Mount flags test
Use test_fs_mount_flags in ext2 tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 47ff827a8e tests: fs: Make mount flags test common
Expose test_fs_mount_flags test for other file systems' tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 9229cbbf43 tests: fs: ext2: create file and directory tests
Provide tests for file and directory creation.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak 1968910375 tests: fs: ext2: Mount tests
Implement tests for ext2 implementation. Tests can run on native_posix
platforms and on hifive_unmatched.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Jamie McCrae 9aa0d0f5ab tests: mgmt: mcumgr: cb_notifications: Fix SMP sync issue
Fixes an issue with a test whereby the reponse on the dummy device
can be fully send and processed prior to a callback being ran
which updates a variable, add a delay in the test to wait for the
sync to finish.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-02 11:28:41 +02:00
Anas Nashif 66969fc9a7 tests: mgmt: fix test identifiers
Use mgmt as the component, the same we use in other related tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-01 13:24:09 -04:00
Anas Nashif 63adf9e830 tests: openthread: fix identifiers
Remove tests.subsys from identifier, fixed tag.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-01 13:24:09 -04:00
Anas Nashif 27c67f2982 tests: coredump: unify identifiers of tests
coredump is part of debug subsystem, unify identifiers to have
everything in one bucket.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-01 13:24:09 -04:00
Francois Ramu 07d2b62cc7 tests: subsys: canbus changing the test thread priority
The test thread and the system workqueue have the same priority,
so it is a bit arbitrary whether the workqueue cleans up
the send context before the next send.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-31 10:09:25 +02:00
Ryan McClelland 0ae1e37ead tests: logging: fix double-promotion warnings
Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-07-31 10:08:27 +02:00
Gerard Marull-Paretas 8081fb3150 tests: subsys: pm: pwer_mgmt_multicore: remove PM_STATE_ACTIVE
pm_state_set() is never called with PM_STATE_ACTIVE.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-28 09:09:01 +00:00
Grant Ramsay b7f88b4301 tests: canbus: isotp: conformance: Add helper function to prepare FC frames
This reduces duplication in the tests

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-07-28 09:08:20 +00:00
Grant Ramsay e326b72bc0 tests: canbus: isotp: conformance: Update test to check padding correctly
The tests now properly validate frames under all padding configurations.
Part of test_sender_fc_errors was testing a receive FC error, this sub-test
is moved to test_receiver_fc_errors

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-07-28 09:08:20 +00:00
Florian Grandel a4cd5cee40 drivers: ieee802154: consistent high res timestamps
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps

All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.

The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.

For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).

Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g.  UTC, TAI, PTP, NTP, ...).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Florian Grandel 2668a7d83f tests: subsys: openthread: support CSL
Introduces coverage for OpenThread CSL platform API as far as channel
samples are concerned.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Florian Grandel 7232dd260e tests: subsys: openthread: support TXTIME
Adds a test suite configuration that enables TXTIME.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Florian Grandel 8737550f48 tests: subsys: openthread: simplify configure mocks
Removes redundant fakes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Juha Heiskanen 9a06ce19ad tests: mcumgr: MCUmgr and smp client unit test
Added unit test for testing IMG and OS group component's.

Added Unit test for SMP Client.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-07-27 14:35:43 +02:00
Jamie McCrae 9f56995d35 tests: mgmt: mcumgr: all_options: Add additional checks
Adds additional checks to enable more options for the build-only
check that compilation is successful.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-27 11:16:04 +02:00
Gerard Marull-Paretas a05371d353 pm: state: allow disabling certain power states
In some platforms it may be desirable to disable certain CPU power
states, for example, because they have extra requirements not available
on all boards/applications. Because `cpu-power-states` are defined at
SoC dts file levels, the only way to achieve that now was by re-defining
`cpu-power-states` property in e.g. a board file. With this patch, one
can now selectively set `status = "disabled";` to any power state and it
will be skipped by the PM subsystem.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-26 16:49:00 +02:00
Johann Fischer 430818ecaa sample/tests: remove CONFIG_USB_COMPOSITE_DEVICE usage
This is no longer necessary, as this option is selected as a dependency
for class implementations where it is required.
Also remove redundant test cases.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-07-26 14:37:15 +02:00
Jordan Yates b979ee9c0a tests: pm: test pm_device_driver_init
Test that `pm_device_driver_init` puts devices into the appropriate
state depending on the devicetree configuration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Jordan Yates 40d693371f tests: pm: update power domain behaviour
Update the expected power domain behaviour in the tests in line with
the driver implementation changes.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Manuel Argüelles 23259aecdd tests: enable flash tests for mr_canhubk3 board
Various tests enabled to use the on-board QSPI memory.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-26 09:44:14 +02:00
Marek Matej 3776402f40 boards: xtensa: esp32 board split
Remove virtual esp32 board and replace it with the
real word boards:

- esp32_devkitc_wroom
- esp32_devkitc_wrover (with PSRAM option)

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Jordan Yates b74efbe59e Revert "tests: pm: update power domain behaviour"
This reverts commit b82bbf5e31.
2023-07-25 14:17:11 +02:00
Jordan Yates d02e49c4f0 Revert "tests: pm: test pm_device_driver_init"
This reverts commit a4cfc1eb37.
2023-07-25 14:17:11 +02:00
Gerard Marull-Paretas e4c43e4cc9 pm: power-states node needs to be a child of cpus
This again aligns with Linux.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-07-25 09:16:14 +02:00
Gerard Marull-Paretas c008bf1720 tests: pm: power_states: use cpu0 to define cpu-power-states
There's no need to define a new CPU, we can re-use cpu0 in native_posix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-07-25 09:16:14 +02:00
Fabio Baltieri e7781626e7 tests: mcumgr: exclude lpcxpresso51u68
The test is failing for lpcxpresso51u68 with:

soc_flash_lpc.c:25:2: error: #error No matching compatible for
soc_flash_lpc.c
   25 | #error No matching compatible for soc_flash_lpc.c
      |  ^~~~~

Add the board to the exclude list, sort the list as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-25 09:15:46 +02:00
Jordan Yates a4cfc1eb37 tests: pm: test pm_device_driver_init
Test that `pm_device_driver_init` puts devices into the appropriate
state depending on the devicetree configuration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Jordan Yates b82bbf5e31 tests: pm: update power domain behaviour
Update the expected power domain behaviour in the tests in line with
the driver implementation changes.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Tom Burdick 49a97540dc rtio: Use an atomic completion counter
Rather than looking at the pool of completions for spinning use an
atomic counter of total completions ever done. The relative number of
completions being waited on by rtio_submit may then always be correctly
done.

Prior to this a race was possible, and understood, as
rtio_cqe_consumable was a likely but not guaranteed count of completions.
Sure enough on an SMP system the likely count was ahead of the actual
available completions and a race was caught by the simple test case.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-07-24 09:04:43 +00:00
Jamie McCrae f99d497281 tests: mgmt: mcumgr: Add handler_demo test
Adds a test that tests a build-only configuration of an
application which uses custom handlers is able to build, and
can be referenced in documentation.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 16:22:31 +02:00
Gerard Marull-Paretas bddf2d9dc0 tests: pm: select HAS_PM
Some tests provide their own PM hooks, adapted for testing purposes. Add
a new option to select HAS_PM, so that CONFIG_PM can be enabled.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Jamie McCrae 0001e23e52 tests: mgmt: mcumgr: all_options: Fix missing Kconfig
Fixes a missing Kconfig enabling MCUboot, which causes the test to
now fail to build.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-17 10:40:24 +00:00
Jaxson Han 8c81cc7179 tests: subsys: rtio: Reset the spsc before the test starts
The test case test_spsc_throughput reuse spsc without reset. Fix it by
resetting the spsc before the test case starts.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-07-12 14:27:40 +00:00
Fabio Baltieri b1bccc2ca8 tests: input_shell: add an input shell test
Add a test to validate the input shell command and event dump output.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-12 10:53:04 +00:00
Yuval Peress 10be3a1263 rtio: Implement a NO_RESPONSE flag for SQEs
When added, the SQE's completion will not generate a CQE.
Fixes #59284

Signed-off-by: Yuval Peress <peress@google.com>
2023-06-23 12:31:09 -04:00
Yuval Peress 8e5cae7fa3 ztest: Allow 'before' functions to run in privilaged mode
When writing a test suite, it's more common to want the 'before'
hook to run in privilaged mode, even when the test is run in userspace.
Reconfigure ztest to first run the test thread callback in privilaged
mode and only enter userspace after the test rule and suite's 'before'
functions ran.

Signed-off-by: Yuval Peress <peress@google.com>
2023-06-23 12:30:46 -04:00
Lucas Tamborrino 1ffca30747 tests: subsys: debug: coredump backends: add esp32xx overlay
Add overlay for esp32xx boards to coredump backends test.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-21 16:06:06 -04:00
Anas Nashif f573a702de tests: mcumgr: os_mgmt_info: simplify test yaml file
- Use common section to avoid duplication of excludes
- use mcumgr tag

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-21 09:36:24 +00:00
Gerard Marull-Paretas 48b201cc53 device: make device dependencies optional
Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-21 09:32:05 +02:00
Gerard Marull-Paretas 1ebd76ed51 pm: add prompt to DEVICE_DEPS_DYNAMIC
The option can now be set by projects. This change will also allow to
make it dependent on a future CONFIG_DEVICE_DEPS option.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-21 09:32:05 +02:00
Aastha Grover fb1651f2d3 tests: rtio_api: update default MAX_THREAD_BYTES TO 3
This is needed on some platforms where number of k_objects
created surpasses the allowed.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2023-06-20 18:13:33 -04:00
Alberto Escolar Piedras 585063606a tests: portability cmsis_rtosv2: Fix buffer aligment
The kernel requires the buffer to be word aligned.
Instead of assuming the word size is 32bits,
lets align the buffer to the size of a pointer,
which should match the word size (and which
is the check the kernel performs).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-20 10:45:33 +00:00
Florian Grandel 1ee4d3ed77 net: l2: ieee802154: document L1/L2 sep. of concerns
The method ieee802154_radio_handle_ack() does not belong to the
PHY/radio layer but to the L2 layer. It is a callback called from the
radio layer into the L2 layer and to be implemented by all L2 stacks.
This is the same pattern as is used for ieee802154_init(). The
'_radio_' infix in this function is therefore confusing and
conceptually wrong.

This change fixes the naming inconsistency and extensively documents
its rationale.

It is assumed that the change can be made without prior deprecation of the
existing method as in the rare cases where users have implemented custom
radio drivers these will break in obvious ways and can easily be fixed.

Nevertheless such a rename would not be justified on its own if it were
not for an important conceptual reason:

The renamed function represents a generic "inversion-of-control" pattern
which will become important in the TSCH context: It allows for clean
separation of concerns between the PHY/radio driver layer and the
MAC/L2 layer even in situations where the radio driver needs to be
involved for performance or deterministic timing reasons. This
"inversion-of-control" pattern can be applied to negotiate timing
sensitive reception and transmission windows, it let's the L2 layer
deterministically timestamp information elements just-in-time with
internal radio timer counter values, etc.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 16:20:21 -04:00
Florian Grandel b224a099fd net: l2: ieee802154: standardize RSSI value
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.

This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.

The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.

In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.

The conversion functions are fully covered by unit tests.

Fixes: #58494

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 07:16:32 -04:00
Anas Nashif 9f37ae902b tests/samples: set ram/rom limits on some samples/tests
Increase RAM requirements for some test, we have many exotic platforms
failing to link due to the size of the test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-13 09:38:27 -04:00
Anas Nashif b835b02136 tests: cleanup metadata and filtering
- Add integration_platforms to avoid excessive filtering
- Make sure integration platforms are actually part of the filter
- Fix some tags and test meta data

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-13 09:38:27 -04:00
Anas Nashif 7eea4b514a tests: mcumgr: update tags
add mcumgr as a tag for mcumgr tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-07 05:41:31 -04:00
Anas Nashif 0064b6e8b6 tests: samples: cleanup test tags, add integration_platforms
Use integration platforms and sanitize tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Krzysztof Chruściński 4f5be73491 tests: logging: log_link_order: Fix uninitialized memory access
Mocks used in the test were not initializing certain variables.
Valgrind detected that. Test was passing but could fail if some
garbage would end up in that memory.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-05-30 13:15:50 -04:00
Anas Nashif a543ba1f4d tests: use integration_platforms where applicable
Use integration_platforms where coverage is provided using one or few
targets instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-26 17:52:02 -04:00
Jamie McCrae 083f05dcdc tests: mgmt: mcumgr: Add smp_version test
Adds a test that checks various conditions of header/responses
for MCUmgr with different protocol versions.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-26 15:05:29 +02:00
Gerard Marull-Paretas 9a145e52a0 pm: policy: add support for events
Events in the power-management policy context are defined as any source
that will wake up the system at a known time in the future. By
registering such event, the policy manager will be able to decide wether
certain power states are worth entering or not.

Events will bypass the ticks argument received by the policy manager if
they occur earlier.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-25 16:29:40 -04:00
Anas Nashif 1c04ad41d7 tests: logging: cleanup test metadata
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Fabio Baltieri b9ea2c2705 build: downgrade the no optimization ztest error to warning
The current approach of failing the build on ztest with no optimization
broke coverage builds, and generally raised some concerns about being
too aggressive.

Downgrade the error to a warning and rework the option to inhibit the
warning, while also dropping it automatically for POSIX (that are not
really affected by stack size) and coverage run (that always runs with
no optimization).

Will reconsider this down the road if we still see issues filed for the
tests broken with no optimization and no further tuning.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-23 14:51:24 +00:00
Dawid Niedzwiecki aa0c0727b4 mgmt: ec_host_cmd: add config to create a dedicated thread
Add a config to decide if a new dedicated thread for Host Command is
created during initialization.

If not, the ec_host_cmd_task has to be called by another thread to
handle host commands.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-05-23 16:19:53 +02:00
Fabio Baltieri f5830f3c3f ztest: error out when building tests with no compiler optimizations
Many tests are known to fail when built and no compiler optimizations.
Add a CMake check to error out when building a ztest based test with no
optimization, ask not file issues about it but also adds an opt-out
option to bypass the error for tests are actually designed to work in
this setup.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-22 12:25:43 -04:00
Gerard Marull-Paretas dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Mahesh Mahadevan e3c5e9e058 pm: rt6xx: Enable OS Timer as wakeup source
Enable os_timer as a wakeup-source in the board
dts file.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-16 18:19:35 +02:00
Mahesh Mahadevan df26e99637 pm: rt5xx: Enable OS Timer as wakeup source
1. Enable os_timer as a wakeup-source in the board
   dts file.
2. Enable PM_DEVICE when PM is enabled.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-16 18:19:35 +02:00
Maciej Perkowski 75b062a6d6 tests: samples: Resolve duplicates in names.
Several duplicates were found with
scripts/twister -T samples/ -T tests/ --dry-run --list-test-duplicates
This is an issue since duplicated names causes overwriting of
results. Most duplicates looked like obvious copy-pase errors.
New names where addopted looking at other tests in the same yaml
or looking at the directory/descriptio.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-05-16 06:21:25 -04:00
Yuval Peress 7153157f88 rtio: Add support for multishot reads
- Introduce multishot reads which remain on the SQ until canceled

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-15 10:10:12 -04:00
Yuval Peress 2c30920b40 rtio: add cancel support
- Add a new API `rtio_sqe_cancel` to attempt canceling a queued SQE
- Add a new syscall `rtio_sqe_copy_in_get_handles` which allows getting
  back the SQE handles generated by the copy_in operation so that they
  can be canceled.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-15 10:10:12 -04:00
Jamie McCrae 1c70aebb86 tests: mgmt: mcumgr: all_options: Fix Kconfig options
Fixes an issue with missing depdency Kconfig selections.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 09:27:16 +02:00
Jamie McCrae 1e1507f480 tests: mgmt: mcumgr: os_mgmt_info: Update callback format
Updates the format of the MCUmgr callback to use the new style.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 09:27:16 +02:00
Jamie McCrae 3d6035d37e tests: mgmt: mcumgr: cb_notifications: Update callback format
Updates the format of the MCUmgr callback to use the new style.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 09:27:16 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Tom Burdick ea8930bd78 rtio: Cleanup the various define macros
Reworks the zephyr macros and pools to be objects in their own right. Each
pool can be statically defined with a Z_ private macro. The objects can
then be initialized with an rtio instance statically.

This cleans up a lot of code that was otherwise doing little bits of
management around allocation/freeing and reduces the scope those functions
has to the data it needs.

This should enable sharing the pools of sqe, cqe, and mem blocks among rtio
instances in a future improvement easily.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-10 00:39:43 +09:00
Tom Burdick d41c182e32 rtio: Make MPSC faster on non-smp systems
On non-smp systems where multiple cores aren't in play atomics aren't
really necessary and volatile can be used in stead.

Additionally marks the push function as ALWAYS_INLINE as I saw at times
it was not being inlined.

MPSC operation speed is crucial to the performance of rtio, these changes
provided a 30% throughput improvmement in the throughput test.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-10 00:39:43 +09:00
Tom Burdick fc32f1c076 rtio: Add throughput test
Test throughput of submit and consume pair for rtio

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-10 00:39:43 +09:00
Tom Burdick e4b10328b4 rtio: Use mpsc for submission and completion queue
Rather than the rings, which weren't shared between userspace and kernel
space in Zephyr like they are in Linux with io_uring, use atomic mpsc
queues for submission and completion queues.

Most importantly this removes a potential head of line blocker in the
submission queue as the sqe would be held until a task is completed.

As additional bonuses this avoids some additional locks and restrictions
about what can be submitted and where. It also removes the need for
two executors as all chains/transactions are done concurrently.

Lastly this opens up the possibility for a common pool of sqe's to
allocate from potentially saving lots of memory.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-10 00:39:43 +09:00
Kumar Gala bae0a5b8b6 logging: Use TYPE_SECTION macros for log const
Clean up log_const to utilize macros for handling sections.

Update database_gen.py to match naming convention change.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-05-03 10:43:31 +02:00
Yuval Peress 3fd0a1508b rtio: fix bug in mempool release API
It was previously assumed that the 'sys_mem_blocks' struct would maintain
information about contiguous blocks allocated so the release API only
took the starting address. This led to an issue where allocating 2+
blocks would end up with a memory leak because any block not being the
first would never be released.

Add the buffer length as an argument so the correct number of blocks can
be released. Also, ammend the tests to match and verify.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-01 09:26:06 -05:00
Aaron Massey 07ee466591 emul: Migrate all emulation use to use DT_HAS_
Remove all enabling of CONFIG_EMUL_.* in favor of automatically enabling
peripheral emulators based on the compatible string presence in the device
tree and the one true CONFIG_EMUL.

Zephyr has long since moved to a model of enabling drivers based on the
presence of their associated IC's compatible string in the final devicetree
overlay. There is no reason that emulators can't align in just the same
way, and probably ought to to remove superfluous enabling of configs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-04-28 08:37:33 -05:00
Keith Packard 41fb993baf tests/subsys/logging: Require a full C library
These tests all require a full C library to run. Replace the condition
checking for either newlib or picolibc with a check for
CONFIG_FULL_LIBC_SUPPORTED instead, then add CONFIG_REQUIRES_FULL_LIBC=y to
ensure a full libc is used.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-27 20:18:11 +09:00
Keith Packard 4134858868 tests/samples: Replace minimal libc malloc configs with common ones
With the minimal C library malloc implementation moving to libc/common, all
of the related Kconfig variables have also changed. Update uses within the
tree.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-27 20:17:24 +09:00
Francois Ramu ff68cb22be tests: pm: stm32 soc power mgmt for nucleo_l476rg
Give the nucleo_l476rg board and overlay to enable the lptim
so that usecase can run on that target board
This target is a platform candidate for this PM usecase

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-25 10:37:13 -07:00
Dominik Ermel 1e1f3ba73c mgmt/mcumgr: Add tests for zcbor_map_decode_bulk_reset
Testing of zcbor_map_decode_bulk_reset.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-04-24 13:28:49 +02:00
Dominik Ermel 06b0e504e6 mgmt/mcumgr: Add test for zcbor_map_decode_bulk_key_found
Test case for zcbor_map_decode_bulk_key_found.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-04-21 16:28:34 +02:00
Roman Dobrodii 2f0ce5a3e8 tests/subsys/pm/power_mgmt_soc: fix various bugs
- Reduce "extra" added latency when trying to enter light
  sleep from 500ms to 50us, since light sleep states
  (e.g. "WFI idle") usually have microsecond-range residency
  times.
- Keep "extra" latency when entering deep sleep the same at
  1100ms (as we're trying to enter the deepest sleep state
  available, it doesn't hurt).
- Replace k_uptime_delta() with manual subtraction since
  k_uptime_delta() updates starting timestamp which leads to
  incorrect timing measurement when k_uptime_delta() is
  called for the second time.
- Measuring PM sleep entry latency using pm_notifier entry
  callback, do it only for the first PM entry event after
  calling k_usleep(), as during the sleep PM entry & exit
  may happen multiple times and that is normal.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-19 17:12:42 +02:00
Gerard Marull-Paretas 1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Kumar Gala b589092470 tests: rtio: fix compile warning with arm-clang
When building the rtio_api tests with arm-clang we get the following
compiler warning:

rtio_api/src/test_rtio_api.c:436:58: warning: format specifies type
'unsigned long' but the argument has type 'uintptr_t'
(aka 'unsigned int') [-Wformat]

        TC_PRINT("userdata is %p, value %lu\n", cqe->userdata, idx);
                                        ~~~                    ^~~
                                        %u

Use PRIuPTR to fix the issue.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-18 10:52:39 -04:00
Gerard Marull-Paretas 667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Gerard Marull-Paretas 4863c5f05b sys/util: extend usage of DIV_ROUND_UP
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Yuval Peress dbb470ea7a rtio: Add a managed memory pool for reads
- Introduce a new Kconfig to enable mempool in RTIO
- Introduce a new RTIO_DEFINE_WITH_MEMPOOL to allocate an RTIO context
  with an associated memory pool.
- Add a new sqe read function rtio_sqe_read_with_pool() for memory pool
  enabled RTIO contexts
- Allow IODevs to allocate only the memory they need via rtio_sqe_rx_buf()
- Allow the consumer to get the allocated buffer via
  rtio_cqe_get_mempool_buffer()
- Consumers need to release the buffer via rtio_release_buffer() when
  processing is complete.

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-10 18:34:43 -04:00
Yuval Peress 80d70b4e96 rtio: Add cqe per each sqe in transaction
Update the policy such that every completed sqe has a parallel cqe.
This has the primary purpose of making any reads in the sqe visible
to the consumer (since they might have different buffers).

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-10 18:34:43 -04:00
Dawid Niedzwiecki 4ef47888ef ec_host_cmd: add UART backend
Add a new backend for Host Commands that uses UART. The backend bases
asynchronous UART API.

The UART backend is mainly used by FPMCU.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-04-07 13:05:59 +02:00
Dawid Niedzwiecki 73480edf00 ec_host_cmd: update test the directory structure
Create a separate directory per backend.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-04-07 13:05:59 +02:00
Anas Nashif fcefc27823 tests: remove intel adsp cavs platforms from filters
Remove all filters related to dropped platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Manuel Arguelles 09dd8c74ae littlefs: translate error code when mount fails
When lfs mount fails and there is no formatting requested, the return
code must be translated to errno before being passed to the application
layer.

Additionally, only log a warning that the FS will be formatted, when the
system is not read-only.

Fixes #56378

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-04-04 18:22:10 +02:00
Tom Burdick a0e27f1edb rtio: Move spsc buffer to bss
This can save a sizeable region of rom depending on the number of
spsc instances and their size.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-04-04 14:32:32 +02:00
Krzysztof Chruscinski 58b010fcbd tests: logging: log_links: Set CONFIG_LOG_DOMAIN_NAME in the test
Test was assuming that domain name is empty but on some
SoC CONFIG_LOG_DOMAIN_NAME is set by default and test
was failing. Add setting of domain name to test
configuration to ensure that same name is used for all
platforms.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-04-04 14:06:54 +02:00
Hein Wessels 37444656a8 tests: subsys: logging: timestamp: add custom timestamp tests
Adds tests for the custom timestamp functionality. It also
includes a basic test for the default behaviour.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-04-04 13:41:17 +02:00
Jordan Yates cf9c34462c tests: pm: device_runtime: test zephyr,pm-device-runtime-auto
Test that the `zephyr,pm-device-runtime-auto` flag correctly enables
PM device runtime on the device instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-29 12:21:13 -04:00
Jordan Yates c11e5d82ba tests: pm: device_runtime_api: update expected return values
Update the expected return values for `pm_device_runtime_get/put` when
PM is not supported.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:32 -04:00
Jordan Yates 11b5bdeff6 tests: pm: power_domain: test balanced operations
Test that power domain operations don't result in unbalanced requests
to the power domain when the original device has PM disabled.

Needed to resolve issues raised in #53979.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:16 -04:00
Fabio Baltieri 8bd0e13fc7 test: input: add tests for input_longpress
Add a testsuite for the input-longpress driver.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-24 13:48:28 +00:00
Jamie McCrae 7e77084cc3 tests: dfu: img_util: Replace prj_<board> files with overlays
Replaces the old prj_<board>.conf files with board overlays instead.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 10:18:32 +01:00
Jamie McCrae abc33f61e5 tests: dfu: mcuboot: Replace prj_<board> files with overlays
Replaces the old prj_<board>.conf files with board overlays instead.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 10:18:32 +01:00
Jamie McCrae 3ad67c891d tests: fs: fat_fs_api: Simplify configuration
Simplifies configuration by removing un-needed files

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 10:18:32 +01:00
Jamie McCrae 4294d43bc9 tests: fs: fcb: Replace prj_<board> files with overlays
Replaces the old prj_<board>.conf files with board overlays instead.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 10:18:32 +01:00
Dominik Ermel abb93d4089 fs: Prevent mounting file system re-using private data
The commit changes the fs_mount to not allow mounting same system,
with the same private data pointer, at two different mount paths.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-20 09:51:10 +01:00
Tom Burdick 610d307fa0 rtio: Properly track last sqe in the queue
The pending_sqe logic to track where in the ring queue the concurrent
executor had left off was slightly flawed. It didn't account for starting
all sqes in the queue and ending back up at the beginning.

Instead track the last SQE in the queue, from which the next one in the
queue will the one to start next.

If we happen to sweep the last known SQE in the queue, reset it to NULL
so the next time prepare is called we start at the beginning of the queue
again.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick 3353342e5f rtio: Add transactional submissions
Transactional submissions treat a sequence of sqes as a single atomic
submission given to a single iodev and expect as a reply a single
completion.

This is useful for scatter gather like APIs that exist in Zephyr already
for I2C and SPI.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick 3f02532616 tests: rtio: Split test suites up into files
The test suites have grown to cover different units really and having
them in one file was becoming a bit much to scroll around in.
Coincidentally found a accidental reuse of a define between the spsc and
mpsc tests.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Tom Burdick 1ba0251b26 tests: rtio: Fix potential race in iodev test
Race was possible though very unlikely between the atomic cas
and queue push/pop operations. The outcome of the race had it shown up
would have been a submission not worked on due to the timer never being
started. A small critical section fixes this and clarifies where the single
conumer part of the mpsc queue comes in despite there being multiple
contexts which may enter that section.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-17 12:49:57 -05:00
Gregory Shue 5623f54a35 fff: Add fff_extensions.h, RETURN_HANDLED_CONTEXT()
Add supplementary header <zephyr/fff_extensions.h>.  Add macro
to fff_extensions.h for simplifying definition of custom fake functions
needing call-unique information for producing desired output data.
When an array of custom fake context structures is defined and
the return field within the first structure instance is registered
with the standard SET_RETURN_SEQ() macro of FFF, the
RETURN_HANDLED_CONTEXT() macro provides the inverse logic to
recover the context structure for this called instance. The body of
the custom fake handler is provided to the RETURN_HANDLED_CONTEXT()
macro for appropriate execution and access to the custom fake
parameters.

A test suite is also provided to verify macro implementation and
illustrate usage. It is at:
zephyr/tests/subsys/testsuite/fff_fake_contexts/

This code was verified by:

1. (Pass) west build -p always \
            -b unit_testing tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/testbinary
2. (Pass) west build -p always \
            -b native_posix tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/zephyr/zephyr.exe
3. (Pass) ./scripts/twister -p unit_testing \
            -T tests/subsys/testsuite/fff_fake_contexts/
4. (Pass) ./scripts/twister -p native_posix \
            -T tests/subsys/testsuite/fff_fake_contexts/
5. (Pass) cd doc && build html-fast

Fix #55246

Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
2023-03-16 13:43:33 -04:00
Nicola Ochsenbein 31a384719d test: fs: fat_fs_api: Add tests for reentrant zephyr support
This commit adds tests for the FatFs FF_FS_REENTRANT option.

Signed-off-by: Nicola Ochsenbein <Nicola.Ochsenbein@husqvarnagroup.com>
2023-03-13 11:58:57 +01:00
Anas Nashif 1545f9ba7f tests: sd: remove subsys from test identifer
Component name should not be subsys.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-10 14:01:59 +02:00
Anas Nashif 24cb002588 tests: rtio: remove subsys from test identifer
Component name should not be subsys.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-10 14:01:59 +02:00
Anas Nashif 70745ae79d tests: input: remove subsys from test identifer
Component name should not be subsys.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-10 14:01:59 +02:00
Anas Nashif 9bb3ff7c46 tests: emul: remove subsys from test identifer
Component name should not be subsys.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-10 14:01:59 +02:00
Krzysztof Chruscinski 24ad096232 logging: Renamed internal defines to get rid of 2 suffix
Some internal macros were still using 2 suffix which comes from
time when there was v1 and v2. Cleaning up by removing the suffix.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-09 15:10:06 -08:00
Fabio Baltieri 67ccf6d564 tests: input: add an initial input testsuite
Add some initial tests for the input subsystem, covering all the APIs in
both synchronous and thread mode.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-06 11:47:32 -08:00
Fabio Baltieri bc612b8ebd boards: arm: add Arduino GIGA
Add support for the Arduino GIGA board, an STM32H747XI based development
board in Arduino form factor, featuring external flash, SDRAM, Bluetooth
and WiFi.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-06 12:33:57 +01:00
Krzysztof Chruscinski e5a6e145fe tests: logging: log_msg: Filter platforms with LOG_ALWAYS_RUNTIME set
Test is checking behavior of compile time macros used for generation
of log messages thus if platform enforces runtime approach does macros
are not available and complilation fails.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-03 21:41:21 +09:00
Jamie McCrae de004f1629 tests: mgmt: mcumgr: all_options: Add FLASH_MAP and STREAM_FLASH
Adds Kconfig options that are no longer automatically selected.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Jamie McCrae 2f8352abe9 tests: dfu: Select FLASH_MAP and STREAM_FLASH
These options now need to be selected to avoid a depdendency loop.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Tom Burdick e6596d7afc rtio: Drop stray printks in API test
Noticed the tests were a bit verbose, saw a few stray printks. Drop those
as they aren't really needed and potentially cause testing issues, printk
is a potential synchronization point.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick 2f9945f587 rtio: Exclude failing renode platform
Renode platform fails the test despite it working well on qemu riscv.
Ignore this particular platform for now.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick 3998f9f898 rtio: Shareable lock-free iodevs
By using an mpsc queue for each iodev, the iodev itself is shareable across
contexts. Since its lock free, submits may occur even from an ISR context.

Rather than a fixed size queue, and with it the possibility of running
out of pre-allocated spots, each iodev now holds a wait-free mpsc
queue head.

This changes the parameter of iodev submit to be a struct containing 4
pointers for the rtio context, the submission queue entry, and the mpsc
node for the iodevs submission queue.

This solves the problem involving busy iodevs working with real
devices. For example a busy SPI bus driver could enqueue, without locking,
a request to start once the current request is done.

The queue entries are expected to be owned and allocated by the
executor rather than the iodev. This helps simplify potential
tuning knobs to one place, the RTIO context and its executor an
application directly uses.

As the test case shows iodevs can operate effectively lock free
with the mpsc queue and a single atomic denoting the current task.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick e9f6eef791 rtio: Add lock free MPSC queue for iodevs and more
Adds a lock free/wait free MPSC queue to the rtio subsystem.

While the SPSC ring queue is fast and cache friendly it doesn't
work for all scenarios. Particularly the case where multiple rtio contexts
are attempting to work with a single iodev. An MPSC queue works perfectly
in this scenario.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Jamie McCrae af78cbdc99 samples and tests: Add REQUIRED to Zephyr find_package call
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-02 09:58:27 +01:00
Dawid Niedzwiecki 2d0a784c41 subsys/mgmt/ec_host_cmd: rework Host Command support
Rework the Host Command support. It includes:
-change API to backend
-change a way of defining rx and tx buffers
-fix synchronization between the handler and backend layer
-simplify the HC handler

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Dawid Niedzwiecki b2674a4b34 subsys/mgmt/ec_host_cmd: rename peripheral to backend
Follow naming pattern in the subsystems(logging or shell) and name
the layer between generic handler and peripheral driver "backend".

The name doesn't suit that well to the SHI backend, because there isn't
SHI API itself and the SHI interface is used only for the host
communication. So the backend code includes the peripheral driver itself.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Dawid Niedzwiecki e734adfb78 subsys/mgmt/ec_host_cmd: update directory structure
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Siyuan Cheng f874ba2746 zdsp: add in-place operaton test for basicmath
Add in-place calculatoin test for every functions in basicmath

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-21 15:06:06 +01:00
Siyuan Cheng b475e1fcbf zdsp: add ARC DSPLIB backend for zdsp
Introduce ARC DSPLIB backend zdsp library for ARC target.
Add agu and restrict attributes to map with ARC DSPLIB

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-21 15:06:06 +01:00
Siyuan Cheng a0db069978 zdsp: Introduce attribute marco for third-party backend
Introduce DSP_DATA and DSP_STATIC_DATA attribute marco
to support third-party backend

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-21 15:06:06 +01:00
Jamie McCrae 8051d974c3 tests: mgmt: mcumgr: fs_mgmt_hash_supported: Exclude boards
Excludes boards which do not have flash drivers which causes this
test to fail to build.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-20 11:27:43 +01:00
Jamie McCrae 1b4b979f87 mgmt: mcumgr: Change select to depends on in Kconfigs
Select in Kconfig causes many issues with dependency loops, this
resolves the issue by replacing most select with depends on for
MCUmgr, including updates to the sample smp_svr application and
tests.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-20 11:27:43 +01:00
Zhang Lixu e9d587c30c tests: emul: disable bmi160 trigger mode in emul's prj.conf
The trigger mode is enabled by default in bmi160's Kconfig.
After adding the interrupt support for bmi160 i2c instance,
it needs to disable the trigger mode if there is not int-gpios
in dts.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-02-19 20:41:56 -05:00
Anas Nashif 8b7a5a546f tests: zbus: modify test identifiers to match component
Use message_bus as component in all zbus tests for better organisation
and to be able to select them in test plans.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-19 20:39:20 -05:00
Peter Mitsis a18357c4f5 tests: fixes logging.add.async build warning
Fixes github issue #54537. Using a variable to point to the desired
format string generates a build warning when the -Wformat-security
compiler flag is used. To resolve this, replace the variable with
a macro to the format string.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-13 11:22:36 +01:00
Dominik Ermel a20f5edcd8 tests: fs: fat_fs_api: Add support for non-"flash map" devices
Test will now use disk_access_ functions to erase FAT FS
disk before some operations when target disk is not set with
CONFIG_DISK_DRIVER_FLASH.

Fixes #53151

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-09 11:14:52 +01:00
Henrik Brix Andersen 259ce0e2b9 tests: canbus: isotp: conformance: skip stmin test on low tick Hz
The CAN ISO-TP conformance test expects to receive a frame within STmin
(5 msec) + upper tolerance (5msec) = 10msec. The expectation fails when
CONFIG_SYS_CLOCK_TICKS_PER_SEC is too low.

Skip the STmin test case to allow the test suite to succeed on non-tickless
and emulation platforms, where CONFIG_SYS_CLOCK_TICKS_PER_SEC defaults to
100. Enable the tests for native_posix and native_posix_64.

Fixes: #54254

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-08 12:09:36 +01:00
Anas Nashif 0bc4fd4cb9 tests: fix various test identifiers
lib -> libraries to be consistent with everything else.
And fix identifier for a few stray tests that were wrongly
labeled/tagged.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-06 10:06:10 +01:00
Seppo Takalo b63a3abeb8 net: lwm2m: Move LwM2M tests to tests/net/lib/lwm2m
This directory has existing LwM2M tests and tests/net/lib
has other protocols as well, so keep all in one place.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-01-27 22:50:24 +09:00
Keith Short 9664f863eb test: emul: Verify backend API operation
Verify backend API is functional with the emulator subsystem.

Signed-off-by: Keith Short <keithshort@google.com>
2023-01-27 01:01:06 +09:00
Nicolas VINCENT 06d53b1343 settings fcb: Increase buffer for mcu with large write block size
Devices with write block size greater than 16 could not use settings_fcb
due to small buffer size.
Update value in test as well.

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2023-01-26 22:50:40 +09:00
Keith Packard 65427f47cf tests: logging: Stack overflow caught with TLS in log_core_additional
When thread local storage is enabled, log_core_additional generates stack
overflows in the main thread on several architectures. Increase the stack
size to 4096 bytes for this thread.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-26 10:04:33 +00:00
Andreas Chmielewski 2571d6c3e3 tests: lwm2m_rd_client: Added fff tests
Added unittests for lwm2m_rd_client.c using FFF framework.

Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
2023-01-25 14:55:02 +00:00
Jordan Yates 9eaf1f8b44 tests: pm: power domains: test supported device
Validate the powered state and transitions for an arbitrary device
hanging off a power domain.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-01-24 09:42:11 +01:00
Eivind Jølsgard cfa1ba1261 fs: fcb: add option to disable CRC for fcb entries
Add option to disable CRC for fcb entries. This improves the write
throughput significantly at the cost of not detecting corrupted data
in flash. This is beneficial for aplications that needs the extra
write throughput, where error detection is done elsewhere.

Allow the FCB entries in flash to have a valid CRC when CRC is
disabled in the FCB. This allows existing solutions to disable
CRC checking, while keeping the CRC areas intact. Note that this
is a one-way option.

Fixes #53707

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
2023-01-18 22:18:37 +00:00
Declan Snyder c4c5c239c7 tests: Support testing fatfs on mmc
Make another project configuration in the fat_fs_api
test to allow using mmc for the test

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder 8e4f08f235 tests: RT595 integration platform for MMC tests
Specifies RT595 as integration platform for MMC related tests

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder fea01b4254 tests: sd: Adds MMC test and Kconfigs
Adds MMC test and Kconfigs for MMC
Note: MMC not yet implemented as of this commit

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder a838eef33b sd: Changed KConfig Structure
Changed KConfig structure for SD:
- Better Menu Interface
- Changed symbol dependency structure

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Daniel DeGrasse b7cd970493 sd: add stub for SDIO support
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-14 09:22:22 +01:00
Stephanos Ioannidis 4a64bfe351 treewide: Use CONFIG_CPP instead of CONFIG_CPLUSPLUS
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis 5c58ebe55b tests: lib: cpp: Relocate tests/subsys/cpp to tests/lib/cpp
This commit moves the C++ library tests under `tests/subsys/cpp` to
`tests/lib/cpp` now that the C++ library has been relocated to
`lib/cpp`.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-01-13 17:42:55 -05:00
Tom Burdick b64caed8be tests: Add platform key to rtio_api test
It's enough that the rtio tests run once per each unique (arch, simulation)
platform.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-12 10:30:57 -05:00
Tom Burdick 7fba189640 tests: log_api platform key
Ensures the log_api tests only run once per unique (arch, simulator)
platform.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-12 10:30:57 -05:00
Andrei Emeltchenko 5608a80dea tests: logging: Fix wrong buf_check() parameter
After adding checking results from buf_check() fix also parameter.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-11 09:39:23 +01:00
Andrei Emeltchenko 2ea492e4a9 tests: logging: Add actual buf_check()
Check buf_check() results.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-11 09:39:23 +01:00
Andrei Emeltchenko b5fd057d90 tests: logging: Use proper type
Function cbpprintf() returns int type and may return negative error
code. Fixes static tool warnings.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-11 09:39:23 +01:00
Krzysztof Chruscinski b2c7c27894 Revert "test: log_output: Exclude qemu_arc_hs5x"
This reverts commit dfbfb3ff67.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-10 09:24:08 +01:00
Jamie McCrae de313d748a tests: mgmt: mcumgr: Add callback notification grouping test
Adds a test that check that grouped events work.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Jamie McCrae d6758557f5 tests: mgmt: mcumgr: os_mgmt_info: Check grouped events
Changes one of the callback register/unregister functions to use
2 events OR'd together instead of 2 events registered separately,
this is to help test that grouped events are working.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Keith Packard 8c462bff02 subsys/rtio: Add libc partition for usermode API test
When a libc partition exists, all user mode threads will need access to
libc variables. Add the libc partition in this test case to allow that.

This was detected by running the test on ARM32 with thread local storage
enabled as that uses z_arm_tls_ptr which is included in the libc partition.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-09 19:19:57 +01:00
Krzysztof Chruscinski a326f05b93 tests: logging: log_api: Fix test_log_arguments case
Test had by accident an early return and after removal case was failing
in certain configurations. It was failing because set of long messages
was not fitting into the logging buffer used in the test. Fixed the
test by adding more frequent processing between the messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-05 18:28:33 -05:00
Mahesh Mahadevan 6e688980a3 tests: power_mgmt_soc: Add overlay for MXRT595 EVK
Enable the OS Timer to be a wakeup source

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Mahesh Mahadevan 5022225699 tests: pm_mgmt_soc: Enable additional configs for RT595 EVK
The FlexSPI pins are reconfigured before going into Deep
Sleep mode to save power. The requires enabling
CONFIG_PM_DEVICE so we can access the flexspi pin settings.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Fabio Baltieri 691322a495 dts: bindings: drop remaining "required: false" from bindings
Drop the remaining "required: false" from the bindings, make CI happy.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Fabio Baltieri f5b4acac57 yamllint: indentation: fix files in tests/
Fix the YAML files indentation for files in tests/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Fabio Baltieri 3143e85a77 tests: logging: drop duplicate test
Drop duplicate entry for
logging.log_api_deferred_override_level_rt_filtering, it's already
declared with the same settings on line 106.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 10:34:18 +01:00
Fabio Baltieri a2e5bd1928 yamllint: fix all yamllint comments errors
Fix all hyphens errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(comments)'

Default config would be to require two spaces after the start of the
comment, proposing to keep it on 1, inline with the Linux binding
config, that is:

```
-  comments:
-    min-spaces-from-content: 1
```

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Fabio Baltieri bd4cdde4b0 yamllint: fix all yamllint colons, commas and empty-lines errors
Fix all colons and commas errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(brackets)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(commas)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(empty-lines)'

Default config is no space before, one space after, max 2 empty lines.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Krzysztof Chruscinski 5751f90185 tests: logging: log_msg: Fix test after mpsc_pbuf changes
Test started to fail after updated in mpsc_pbuf. It was failing for
two reasons:
- Expected capacity was not updated after change in mpsc_pbuf which now
has full capacity (does not use extra byte for empty vs full
distinction).
- Messages were claimed without freeing. It was faulty even before the
update since mpsc_pbuf is single consumer so only one message can be
claimed at a time. However, test was passing before unexpectedly.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-03 12:28:55 +01:00
Krzysztof Chruscinski 235ee63233 lib: os: mpsc_pbuf: Use flag for buffer full indication
Use flag instead of word in the buffer. Using this method allows
to dedicate full buffer capacity for data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski 475035835f tests: logging: log_api: Align native posix case
Remove extra string size addition to the log message size when posix
is used. First string is considered as read-only also for posix so it
does not add to the message size. Test was passing before but change
in data handling in mpsc_pbuf revealed bug in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Dominik Ermel db34adf9c3 mgmt/mcumgr: Standardise MCUmgr Kconfig names
Standardise Kconfig options for MCUmgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Rob Barnes 61b5566e74 logging: Add an option for a custom log header
There are scenarios when it is necessary to globally redefine
a log macro. The existing logging frontend is not sufficient since
it redirects at the function level.

One example is using pigweed_tokenzier. The pigweed tokenizer depends
on intercepting log strings at the macro level to function.

Introduce an option to include a custom application provided header
named "zephyr_custom_log.h" at the end of log.h. This allows an
application to extend the LOG_* macros globally.

This change includes a simple test that redefines the core LOG macros
to include a custom prefix.

Signed-off-by: Rob Barnes <robbarnes@google.com>
2022-12-22 11:09:59 +01:00
Jamie McCrae d7557102c0 mgmt: mcumgr: Add iterable section to register MCUmgr handlers
This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-22 11:03:04 +01:00
Declan Snyder 0afa2608db tests: fat_fs_api: MKFS still causing build errors
The MKFS portion of the test is still was being included
in the build when it shouldn't because of a file glob

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-21 13:37:03 +01:00
Arkadiusz Balys 3afd564bba modules: openthread: platform: Added setting default tx power
There were some requests from users for adding the possibility
of setting default openthread tx output power using kConfig.
It is possible by adding the CONFIG_OPENTHREAD_DEFAULT_TX_POWER
kConfig and assigning it to the tx_power variable in the radio.c
file in the Openthread module.

Added the possibility to set default openthread power using
kConfig.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2022-12-21 12:21:09 +01:00
Erwan Gouriou 66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Jamie McCrae 084b9b3514 tests: subsys: dfu: Remove nrf52 scratch
Removes deleting the nRF52840 scratch partition from tests as
this has now been removed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-20 11:57:38 +01:00
Jamie McCrae a6ecd729d1 tests: subsys: settings: Remove nrf52 scratch
Removes deleting the nRF52840 scratch partition from tests as
this has now been removed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-20 11:57:38 +01:00
Jamie McCrae 9a842588fb boards: arm: nordic nrf91* nrf53* nrf52* nrf51*: Remove scratch areas
The scratch partition is not needed since MCUboot now operates in
swap using move mode instead of swap with scratch, as a result, the
main partitions on Nordic nRF51, nRF52, nRF53 and nRF91 boards can be
expanded to help in fitting large applications to them.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-20 11:57:38 +01:00
Corey Wharton 21a7c2d7eb pm: don't suspend unready devices when entering low power states
The PM subsystem should not call the PM control callbacks on
uninitialized devices when entering low-power states.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2022-12-19 09:46:17 +00:00
Marcin Niestroj 0d26fe6c45 tests: settings: functional: remove per platform prj_*.conf
All per-platform prj_*.conf files are the same as prj.conf, so there is no
need to duplicate those configuration files.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Marcin Niestroj a854d1d6f5 tests: settings: remove explicit CONFIG_STDOUT_CONSOLE=y
This option is selected by default, so there is no need to select it
explicitly. Additionally, selecting this option for native_posix platforms
results in configuration time warning due to unsatisfied
!NATIVE_APPLICATION dependency.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Marcin Niestroj eea6587ac5 tests: settings: enable ARM MPU
Remove CONFIG_ARM_MPU=n from all settings tests. This is possible due to
CONFIG_MPU_ALLOW_FLASH_WRITE=y automatically being enabled, which was not
true some time ago.

Enabling ARM MPU allows to detect stack overflows during tests runtime.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Marcin Niestroj 1088a2d9d5 tests: settings: file: increase main stack size to 2kB
Running tests on `nrf52840dk_nrf52840` with ARM MPU enabled results in
following error:

  Running TESTSUITE settings_config_fs
  ===================================================================
  I: LittleFS version 2.5, disk version 2.0
  I: FS at mx25r6435f@0:0x0 is 16 0x1000-byte blocks with 512 cycle
  I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
  E: WEST_TOPDIR/modules/fs/littlefs/lfs.c🔢 Corrupted dir pair at \
     {0x0, 0x1}
  W: can't mount (LFS -84); formatting
  E: ***** MPU FAULT *****
  E:   Stacking error (context area might be not valid)
  E:   Data Access Violation
  E:   MMFAR Address: 0x20001f78
  E: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
  E: r3/a4:  0x0000b461 r12/ip:  0x00000000 r14/lr:  0x0000da8d
  E:  xpsr:  0x00003800
  E: Faulting instruction address (r15/pc): 0x00000000
  E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
  E: Current thread: 0x20000468 (main)
  E: Halting system

Increase main stack size to 2kB to prevent stack overflow.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Marcin Niestroj 06454d9ac6 tests: settings: functional: file: increase ztest stack size to 2kB
Running tests on `qemu_x86` results in following error:

  START - test_direct_loading
  E: Double Fault
  E: EAX: 0x00224820, EBX: 0x00000000, ECX: 0x00000010, EDX: 0x00000010
  E: ESI: 0x00224820, EDI: 0x00000000, EBP: 0x0021e020, ESP: 0x0021e000
  E: EFLAGS: 0x00000206 CS: 0x0008 CR3: 0x0022b000
  E: call trace:
  E: EIP: 0x001096ec
  E:      0x00109a76 (0x4)
  E:      0x0010a1f8 (0x78000000)
  E:      0x0010dbec (0x0)
  E:      0x00107a3c (0x224894)
  E:      0x00106ce2 (0x224940)
  E:      0x00104f11 (0x21e260)
  E:      0x00104747 (0x224f00)
  E:      0x0010476f (0x21e3c4)
  E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
  E: Current thread: 0x11a0a0 (test_direct_loading)
  E: Halting system

Similar error is on `nrf52840dk_nrf52840` when ARM MPU is enabled:

  START - test_clear_settings
  I: LittleFS version 2.5, disk version 2.0
  I: FS at flash-controller@4001e000:0xde000 is 16 0x1000-byte blocks \
     with 512 cycle
  I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
  E: WEST_TOPDIR/modules/fs/littlefs/lfs.c🔢 Corrupted dir pair at \
     {0x1, 0x0}
  W: can't mount (LFS -84); formatting
  E: ***** MPU FAULT *****
  E:   Data Access Violation
  E:   MMFAR Address: 0x20000d70
  E: r0/a1:  0x20000074  r1/a2:  0x20000084  r2/a3:  0x20000074
  E: r3/a4:  0x00000000 r12/ip:  0x000004ff r14/lr:  0x0000f221
  E:  xpsr:  0x41000000
  E: Faulting instruction address (r15/pc): 0x000093d8
  E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
  E: Current thread: 0x20000348 (test_clear_settings)
  E: Halting system

Increase ZTEST stack size to 2kB to prevent stack overflow.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Marcin Niestroj 4cef4de98d tests: settings: fcb: increase ztest stack size to 2kB
Tests are passing now on `nrf52840dk_nrf52840` platform, just because ARM
MPU is disabled and stack overflow is not detected. When running those
tests on `qemu_x86` there is following error during runtime:

  START - test_config_compress_reset
  E: Double Fault
  E: EAX: 0x0011c1c8, EBX: 0x00000002, ECX: 0x00000002, EDX: 0x0000100a
  E: ESI: 0x0000000a, EDI: 0x0021f370, EBP: 0x0021f000, ESP: 0x0021f000
  E: EFLAGS: 0x00000202 CS: 0x0008 CR3: 0x0022b000
  E: call trace:
  E: EIP: 0x001075be
  E:      corrupted? (bp=0x21f000)
  E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
  E: Current thread: 0x11b140 (test_config_compress_reset)
  E: Halting system

Same happens on `nrf52840dk_nrf52840` when ARM MPU is enabled:

  START - test_config_compress_reset
  E: ***** MPU FAULT *****
  E:   Stacking error (context area might be not valid)
  E:   Data Access Violation
  E:   MMFAR Address: 0x20008cb8
  E: r0/a1:  0x39beca54  r1/a2:  0x9abe9566  r2/a3:  0xe333d994
  E: r3/a4:  0x41387fc2 r12/ip:  0x7c2e5c00 r14/lr:  0xdc5006d9
  E:  xpsr:  0x81000000
  E: Faulting instruction address (r15/pc): 0x0000b50e
  E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
  E: Current thread: 0x200001d8 (test_config_compress_reset)
  E: Halting system

Increase ZTEST stack size to 2kB to prevent stack overflow.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-16 14:38:51 +01:00
Declan Snyder ff830fb0f8 tests: fat_fs_api: Conditionally compile MKFS test
MKFS testing inappropriately uses flash API in the FAT FS API test,
causing build errors for the test when testing file systems on storage
devices other than flash. Hotfix by making this part of the test
conditional on CONFIG_FLASH.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-14 18:37:09 +01:00
Marcin Niestroj 2d3365200c settings: file: drop CONFIG_SETTINGS_FILE_DIR
There is already CONFIG_SETTINGS_FILE_PATH, which is set to full file path,
while CONFIG_SETTINGS_FILE_DIR is required to be set to its parent
directory. This is redundant, as parent directory path can be easily found
out either during runtime or optionally during buildtime by CMake.

CONFIG_SETTINGS_FILE_DIR was actually introduced recently after Zephyr 3.2
release as a replacement of deprecated CONFIG_SETTINGS_FS_DIR. This means,
that there is no need to deprecate it for 3.3 release and dropping it
should be fine. Adjust 3.3 release notes accordingly, so that
CONFIG_SETTINGS_FILE_PATH will be used directly.

This patch stops using deprecated CONFIG_SETTINGS_FS_DIR. There is actually
no value in respecting it, as setting anything other than parent directory
of CONFIG_SETTINGS_FS_FILE makes no sense.

There is actually one use of CONFIG_SETTINGS_FILE_DIR in file backend
tests, to derive directory for files containing tested settings.
CONFIG_SETTINGS_FILE_PATH is not used there, so it makes little sense to
derive directory name from it. Instead, just use hardcoded "/settings"
subdirectory, as this was the default value of CONFIG_SETTINGS_FILE_DIR.

Deriving parent directory can be done either in runtime or in
buildtime (e.g. using some helper CMake function). Doing it in runtime
however allows to create directory recursively (which this patch actually
implements), e.g. for some more nested FS tree structure. Additionally it
will simplify migration of settings configuration from Kconfig to
device-tree (yet to be developed feature).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-14 14:11:03 +01:00
Evgeniy Paltsev d0f08e5422 tests: ARC: MWDT: allow allow-cpp.libcxx.arcmwdtlib for all arc targets
Allow allow-cpp.libcxx.arcmwdtlib for all arc targets in case of
ARC MWDT toolchain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-12-13 18:45:44 +01:00
Marcin Niestroj ffa622b5b9 tests: settings: file: merge file_littlefs
There is little point in keeping separate:
 * tests/subsys/settings/file
 * tests/subsys/settings/file_littlefs

directories, `file_littlefs` is just a thin layer used to setup test suites
for tests implemented in `file` directory.

Merge both directories together. Support for new FS can be added by simply
adding:
 * new `settings_setup_<FS_OF_CHOICE>.c` which implements
   `config_setup_fs()` function
 * expanding `testcase.yaml` to add new tests with
   `CONFIG_FILE_SYSTEM_<FS_OF_CHOICE>=y` extra config option

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-13 18:45:30 +01:00
Marcin Niestroj ba4cea40fd tests: settings: file_littlefs: relax dependency on LittleFS
Do some internal renaming to relax dependency on using LittleFS
specifically, making this test likely to be run on any FS.

Rename device-tree partition name `littlefs_dev` ->
`settings_file_partition`, so as does not need to be LittleFS to be
mounted and used for File settings storage.

Rename `config_setup_littlefs()` to `config_setup_fs()`, which can be
implemented for any other FS of choice.

Change FS mount point from '/littlefs' to '/fs'.

Rename `settings_test_littlefs.c` -> `settings_test_fs.c`, as this one just
defines test suites and there is nothing LittleFS specific.

Build `settings_setup_littlefs.c` only when
`CONFIG_FILE_SYSTEM_LITTLEFS=y`, so that any other FS can be added at a
later point with its specific implementation of `config_setup_fs()`
function.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-13 18:45:30 +01:00