Commit graph

866 commits

Author SHA1 Message Date
Johan Hedberg caf299ca23 boards: x86: Indicate ACPI support where applicable
There are several x86 boards that support ACPI, so indicate it in their
yaml files.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-11-02 14:04:07 +00:00
Johan Hedberg a77871b2e5 tests: Add ACPI test application
Add basic ACPI test application. Initially there are only tests for one
ACPI table (MCFG) and fetching the ACPI PRT, but this is already a good
start for caching regressions on the supported boards.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-11-02 14:04:07 +00:00
Yong Cong Sin 1782011d2c tests: devicetree: api: add tests for new DT APIs
Add tests for new DT APIs added in the previous commit:
- `DT_IRQN_BY_IDX`
- `DT_INST_IRQN_BY_IDX`

Added additional tests for the following existing DT APIs when
`CONFIG_MULTI_LEVEL_INTERRUPTS` is enabled:
- `DT_IRQN`
- `DT_INST_IRQN`

Added `qemu_riscv32` for the multi-level interrupt tests.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Benedikt Schmidt aa25e212d1 tests: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Keith Packard 51fee43122 tests/c_lib: Run tests on native/posix targets
With a few minor adjustments, these tests now run fine on native
targets.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Keith Packard 8780bd2b70 test/c_lib: Make sure time_t is at least 64-bits
Check to ensure that the C library doesn't have obvious 2038 issues.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Keith Packard 83db6ee7f5 test/c_lib: Skip strerror invalid input test for EXTERNAL_LIBC
Passing an invalid errno value to strerror is undefined behavior in
POSIX. While all Zephyr-specific C libraries may be required to return a
specific value, we can't hold an external C library to that standard.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Keith Packard e4681a0634 test/c_lib: Don't fail to compile tests with 32-bit time_t
The native library may use a 32-bit time_t, so we need to avoid
having the compiler generate an error during compilation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Keith Packard dfd584204c test/c_lib: Skip 'abort' test for EXTERNAL_LIBC
The native C library abort function isn't trapped within Zephyr.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Keith Packard 8283f8ca09 test/c_lib: Skip 'exit' test for EXTERNAL_LIBC
The native C library exit function does not do what we want.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-26 10:06:35 -04:00
Alberto Escolar Piedras b3de643206 tests cmsis_dsp filtering: Do not run filtering.misc.fpu on mps3_an547
Merging 565c9376f1
exposed an issue in this test, which causes an assert in the
mps3_an547.
For more information check
https://github.com/zephyrproject-rtos/zephyr/issues/64387

The issue needs further analysis.
With this platform being an integration
platform for this test, it gets triggered in CI by unrelated
PRs, causing CI failures and blocking development.

As an interim measure, to unblock development in the main branch,
let's exclude this platform from this test.

This commit should be reverted once the underlaying issue is
indentified and addressed.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-26 13:52:23 +02:00
Alberto Escolar Piedras c83c8df26a tests/lib/time: Fix for posix architecture
* Select always PICOLIBC. This is anyhow the default for all
  but the posix architecture. And for the posix architecture
  we need it as POSIX_CLOCK does not work with the host C
  library.
* Fix the testcase filtering. This sample works fine
  in native_sim (when not using the host libC),
  but does not work for native_posix(_64), as those can
  only be built with the host libC, and in that case,
  the POSIX_CLOCK provided functions will not be properly
  linked to.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-25 09:58:07 +02:00
Keith Packard 565c9376f1 tests: Switch from NEWLIB_LIBC to REQUIRES_FULL_LIBC
Instead of forcing use of NEWLIB_LIBC, select any available complete C
library implementation. Add CONFIG_REQUIRES_FLOAT_PRINTF where needed.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-25 08:32:06 +02:00
Alberto Escolar Piedras 4060f1d390 tests newlib: Exclude in posix architecture
These tests cannot be run in this architecture as it does not
support this toolchain.
Today they are filtered by kconfig, which works but spends
time running cmake.
As native_posix is a default test platform it is better
to filter it alltogether by arch, which saves quite a lot
of time.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-24 09:05:29 +02:00
Robert Lubos 822a82d619 tests: lib: thrift: Fix timing issues with TCP
The test delegates putting the server socket into listening (i. e.
calling listen() on the socket) to a separate thread, which did have a
chance to run before client attempted to establish TCP connection.

