Commit Graph

311 Commits

Author SHA1 Message Date
Carlo Caione f4db14f349 dts: Introduce DT_STRING_TOKEN and DT_STRING_UPPER_TOKEN
To be able to get a tokenize DT string without the quotes. Deprecate
also DT_ENUM_TOKEN and DT_ENUM_UPPER_TOKEN.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-15 18:12:51 -05:00
Krzysztof Chruscinski 60210a6191 tests: lib: mpsc_pbuf: Add test case for max packet allocation
Add test for validating max packet allocation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-14 19:58:39 -04:00
Arvin Farahmand d0b9c03154 devicetree: Add _VARGS variants to _FOREACH_ marcos
`_FOREACH_` macros do not allow the caller to pass additional arguments
to the `fn`. A series of `_VARGS` variants have been added that allow
the caller to pass arbitrary number of arguments to the `fn`:

```
DT_FOREACH_CHILD_VARGS
DT_FOREACH_CHILD_STATUS_OKAY_VARGS
DT_FOREACH_PROP_ELEM_VARGS
DT_INST_FOREACH_CHILD_VARGS
DT_INST_FOREACH_STATUS_OKAY_VARGS
DT_INST_FOREACH_PROP_ELEM_VARGS
```

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-14 19:50:39 -04:00
Kumar Gala 37f3336121 tests: cleanup cbprintf tag usage
Add cbprintf tag were missing and change prf to cbprintf to be
consistent.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-24 12:38:57 -05:00
Yasushi SHOJI c48ca2ad9f tests: lib: heap: Test solo free header
Add a test to check `sys_heap_validate()` works on a heap with solo
free header.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-06-23 06:18:44 -04:00
Ioannis Glaropoulos af75907152 boards: mps2_an521: separate board Kconfig options for the various targets
Introduce separate Kconfig options for the different
MPS2 AN521 targets.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-06-22 08:45:41 -04:00
Martí Bolívar bb718ebe68 tests: devicetree: remove useless assert
There's no reason for this assert to be here; it should be removed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-06-09 19:02:04 -05:00
Stephanos Ioannidis c1849d10c3 tests: mem_alloc: Increase heap size for newlib nano test
This commit increases the heap size for the newlib nano test to 2048,
which is the recommended minimum required to ensure proper operation
(see #35799).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-06-02 08:50:45 -05:00
Watson Zeng fa41ec052d tests: mem_alloc: workaround aggressive optimization
As we don't use memory allocated in test_calloc, test_no_mem_malloc,
and test_no_mem_realloc. malloc call can be optimized away (that really
happens with ARC MWDT toolchain). That breaks the test. So disable
optimization for these functions.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-05-24 23:31:10 -04:00
Ying ming 4f8318f104 tests: libc: Update libc testcases to solve coverity issues
The coverity report "Out-of-bounds access". The reason is
The room of src and dest buffer is less than the count wanted
to be copyied. So enlarged the src and dest buffer to solve this
issue.

Fixes:#35345
Fixes:#35346

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-05-19 07:46:38 -05:00
Ying ming 8f823a07d3 tests: libc: Update character output testcases to solve coverity issues
1. Refine some testcases for testing some character output function.
2. Delete some negative testcases which will not invoke fatal error.

Fixes #33822
Fixes #33803
Fixes #33801
Fixes #33800
Fixes #33790

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-05-13 11:15:39 -04:00
Stephanos Ioannidis 6bc42ae309 tests: lib: Add newlib thread safety test
This commit adds a new test to verify the thread safety of the C
standard functions provided by newlib.

Only the memory management functions (malloc and free) are tested at
this time; this test will be further extended in the future, to verify
the thread safety and re-entrancy of all supported newlib functions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-05-13 07:30:43 -05:00
Stephanos Ioannidis 09a85ff84b tests: lib: mem_alloc: Fix test names
This commit fixes the ambiguous test names used by the `mem_alloc`
test.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-05-12 23:33:21 -05:00
Ying ming 8e69dafccf tests: libc: Update libc testcases to solve coverity issues
1. Refine some testcases for testing some libc functions, include
strlen(),strcmp(),strncmp(),memcmp(),memstr(),memcpy(),memmove()
strtol(),strtoul().
2. Change some code to make the code style consistent.

Fixes #33794
Fixes #33810
Fixes #33806

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-05-11 20:33:43 -04:00
Anas Nashif 5343aed002 tests: fix testcase.yaml files
Puts all filter in common section and fix filters. Platforms in
integration_platforms must also be allowed first, otherwise the tests
will never run.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 41c8823250 tests: lib: cbprintf_package: Enable CONFIG_CBPRINTF_LIBC_SUBSTS
Enable option to use snprintfcb in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 0bc3bee738 tests: lib: cbprintf_package: Add CBPRINTF_MUST_RUNTIME_PACKAGE test
Extended test to cover CBPRINTF_MUST_RUNTIME_PACKAGE macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 604c9ac231 tests: lib: cbprintf_package: Minor cleanup
Adding static to local functions. Using void * for %p argument
which often triggered compilation warning.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Kumar Gala b579c12714 tests: devicetree: exclude hsdk platforms
The devicetree test will not link the hsdk platforms as
when CONFIG_GPIO=y this enable CONFIG_I2C as the board utilizes
a GPIO expander over I2C.  So we exclude building this test on
the hsdk platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-06 17:33:58 -04:00
Paul Sokolovsky 39b0423e7a tests: lib: mem_alloc: Fix up conditions for "no_mem" testcases
These should run for minlibc configured with
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=0. In all other cases normal
testsuite should run.

How preprocessor #if's were put previously, some configurations,
e.g. prj_newlib.conf, had the testsuite completely skipped.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2021-05-06 18:19:38 +02:00
Krzysztof Chruscinski 61a2e8cee3 tests: lib: cbprintf: Extended to test C++
Extended test suite to be run for C++

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-05 08:45:43 -04:00
Gerard Marull-Paretas 6aee84e747 tests: lib: devicetree: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:53:09 -04:00
Hou Zhiqiang 0700a24276 devicetree: Add DT_FOREACH_CHILD_STATUS_OKAY macro
The macro only iterates the enabled child nodes and invokes
provided macro for each node.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2021-04-27 13:32:55 -04:00
Martí Bolívar 9c229a417c devicetree: add DT_FOREACH_PROP_ELEM(node_id, prop, fn)
It can be convenient to "iterate" over the elements of a property, in
the same way it is convenient to "iterate" over enabled instances.

Add a new macro for doing this, along with a DT_INST_FOREACH_PROP_ELEM
variant.

This is likely to be more convenient than UTIL_LISTIFY or FOR_EACH in
some situations because:

- it handles inputs of any length
- compiler error messages will be shorter and more self-contained
- it is easier to use with phandle-array type properties, which
  require more complicated macro boilerplate when used with
  util_macro.h APIs

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-04-22 15:32:10 +02:00
Anas Nashif 9614581ebe tests: dsp: filtering: exclude on llvm
optimize attribute is not supported by LLVM.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-22 07:42:58 -04:00
Krzysztof Chruscinski 345d12e8e0 tests: lib: Add test for mpsc_pbuf
Added suite for multiple producer, single consumer packet buffer.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Jukka Rissanen 283861cbfd tests: lib: fdtable: Fix invalid memory access
The vtable cannot point to address 1 as that is clearly not a
valid address and will fail when the code tries to access it
in various fdtable.c functions. Point the vtable in tests either
to NULL or to a valid vtable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-15 07:16:51 -05:00
Jukka Rissanen ef074d9786 tests: fdtable: Fix compilation as z_get_fd_obj_and_vtable() changed
3rd parameter (struct k_mutex *) was added to
z_get_fd_obj_and_vtable() so add it to calls in the tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-15 07:16:51 -05:00
Jordan Yates 491fe2a64d tests: lib: ringbuffer: test discard functionality
Add tests that validate the behaviour of providing NULL as a data
pointer to discard whatever data is in the ring buffer.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-09 13:19:30 +02:00
Ningx Zhao f1e770d1db tests: ringbuffer: test concurrent operation
Add a testcase to test that read and write the
same buffer at the same time to check the
integrity of data reading and writing.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2021-04-06 10:16:48 -04:00
Hake Huang 6d397801e7 tests: disable long time case from NXP FRDM_KW41Z
CMSIS_DSP and net_socket tests are either too
slow or too large for this platform, also drop
bluetooth for test

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-04-01 10:57:19 -05:00
Enjia Mai d11163741f tests: lib: fix coverity issues of resource leaks for mem_alloc testcase
Fix 2 resource leaks issues of coverity scan, actually the return of
NULL pointer is expected, but there is no harm done to free a NULL
pointer in our design, so adding them to pass the scan.

Fixes #33802	CID: 220434
Fixes #33785	CID: 220451

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-03-31 08:04:08 -04:00
Martí Bolívar 12eece0b22 devicetree: add DT_COMPAT_GET_ANY_STATUS_OKAY()
This is a helper which allows you to skip the intricacies of instance
numbers to express the intent of "give me a random enabled node with
this compatible; I don't care which one".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Krzysztof Chruscinski 0e39b7d707 tests: lib: cbprintf: Update test after adding alignment parameter
Add validation of the case when package buffer is not aligned to
CBPRINTF_PACKAGE_ALIGNMENT.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski 85187437cc tests: lib: cbprintf_package: Fix issue reported by coverity
Fixing issue 219727. Potentially negative return value was passed
to a function that was expecting positive value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-27 11:26:55 +01:00
Martí Bolívar b2cc526061 tests: dts: test child bindings with compatibles
Make sure that child bindings with their own compatibles are treated
as first-class bindings. Do this by making sure that nodes whose
bindings are defined via 'child-binding:' are picked up as bus nodes,
instead of a parent bus node of the same type.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-25 09:37:42 -05:00
shixiongx zhang 84d23fd82f Tests: libc: Improve code coverage
Add test cases for libc module  APIs.

Signed-off-by: shixiongx zhang <shixiongx.zhang@intel.com>
2021-03-25 14:06:36 +01:00
Marcin Niestroj 4682cf12bb tests: lib: time: add test for time() function
Add test cases for time() function.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-03-19 09:56:53 -04:00
Kumar Gala b81361609a devicetree: deprecate DT_DMAS_LABEL APIs
Mark all variants of the DT_DMAS_LABEL APIs:
* DT_DMAS_LABEL_BY_IDX
* DT_DMAS_LABEL_BY_NAME
* DT_INST_DMAS_LABEL_BY_IDX
* DT_INST_DMAS_LABEL_BY_NAME

As deprecated in favor of utilizing:

* DT_DMAS_CTLR_BY_IDX
* DT_DMAS_CTLR_BY_NAME
* DT_DMAS_CTLR
* DT_INST_DMAS_CTLR_BY_IDX
* DT_INST_DMAS_CTLR_BY_NAME
* DT_INST_DMAS_CTLR

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-18 06:20:27 -05:00
Krzysztof Chruscinski 844800365a tests: lib: cbprintf: Added configuration without _Generic
Extended test to validate case when _Generic keyword is not used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-12 09:25:15 -05:00
Peter Bigot b29abe3710 device: add API to visit required devices
The static device dependencies from devicetree are not the only ones
that might be present at runtime.  Add API that allows visiting
required devices without assuming that handles for or pointers to them
can be accessed as a static contiguous sequence.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-11 08:53:18 -05:00
Krzysztof Chruscinski a92214b8f4 tests: lib: cbprintf_package: Extend to test static packaging
Extend test to validate cbprintf static packaging on various
platforms.

Added more test configurations: complete, nano, long double.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-11 09:54:39 +01:00
Andy Ross 589c781506 tests: No thread-shared/synchronized data on stack (coherence)
CONFIG_KERNEL_COHERENCE forbids synchronized data on the stack: no
spinlocks, IPC primitives, or things that contain them.  Application
code obviously doesn't have to follow these inconvenient rules, but
our test code needs to run on platforms with incoherent stack memory.

Make these things static.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-03-08 19:25:25 -05:00
Andy Ross 6fe9e408ab tests/cbprintf_fp: Filter on CONSOLE_HAS_DRIVER
Many platforms don't have a console backend, and this fails with a
kconfig warning if you try to build on them.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-03-08 19:25:25 -05:00
Andy Ross 29b83584b0 tests/p4wq: Fix impossible sleep interval
The code here was written to "get out of the way just long enough for
the trivial context switch and callback to execute".  But on a machine
with 50 kHz ticks, that's not reliably enough time and this was
failing spuriously.  Which would have been a reasonably forgivable
mistake to make had I not written this code with this very machine in
mind...

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-03-08 11:14:27 -05:00
Krzysztof Chruscinski dccfe76663 tests: lib: Add test for cbprintf_package
Add test to validate cbprintf packaging on various platforms

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-05 09:29:35 +01:00
Ioannis Glaropoulos 30a1a4bb44 tests: lib: cbprintf_fp: enable CONFIG_TEST in the test suite
Enable the CONFIG_TEST switch in the test suite.
This allows certain required Kconfig settings for
ARM Cortex-M (which depend on TEST) to be enabled
when executing the test suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-03-04 14:53:27 -05:00
Kumar Gala 72ffe59ef9 devicetree: deprecate DT_IO_CHANNELS_LABEL APIs
Mark all variants of the DT_IO_CHANNELS_LABEL APIs:
* DT_IO_CHANNELS_LABEL_BY_IDX
* DT_IO_CHANNELS_LABEL_BY_NAME
* DT_IO_CHANNELS_LABEL
* DT_INST_IO_CHANNELS_LABEL_BY_IDX
* DT_INST_IO_CHANNELS_LABEL_BY_NAME
* DT_INST_IO_CHANNELS_LABEL

As deprecated in favor of utilizing:

* DT_IO_CHANNELS_CTLR_BY_IDX
* DT_IO_CHANNELS_CTLR_BY_NAME
* DT_IO_CHANNELS_CTLR
* DT_INST_IO_CHANNELS_CTLR_BY_IDX
* DT_INST_IO_CHANNELS_CTLR_BY_NAME
* DT_INST_IO_CHANNELS_CTLR

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 11:28:30 -06:00
Kumar Gala 707f0391cb devicetree: io-channels: add marcos to obtain the node identifier
Added helper macros to obtain the node identifier from an
io-channels phandle.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 11:28:30 -06:00
Kumar Gala 4aac908973 devicetree: add DT_NODE_FULL_NAME()
This macro returns a node's name with unit-adddress, given its node
identifier.

The node name is useful information for the user to utilize for debug
information, similar to DT_NODE_PATH, or DT_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-25 19:24:08 -06:00