Commit graph

979 commits

Author SHA1 Message Date
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