This was not visible before, as we did not reply with RST to a
connection attempt on a closed port, so the connection was eventually
establish after SYN retransmission. But as we do reject such a
connection now with RST, the connection attempt failed. Therefore, a
small delay was added after spawning the server thread, to give it a
chance to configure the server socket.

Additionally, lower the CONFIG_NET_TCP_TIME_WAIT_DELAY value so that TCP
contexts are released earlier, and add a respective delay in the test
teardown function. Not doing so also triggered unneeded SYN
retransmissions, as there were no enough TCP context to accept the
incoming connection, before freeing the resources allocated for the
previous one.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-10-20 15:13:22 +02:00
Anas Nashif e77a659698 cmsis_dsp: remove handling of old ztest API
Old ztest API is deprecated, so no need for the conditional code here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif 345735d0a8 tests: remove CONFIG_ZTEST_NEW_API in all tests
Remove all usage of CONFIG_ZTEST_NEW_API from tests and sample as this
is now enabled by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif f7456cb7cd tests: spsc_pbuf/ringbuffer: fix test meta data and components
Fix meta data and standarize components in test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Anas Nashif 3a81c76b3a tests: fdtable: fix test meta data and components
Fix meta data and standarize components in test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Anas Nashif 1164e33e0f tests: mpsc: fix test meta data and components
Fix meta data and standarize components in test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Anas Nashif 38a480c20e tests: cbprintf: fix test meta data and components
Fix meta data and standarize components in test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Gerard Marull-Paretas a19c7f2294 tests: lib: hash_map: fix libc heap size setting
The malloc arena/heap size setting can be adjusted using different
Kconfig options, depending on the libc implementation. This means
prj.conf can't be used to set this value on projects that can be built
for multiple libcs without generating a Kconfig warning.

Note: similar fix was applied for the hash_map sample, see
7ef8911e8c

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-10-10 12:26:15 -04:00
Flavio Ceolin e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Fabio Baltieri cf75c88a61 tests: newlib/thread_safety: exclude acrn_ehl_crb from more tests
This was already excluded from
libraries.libc.newlib_nano.thread_safety.userspace.stress and it's now
failing in libraries.libc.newlib.thread_safety.userspace.stress as well.

The issue is being rootcaused to a toolchain issue but a proper fix has
not been identified yet, exclude that test as well in the meantime.

Link: https://github.com/zephyrproject-rtos/zephyr/issues/61129
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-10 09:05:02 +01:00
Peter Mitsis baea37aeb4 kernel: Re-factor sys_mem_blocks definition
Rearranges the sys_mem_blocks fields so that information that describes
how much of the memory block is used is co-located. This will allow
easier of its statistics into the object core statistics reporting
framework.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Anas Nashif 34e16225eb neural_net: remove unused experimental API
Experimental API is not being used anymore, remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-29 20:48:33 -04:00
Henrik Brix Andersen 9783ed56d9 dts: bindings: can: deprecate the sjw and sjw-data properties
Update the descriptions for the various CAN devicetree timing properties
specified in Time Quanta (TQ) to make it clear that these, if present, are
only used for the initial timing parameters.

Deprecate the (Re-)Synchronization Jump Width (SJW) devicetree properties
for both arbitration and data phase timing as these are now only used in
combination with the other TQ-based CAN timing properties, which are all
deprecated.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-28 16:28:56 +02:00
Anas Nashif 6d23a960db lib: os: build fdtable conditionally
Stop building fdtable by default, make it conditional and build it only
when needed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-28 06:25:16 -04:00
Fabian Blatz c7f8033f2b modules: lvgl: simplify sys_heap memory size configs
Changes the Kconfig symbols for the sys_heap based memory management option
and removes the notion of `BLOCKS` with a more concise single
`LV_Z_MEM_POOL_SIZE` option. Also adds `LV_MEM_CUSTOM` to the lv_conf.h,
since in any option the memory management is considered to be custom.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-09-27 09:54:08 +02:00
Ryan McClelland b092094815 modules: cmsis-nn: add cmsis-nn module
This adds the cmsis-nn module since it moved to its own realm.
This also adds a kconfig for the long short-term memory.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-25 09:46:33 +02:00
Ryan McClelland 104ea2ccca modules: cmsis-dsp: add cmsis-dsp module
Use CMSIS-DSP from its new realm. This also changes change how you
initialize FFT tables as well to use arm_cfft_init_64_f32 if you
know the FFT size in advance rather than the generic initialization
arm_cfft_init_f32.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-25 09:46:33 +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
TOKITA Hiroshi 87209984f3 devicetree: rename and publish DT_COMPAT_ON_BUS_INTERNAL
Rename `DT_COMPAT_ON_BUS_INTERNAL` to
`DT_HAS_COMPAT_ON_BUS_STATUS_OKAY` to make it a public DT API.

It is helpful for code that handles multiple DT_DRV_COMPAT in one file,
such as in the following cases.

```
 #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(some_sensor, i2c) || \
      DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(another_sensor, i2c)
 ...
 #endif

 #define DT_DRV_COMPAT some_sensor
 DT_INST_FOREACH_STATUS_OKAY(DEFINE_SOME_SENSOR)

 #undef DT_DRV_COMPAT
 #define DT_DRV_COMPAT another_sensor
 DT_INST_FOREACH_STATUS_OKAY(DEFINE_ANOTHER_SENSOR)
```

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-13 14:23:24 -07:00
Martin Kiepfer d453c21384 boards: m5stack_core2: Exclude board from device tree test
m5stack_core2 enables i2c by default for regulator usage which
conflicts with the test and is therefore excluded from the test.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-09-11 11:06:36 +02:00
Ryan McClelland 8ea58fc43b tests: lib: cmsis_dsp: binary: fix double-promotion warning
Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-08 16:38:52 +02:00
Ryan McClelland ffe8815c8c tests: lib: cmsis_dsp: matrix: fix double-promotion warning
Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-08 16:38:52 +02:00
Anas Nashif 7741a9baf8 tests: move uoscore-uedhoc tests into tests/modules
Those are tests for a module, so put them under tests/modules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-28 13:37:39 -04:00
Anas Nashif 7fc40ee9fb tests: uoscore: depend on third party module
Tests should depend on the the module, so if we do not have the module,
we should not be building the test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-28 13:37:39 -04:00
Anas Nashif 98fc52f754 tests: uoscore: listify tags in testcase.yaml
Move tags to a yaml list instead of cramming them in one string field
the old-fashioned way.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-28 13:37:39 -04: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
Keith Packard 023d0e9dc0 tests/libcxx: Test aligned allocation with C++ new operator
Make sure the underlying allocation system can support an allocation
request generated by the new operator which has stricter alignment
requirements than the default. For G++, this ends up using the 'memalign'
function which is not part of any C standard.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-08-10 11:35:17 -04:00
Daniel Leung 614db9a631 tests: lib: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Ryan McClelland bf1efa868e tests: lib: cbprintf_package: fix long-double promotion warning
Long Double promotion warnings are generated with the flag
-Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-08 13:27:47 +00:00
Grzegorz Swiderski 04a7fcf321 tests: lib: devicetree: api: Add test_fixed_partitions
Add test suite for the DT fixed-partitions API. It is verified on two
kinds of MTD nodes, one of which is meant to represent external memory.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-07 15:45:23 +02:00
Fabio Baltieri 4d304a2b9e tests: newlib/thread_safety: exclude acrn_ehl_crb
This seems to be failing fairly persistently in CI runs. Filed an issue
for having it checked, let's exclude it from the test run until it's
fixed.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-04 09:12:08 +00:00
Grzegorz Swiderski 6d2778e0c6 tests: lib: devicetree: api: Add test_ranges_empty
Verify some DT API on an empty-valued `ranges;` property.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-02 09:56:01 -07:00
Robert Lubos f602c72773 modules: uoscore-uedhoc: Update to the latest version
Update uoscore-uedhoc repository to the latest revision.
Align uoscore tests with the API changes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-08-02 10:38:11 +02:00
Robert Lubos 029e750738 tests: lib: uoscore: Add missing testcase.yaml
It was overlooked somehow, that usocore tests did not have testcase.yaml
file, and therefore were not executed by Twister. This commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-08-02 10:38:11 +02:00
Christopher Friedt b42212eeaa tests: thrift: re-order shared_ptr reset to prevent fd leak
This change fixes a file descriptor leak that snuck-in
undetected in the original `gsoc-2022-thrift` project.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-31 10:09:55 +02:00
Christopher Friedt 9dc531be48 tests: thrift: replace unused variable with NULL in pthread_join
There is no need to pass a second parameter to `pthread_join()`
if it is unused. Just use `NULL` instead.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-29 10:26:56 -04:00
Bartosz Bilas 9ce202e50c lib: json: add helper macro for named array of array
Variant of JSON_OBJ_DESCR_ARRAY_ARRAY that can be used when the
 structure and JSON field names differ.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-07-26 09:11:16 +02:00
Jordan Yates 60a082b8dd tests: lib: devicetree: api: test DT_DEP_ORD_STR_SORTABLE
Add basic testing of the new `DT_DEP_ORD_STR_SORTABLE` macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Carlo Caione 7483e43f0c devicetree: Add 'zephyr,memory-attr' and DT helpers
The 'zephyr,memory-region-mpu' property was addede gqas a
convenient way to create and configure MPU regions using information
coming from DT. It has been used a lot since it was introduced so I
guess we can consider it a Zephyr success story ™ .

Unfortunately it has been proved to be a bit limited and with some
important limitations:

1. It was introduced as a property of the compatible
   zephyr,memory-region that is used to create linker regions and
   sections from DT data. This means that we can actually create MPU
   regions only for DT-defined regions and sections.
2. The naming is unfortunate because it is implying that it is used only
   for MPU.
3. It is misplaced being in include/zephyr/linker/devicetree_regions.h
   and still it has nothing to do with the linker at all.
4. It is exporting a function called LINKER_DT_REGION_MPU that again has
   nothing to do with the linker.

Point (1) is also particularly limiting because it is preventing us to
characterize memory regions that are not generated using the
'zephyr,memory-region' compatible, like generic mmio-sram regions.

While we fix all the issues, we also want to extend a bit the range of
usefulness of this property. We are renaming it 'zephyr,memory-attr' and
it is now carrying information about the type of memory the property is
attached to (cacheable, non-cacheable, IO, eXecutable, etc...). The user
can use this property and the DT API coming with it to act on the memory
node it is accompanied by.

We are still providing the DT_MEMORY_ATTR_APPLY() macro that can be used
to create the MPU regions as before, but we are adding also a
DT_MEMORY_ATTR_FOREACH_NODE() macro that can be used to cycle through
the memory nodes and act on those.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-07-25 11:22:10 +02:00
Ryan McClelland f851d2a61b tests: lib: c_lib: fix test_sqrt double promotion warnings
Double promotion warnings are generated with the flag -Wdouble-promotion
Exponent was defined as a float, but was really be used a double here
Change the type of exponent in sqrt from float to double.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-07-21 06:30:32 -04:00
Francois Ramu 256b0c5bfb tests: lib: c_lib testcase running with 32KB min ram
Limit the testcase to targets with more than 32KB RAM
Because of the CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE 8192,
the RAM used by the testcase on a too small target might fail
at runtime. For example on a nucleo_l073rz target:
    RAM:       15292 B        20 KB     74.67%

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-20 04:40:57 -04:00
Bartosz Bilas e11cc216b1 tests: lib: json: add extra nested array 2dim tests
Add tests with extra JSON fields with 2dim array.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-07-18 11:06:39 +00:00
Markus Fuchs 84df635384 tests: lib: json: Add tests for parsing inputs with extra fields
Add tests for both extra objects and extra arrays nested in JSON objects.
Fields in extra nested objects should be ignored and also not manipulate
subsequent fields with the same name.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-07-18 11:03:21 +00:00
Lawrence King 7dae27a90d libc: minimal: math sqrt: sqrtf: fix numeric accuracy of sqrt and sqrtf.
Changed initial guess from a simple x/3 to dividing the exponent by 2.
This makes large or small numbers like 10e10 and 01e-10 converge in a few
loops.

Added a loop counter to ensure that the algorithm breaks out of the loop in
the case that the algorithm doesn't converge (toggling between two
numbers).

Added test cases for sqrt and sqrtf in libc. Tested with a range of numbers
between 10e10 and 10e-10. Verify good accuracy in test case.

Closes: #55962

Signed-off-by: Lawrence King <lawrencek52@gmail.com>
2023-07-14 12:42:41 -04:00
Keith Packard f5e462137f tests/c_lib: Run basic libc tests using newlib and newlib-nano
Validate some basic Zephyr requirements from the newlib C library.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-07-11 09:42:55 +02:00
Fabian Blatz ec46da444e tests: lib: gui: lvgl: Reorder screen load and delete
Load the default screen before the deleting the newly created one.
This used to work in LVGL 8.2.0 but was not intended according to the
discussion in https://github.com/zephyrproject-rtos/zephyr/pull/53974.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-07-10 15:14:49 +02:00
Carlo Caione 935268ee64 devicetree.h: DT_FOREACH_NODE_VARGS, DT_FOREACH_STATUS_OKAY_NODE_VARGS
Add the _VARGS variant of DT_FOREACH_NODE and
DT_FOREACH_STATUS_OKAY_NODE for when we want to do some kind of
operation on all the nodes in the tree.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-07-07 11:41:19 +02:00
Markus Fuchs b311c533bf tests: lib: json: Add test for array of objects
Add tests for encoding and decoding nested arrays of objects located
inside a parent object at a non-zero offset.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-06-29 21:03:48 +02:00
Markus Fuchs 7a7a78bd92 tests: lib: json: Add tests for handling two-dimensional arrays
Add tests for encoding and decoding two-dimensional arrays as described by
the JSON_OBJ_DESCR_ARRAY_ARRAY() macro.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-06-29 21:03:48 +02:00
Markus Fuchs 56234aee5d tests: lib: json: Fix and enhance test for array of arrays
Fix encoded JSON string in test_json_decoding_array_array() test so it
matches the described array object and add a test case for encoding
arrays of arrays.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-06-29 21:03:48 +02:00
Markus Fuchs 2304331807 tests: lib: json: Switch non-ascii text to octal escape sequences
Switch the non-ascii text in the tests to use octal escape sequences
to avoid potential compiler issues on platforms not defaulting to
utf-8 text encodings.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-06-29 21:03:48 +02:00
Alberto Escolar Piedras ee67bdfc56 tests libC: Filter based on type of target not whole arch
The POSIX arch now also supports embedded libCs for some
targets. Narrow the test filter accordingly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-26 16:16:46 +02:00
Gerard Marull-Paretas a44f61c5f5 tests: lib: devicetree: api: test the 'reserved' status
The `reserved` status, even though supported, was not tested. Add
coverage for it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-26 03:10:30 -04:00
Alexander Razinkov b158c52e24 devicetree: support of 64-bit addresses from devicetree
Usage of 64-bit address constants from devicetree without a
UINT64_C wrapping macro results in the following warning and the
cut-off of the address value:

"warning: integer constant is so large that it is unsigned"

This change extends devicetree API adding few wrappers over the
address constant getters which add ULL size suffix to an
address integer literal when the appearance of 64-bit address
values is possible

Signed-off-by: Alexander Razinkov <alexander.razinkov@syntacore.com>
2023-06-25 03:29:54 -04: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
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 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
Keith Packard 091948a5a9 tests: Increase a couple of test stack sizes
mem_protect and sprintf stacks both need to be slightly larger than
currently defined in order to avoid stack overflow when using picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-06-01 13:43:25 -04:00
Lukasz Mrugala 072ca4bfeb tests: lib: devicetree: Docstring typo fix
Word 'platform' misspelled as 'plaform'.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-05-29 14:34:33 -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
Anas Nashif 04827ba71f tests/samples: use integration_platforms more where it makes sense
Use integration platforms to limit churn and build time in PR CI .

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-26 17:52:02 -04:00
Keith Packard 51abcc3642 tests/sprintf: Test picolibc inexact floating point printf
Picolibc has two floating point output modules, the default, "exact",
module which meets the ISO/IEC 9899:2011 specification and a smaller
"inexact" version which does not meet those specifications. Add a test for
this latter version to make sure it meets some modest Zephyr requirements.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-26 09:55:52 -04:00
Keith Packard a2d55f7b16 tests/sprintf: Enable picolibc floating point printf for new test
Make sure we test floating point output too.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-26 09:55:52 -04:00
Keith Packard bd2ad04f38 tests/sprintf: Increase test stack size for picolibc
Picolibc needs more than 1024 bytes of stack when printing floating point
values exactly. Increase the stack to 2048 bytes.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-26 09:55:52 -04:00
Keith Packard 33dedfbd7d tests/sprintf: Test floating printf on soft-fp targets too
There's no reason to limit testing floating point printf to platforms with
an FPU; neither the minimal C library nor picolibc even use floating point
instructions for printf. And even if they did, the toolchain should have
soft float support.

However, we do need to restrict picolibc testing to configurations with
floating point printf enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-26 09:55:52 -04:00
Anas Nashif 8be608d349 tests: sprintf: 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
Anas Nashif d120ae1013 tests: newlib: 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
Anas Nashif 3349cb9a75 tests: smf: 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
Miika Karanki d8166e813b json: add json_calc_encoded_arr_len
Analog to json_obj_encode vs. json_calc_encoded_len which
calculates the object len using json_obj_encode, introduce
json_calc_encoded_arr_len which calculates the length using
json_arr_encode. That is needed when the object to be encoded
is array on the root level.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2023-05-19 19:52:04 +00:00
Martí Bolívar 4e9fad3778 devicetree: tests: better DT_FOREACH_PROP_ELEM coverage
Verify expected results for every permissible argument type, including
with a phandle and a string in an inferred binding from /zephyr,user.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-05-16 18:14:26 +02:00
Martí Bolívar 8aa83f6ae8 devicetree: support DT_PROP_LEN() on phandle and string
It will be convenient to treat these respectively as degenerate cases
of 'phandles' and 'string-array'. Add support for this and regression
tests. (There's nothing to do in the case of 'phandle' beyond
documenting the guarantee.)

For the record, the other DT_PROP_LEN() tests for each type are in:

  type            test case              property
  ------------    --------------------   ------------
  array           test_arrays            a
  string-array    test_path_props        compatible
  uint8-array     test_arrays            b
  phandles        test_phandles          phs
  phandle-array   test_phandles          pha-gpios
  phandle         test_phandles          ph

Update docstrings and fix some issues in them.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-05-16 18:14:26 +02:00
Jordan Yates 6280c9132d tests: lib: devicetree: test DT_ENUM_HAS_VALUE
Add tests for the new devicetree macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-05-15 09:03:37 -07:00
Keith Packard 5e0a25f54d tests/mem_alloc: Check for common malloc instead of minimal libc
Instead of detecting that the minimal C library is in use before running
the malloc failure tests, check for the common malloc being in use as that
will also allow this test to run with picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-11 01:25:01 +09: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
Gerard Marull-Paretas 6d56988e43 tests: lib: mpsc_pbuf: remove duplicate timeout key
Test had 2 timeout entries (90, 120). Left 120 to be safe, as it's the
larger value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Kumar Gala f66b149742 tests: c_lib: test exit not _exit
Tweak test to test exit and not _exit, as _exit is not a standard
libc function.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-05-09 11:53:41 -07: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
Keith Packard bfa6a44746 tests,samples: Fix picolibc malloc arena settings
With picolibc moving to using the common malloc implementation, samples and
tests with picolibc-specific settings need to switch to using the common
malloc settings instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-09 01:29:16 +09:00
Alberto Escolar Piedras d22a343887 tests: Use posix arch exclude where appropriate
Some tests were filtering by explicitly listing
all posix arch boards.
Filter by the arch instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-04 16:48:01 -04:00
Marc Desvaux 4b68ec2d39 test: lib: newlib:- heap_listener: boards : add nucleo_c031c6.conf
add boards/nucleo_c031c6.conf with
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=4096
to avoid twister issue due to a too low heap size on the co31c6

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-04-28 20:37:24 +02:00
Marc Desvaux 9710b265fc test: lib: cbprintf_fp: boards : add nucleo_c031c6.conf
add boards/nucleo_c031c6.conf with
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=4096
to avoid twister issue due to a too low heap size on the co31c6

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-04-28 20:37:24 +02: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
Ryan McClelland 19a4602312 tests: lib: hash_function: fix double-promotion warnings
Fix double promotion warnings with -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-04-26 15:11:36 -07:00
Stephanos Ioannidis 82101f45e4 tests: cpp: libcxx: Add host standard C++ library testcase
This commit adds a new libcxx testcase that tests the host standard
C++ library.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-04-25 23:37:06 -04:00
Keith Packard 1a830e2af6 tests/sprintf: Remove tests with NULL FILE pointer
The C language says that use of a NULL FILE pointer with stdio functions is
undefined behavior. Let's just remove them instead of expecting the minimal
C library to exhibit a specific behavior in this case.

This also avoids problems when not using -ffreestanding as in that case,
the C compiler may generate warnings, or even cause undefined behavior on
its own.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-25 06:18:26 -04:00
Gerard Marull-Paretas 8605a8700c tests: lib: devicetree: test DT_ANY_INST_HAS_PROP_STATUS_OKAY
Add test coverage for the recently introduced
DT_ANY_INST_HAS_PROP_STATUS_OKAY.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 09:21:36 -05:00