Commit graph

894 commits

Author SHA1 Message Date
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
Patryk Kuniecki 3707014f20 tests: lib: cmis_dsp matrix_unary_f64 requires more than 64KB of RAM
Increase the min ram configuration when running
libraries.cmsis_dsp.matrix.unary_f64 testcase
This should have been included in #51883 but was skipped for some reason.

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2023-04-21 09:09:54 -05: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 546ea7f977 tests/sprintf: Skip UB-dependent tests on armclang
There are several tests with undefined behavior ("UB") this causes
compile warnings with armclang.  Skip these tests in this case.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-14 10:31:47 -04: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
Yuval Peress 18eed82273 cpp: Add rtio headers to cxx test
Include all the rtio headers with all the configs enabled into the
cxx test.

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-13 09:59:31 +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
Keith Packard b272f468d3 tests/lib/mpsc_pbuf: Increase timeout on concurrent test to 120 seconds
There are long delays in this test which make it always take more than 60
seconds to complete.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-10 22:02:46 +09:00
Kumar Gala 0e43b8861b libc: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-04 13:47:34 +02:00
Dmitrii Golovanov 1875cc9204 tests: lib: mpsc_pbuf: Increase test timeout on mpsc_pbuf_concurrent
Increase timeout for tests/lib/mpsc_pbuf/libraries.mpsc_pbuf_concurrent
as it fails sometimes on the 60 sec. default timeout.

Fixes #56349

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-04-04 13:34:37 +02:00
Pieter De Gendt 85d8f8e0db tests: devicetree: add tests for DT_INST_PROP_LEN_OR
Add test coverage for the DT_INST_PROP_LEN_OR macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-03-23 10:30:50 +01:00
Kumar Gala d4ed0d7a2d tests: lib: mem_alloc: skip reallocarray test on arm clang
The arm clang toolchain provides its own libc and that libc doesn't
implement reallocarray, so skip the test like we do on newlib.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-20 12:23:45 -04:00
Kumar Gala 831bd2f841 armclang: fix compiler warnings with isprint()
We get compile warnings of the form:

drivers/console/uart_console.c:508:8: error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint returns an int, change check to an explicit test against
the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-17 09:30:01 +01:00
Alberto Escolar Piedras e26bf578c6 tests/lib/cpp/cxx: Fix for all POSIX arch platforms
We need to exclude all POSIX arch boards, not just
native_posix* as all use the host compiler toolchain.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-07 20:56:17 -06:00
Andrei Emeltchenko 97914a402d tests: hash_map: Remove check that usigned >= 0
Remove unneeded check that unsigned >= 0.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-07 08:34:50 +01:00
Alberto Escolar Piedras 88d4ae7cb9 include/sys/util: Fix WAIT_FOR for POSIX_ARCH
WAIT_FOR is a busy wait loop, which in the POSIX ARCH
should include a very minor delay in each iteration.

After this fix, tests/lib/sys_util does not need to
exclude native_posix anymore.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-03 17:12:30 +01:00
Andy Ross 3d9c428d57 tests/lib/cpp/cxx: Add compatibility cases for C++ standards
Add some cases to enumerate all the C++ standard variants that the SDK
gcc supports (there are MANY) to prevent compatibility regressions in
the OS headers.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-01 19:42:32 -05: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
Sylvio Alves bc9b59a19c boards: esp32s3_devkitm: initial soc board support
Adds support to ESP32-S3 devkitm as initial SoC board.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Anas Nashif 8400ba6b94 tests: mem_alloc: remove fixed testcase names from yaml
We now use new ztest API, so we can get those from the symbols file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-24 09:16:42 +01:00
Anas Nashif 3e4c5471b4 tests: mem_alloc: move to new ztest API
Move to new ztest API.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-24 09:16:42 +01:00
Anas Nashif 9e101eec69 tests: mem_alloc: put arch_exclude in common section
Put the exclude in common section instead of repeating it for each test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-24 09:16:42 +01:00
Chris Friedt e607684cb0 tests: lib: hashmap: tests for hashmap library
Add tests for public API of `<zephyr/sys/hash_map.h>`

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-22 19:14:05 +01:00
Chris Friedt 2d4619b13c tests: lib: hash_function: tests for sys_hash32
Add a test for `sys_hash32()`. The expectation is that hash
functions should be approximately uniform over a given field.

We can use the Kolmogorov Smirnov test to verify that our
hash function is approximately uniform over a given field.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-22 19:14:05 +01:00
Andy Sinclair 5f63fff9c2 sys: linear_range: fix return value when window is outside range
linear_range_get_win_index does not behave correctly when the
window of values is above the linear range.  It reports
-ERANGE (partial intersection) instead of -EINVAL.

Extra conditions added for edge cases and tests cases updated.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-02-20 10:43:26 +01:00
Radosław Koppel 14a1b2ffec dts: Add _STRING_UNQUOTED string and string-array
This commit adds access to the string values without a quotes.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-02-20 09:49:00 +01:00
Chris Friedt 2b8ea7d700 tests: lib: thrift: add tests for the thrift module
These tests include:
* ThriftTest - an upstream exercies for all Thrift facilities

This code was merged from the following repository
at the commit specified below, with minor formatting
and coding-style modifications.

https://github.com/zephyrproject-rtos/gsoc-2022-thrift
e12e014d295918cc5ba0b4c507d1bf595a2f539a

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-09 20:30:21 +09: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
Henrik Brix Andersen 0174e0b6c1 tests: lib: devicetree: api: add tests for DT_GPIO_HOG_* macros
Add tests for the DT_GPIO_HOG_* macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Andrei Emeltchenko dcea17068d tests: mem_blocks: Remove suspicious break statement
Fixes dead code warnings form static tools.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-27 18:10:52 +09:00
Björn Stenberg 0321ac8dbf json: Increase max number of descriptor elements from 30 to 62
The limiting factor is the output bitmask that says which elements have
been filled in by the parser. This patch changes the bitmask type from int
to int64_t.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2023-01-26 09:51:54 +00:00
Keith Packard 35e017a9ee subsys/cpp: Also run C++ tests with picolibc when possible
When the toolchain has picolibc support, run
samples/subsys/cpp/cpp_synchronization and tests/subsys/cpp/libcxx tests
using it.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-20 09:03:25 +01:00
Andrei Emeltchenko 8f4d8c5cce tests: spsc_pbuf: Check return code
Make check_buffer() call useful.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-17 21:50:16 +00:00
Gerard Marull-Paretas e086738b88 sys: linear_range: allow out-of-range values/windows
The existing linear_range API did not allow values or windows outside of
the linear range (returned -EINVAL). With this change values are allowed
outside of the range, being adjusted to the edge values (min/max)
instead. In the case of windows, it is allowed to have partial
intersection. In both cases, the API assigns a valid index (nearest) and
returns -ERANGE. This change is useful because the main client of the
linear range API, regulators, needs such behavior. For example, If an
application specifies a voltage range from 1.0V to 1.5V and the
regulator supports from 1.2V to 2.7V, the regulator can configure a
voltage that satisfies the condition: 1.2V.  With the current API, the
input would be refused because 1.0V lies outside of the 1.2V-2.7V range.

Also, for constant ranges, the minimum index is returned.

Tests have been updated/extended accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Stephanos Ioannidis cf211aa7af treewide: Update deprecated CONFIG_LIB_CPLUSPLUS usages
This commit updates all deprecated `CONFIG_LIB_CPLUSPLUS` usages to:

* check if the Zephyr minimal C++ library is enabled using
  `CONFIG_MINIMAL_LIBCPP` instead of relying on the
  `CONFIG_LIB_CPLUSPLUS`-based inference.

* select `CONFIG_REQUIRES_FULL_LIBCPP` when there exists a component-
  level C++ standard library dependency. This allows a component to
  declare C++ standard library dependency without designating a
  specific libray implementation.

* select the correct type of C++ standard library implementation to use
  through one of the `CONFIG_LIBCPP_IMPLEMENTATION` choices.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis 404e7a9bf7 treewide: Use CONFIG_CPP_EXCEPTIONS instead of CONFIG_EXCEPTIONS
This commit updates all in-tree code to use `CONFIG_CPP_EXCEPTIONS`
instead of `CONFIG_EXCEPTIONS`, which is now deprecated.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-01-13 17:42:55 -05: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
Andrei Emeltchenko e8f0e66bc4 tests: libc: Fix "unused" type of warnings
Follow example several lines below and fix warnings from static tools.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-05 08:00:09 -05: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 620bd5d817 samples, tests: fix key-duplicates in sample.yaml files
Fix few duplicate keys warnings in sample.yaml and testcase.yaml files,
this is going to enable some tests that were otherwise being
unintentionally ignored.

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

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

Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Krzysztof Chruscinski 537062b110 tests: lib: mpsc_pbuf: Add qemu_x86_64
Add target which supports SMP.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski f0485c7053 tests: lib: mpsc_pbuf: Add stress test
Added stress test which validates proper behavior of mpsc_pbuf
when there are 2 producing contexts and dedicated consumer
context. Various configuration are tested with consumer having
the lowest, medium and the higher priority.

Test produces random size packets at random intervals. It validates
that each produced packet is consumed or dropped.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski 300f9b95e5 tests: lib: mpsc_pbuf: Add new test case
Added test case for putting words when packet is claimed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski d6442ac9e1 tests: lib: mpsc_pbuf: Adapt test after changes in the module
Adapt test to the new method of buffer full detection. New
method increased buffer capacity.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski b80becbb4d tests: lib: mpsc_pbuf: Add native_posix to allowed list
Add plaftorm used for integration to platform_allowed list.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Gerard Marull-Paretas adbd0603b6 lib: linear_range: fix count for ranges with step 0
Ranges with step 0, that is, multiple indices representing the same
value, need to report the count exclusively based on indices. This makes
it possible to later retrieve all values, e.g. in a group.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Mahesh Mahadevan 41dda6938e tests: devicetree: device: Add mimxrt595_evk_cm33 exclusion
Adds mimxrt595_evk_cm33 target to the exclusion list for tests
as this board enabled i2c by default for regulator usage which
conflicts with the test.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-12-05 11:03:14 +01:00
Yuval Peress 0433965982 dsp: move cmsis_dsp basicmath tests
Move the tests to tests/subsys/dsp/ as they'll be a part of the Zephyr
dsp subsystem.

Signed-off-by: Yuval Peress <peress@google.com>
2022-12-02 20:15:55 +01:00
Gerard Marull-Paretas 55da0217da sys: linear_range: fix index calculation when spanning across groups
When dealing with groups, the specified window in
linear_range_group_get_win_index can span across multiple groups. In the
current implementation, if maximum value was not in the same sub-window
as the minimum value the function would return -EINVAL. This patch fixes
the problem and updates test cases to cover such scenario.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-02 11:29:35 +01:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Anas Nashif 808266a493 tests: use ignore_fault field instead of tags
Use dedicated field in the yaml file instead of mixing this testing
feature with tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:38:05 -05:00
Gerard Marull-Paretas 9f509f5b11 tests: lib: linear_range: add coverage
Add coverage for the linear_range API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-24 10:16:03 +01:00
Pieter De Gendt 5710f609c9 tests: devicetree: add tests for DT_GPARENT/DT_INST_GPARENT
Add some coverage for the DT_GPARENT/DT_INST_GPARENT macros.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-11-17 10:18:11 -06:00
Francois Ramu e7a071f43c tests: lib: cmis_dsp transform requires more than 128KB of RAM
Increase the min ram configuration when running the
libraries.cmsis_dsp.transform.cf64 testcase of the
tests/lib/cmsis_dsp/transform/
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/52284

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-17 11:17:53 +01:00
Stephanos Ioannidis 3bdbc3f8a4 tests: cmsis_dsp: transform: Remove MPS2 AN521 from intg. platforms
This commit removes the `mps2_an521_remote` board from the integration
platform list of the CMSIS-DSP transform tests because this board no
longer has a sufficient code memory (FLASH) to fit these tests after
the resizing done in the PR #52052 for TF-M compatibility.

Consider adding `mps2_an386` as an integration platform for these tests
once the support for it is added to Zephyr (refer to the issue #45319).

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-11-09 23:20:06 +09:00
Keith Packard f35f44147f tests/sprintf: Enable picolibc float I/O
When built with picolibc, this test requires float I/O support

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-08 10:44:36 +01:00
Keith Packard e7ec39434b tests/cbprintf_package: Use minimal libc for long double tests
These tests fail because picolibc and cbprintf_package generate slightly
different results.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-08 10:44:36 +01:00
Francois Ramu b5d235022a tests: lib: cmsis_dsp testcases with min ram for execution
Since the new  CONFIG_ZTEST_NEW_API the ram fr execution
must be adjusted (higher)
to avoid buffer allocation failure s with some target board.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-03 09:07:20 +00:00
Kumar Gala ab02bbc965 tests: lib: p4workq: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-31 17:08:34 +01:00
Evgeniy Paltsev ac76c27af8 tests: arc: enable previously disabled tests on ARCv3 64bit platforms
Enable all cbprintf / logging related tests which were previously
disabled for qemu_arc_hs6x.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-10-31 11:22:12 +01:00
Kumar Gala a1195ae39b smp: Move for loops to use arch_num_cpus instead of CONFIG_MP_NUM_CPUS
Change for loops of the form:

for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
   ...

to

unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
   ...

We do the call outside of the for loop so that it only happens once,
rather than on every iteration.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-21 13:14:58 +02:00
Stephanos Ioannidis 30c5e0222b tests: cmsis_dsp: MVE correlate out-of-bounds access workaround
The MVE `arm_correlate_f32` and `arm_correlate_q31` implementations may
write to negative indices of the output buffer (refer to the upstream
CMSIS-DSP bug ARM-software/CMSIS-DSP#59).

This commit adds a workaround for the above bug by overallocating the
output buffer memory and offsetting the output buffer supplied to the
function.

Revert this commit when this bug is fixed.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-10-20 22:12:42 +09:00
Kumar Gala 4f0166088c tests: move to using CONFIG_MP_MAX_NUM_CPUS
For tests that set CONFIG_MP_NUM_CPUS, switch to using
CONFIG_MP_MAX_NUM_CPUS instead as we work to phase out
CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-20 22:04:10 +09:00
Stephanos Ioannidis 9dd570f8a2 tests: Remove explicit newlib nano override
This commit removes explicit `CONFIG_NEWLIB_LIBC_NANO=n` overrides
because the newlib nano variant is no longer enabled by default when
it is available.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-10-19 16:02:51 +02:00
Jamie McCrae 6798f447d5 tests: devicetree: device: Add bl5340 and bt610 exclusions
Adds bt610 and bl5340_dvk_cpuapp* targets to exclusion list for tests
as these boards enabled i2c by default for GPIO usage which conflicts
with the test.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-10-19 10:46:53 +02:00
Stephanos Ioannidis 44be5c941a tests: cmsis_dsp: Remove invalid mps3_an547 integration platform spec
This commit removes the `mps3_an547` board from the integration
platform list for the tests whose minimum flash size requirement exceed
the size of the flash available on the board.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-10-18 17:52:48 +09:00
Maureen Helm 03c8deb599 devicetree: Add model name helpers based on compat
Follow up to e1e16640b5 adding model name
helpers to access generated macros based on a compatible's matching
entries in vendor prefixes.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-10-07 11:48:02 -07:00
Anas Nashif a5bd666f4e lib: notify: build sys-notify conditionally.
Add a new Kconfig and build this code conditionally, so we do not end up
with this file being built for each zephyr app.

Partial fix for #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Anas Nashif a81b322828 lib: onoff: add a config for on-off and build conditionally
Do not build this service unconditionally.

Partial fix of #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Gerard Marull-Paretas b8f9d8add7 tests: devicetree: cover DT(_INST)_FOREACH_PROP_ELEM_SEP(_VARGS)
Add coverage for DT(_INST)_FOREACH_PROP_ELEM_SEP(_VARGS).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-03 10:11:18 +02:00
Andrei Emeltchenko 2e56f955db trivial: Remove empty files
Remove empty files.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-30 09:41:55 +00:00
Andrei Emeltchenko 1d879b93c5 trivial: tests: Remove empty file
Remove empty file.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-29 13:41:18 -05:00
Anas Nashif 215159c6ff tests: mem_blocks: remove board configs using dma logging
This is no longer needed and currently generating a fault with this
backend. Using the ztest delay fixes the issue and produces the complete
console output.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-09-26 10:53:43 +00:00
Zhao Shuai b15e64569c tests: lib: add a tag to uniquely identify mem_blocks test
To identify mem_blocks test uniquely.

Signed-off-by: Zhao Shuai <shuai1x.zhao@intel.com>
2022-09-26 08:11:13 +00:00
Henri Xavier 1a276d0ac6 ring_buffer: Introduce RING_BUF_ITEM_SIZEOF
Currently, to compute the 'item' size in a ring buffer, we have
`SIZE32_OF`.

Several issues with this:
- `SIZE32_OF` only works on variables, not types, due to an extra
 parenthesis pair. Indeed, `sizeof((int))` is not valid C, whereas
 `sizeof((my_var))` is.
- `SIZE32_OF` is not a proper public API
- `SIZE32_OF` rounds down if the argument size is not a multiple
 of 4 bytes.

Thus, we introduce a proper `RING_BUF_ITEM_SIZEOF`, fixing the
aforementioned issues.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-09-20 09:08:14 +00:00
Krzysztof Chruscinski a7224830ce lib: os: cbprintf: Mechanism for detecting %p in static package
Static packaging is using only argument types to build a package. There
is one case where analysing argument type only is not enough to
determine package content. That is %p with (unsigned) char pointer vs
%s. In case of %s a string might need to be appended to the package
and in case of %p it must be avoided. Format string analysis is required
to distinguish those two cases.
In order to speed up the runtime inspection, additional information is
added to a static package. That is index of the string argument (where
first argument has index 0). This information allows quick format string
inspection where nth format specifier is found and checked if it is a
pointer format specifier.
Inspection algorithm is added to cbprintf_package_convert() and if %p
is found then data for that argument is discarded. Additionally, log
warning is printed with suggestion to cast pointer argument to void *
to avoid confusion. It is desired to get rid of this ambiguity because
there are going to be logging configurations where strings are stripped
from a binary and runtime inspection cannot be performed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-19 10:14:23 +00:00
Enjia Mai ca5d698563 tests: lib: move the cmsis_dsp transform test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/transform to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai ccb3927233 tests: lib: move the cmsis_dsp matrix test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/matrix to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 26b816cb5a tests: lib: move the cmsis_dsp filtering test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/filtering to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 082e598f84 tests: lib: move the cmsis_dsp interpolation test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/interpolation to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 63105256f7 tests: lib: move the cmsis_dsp statistics test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/statistics to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 3e2fe17fa8 tests: lib: move the cmsis_dsp support test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/support to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Daniel Leung db9d83fbb8 tests: devicetree: add bits to test multi-bus nodes
This adds a few bits to the devicetree API tests for multi-bus
nodes where a bus can support multiple protocols. This uses
I3C as basis as I3C controller can support both I2C and I3C on
the same bus, while I2C controller cannot support both. So
this needs to make sure the correct bus macros are generated
if appropriate (and not generated if not needed).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Michał Barnaś 1ea41b34c6 ztest: improve some tests
This commit changes some tests from using zassert_equal to validate
the pointers to using the zassert_is_null and zassert_not_null.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Gerard Marull-Paretas 3732bbfa12 tests: devicetree: add tests for DT_CHILD/DT_INST_CHILD
Add some coverage for the DT_CHILD/DT_INST_CHILD macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Dominik Ermel d5810693ea tests: lib: gui: lvgl: Switch to FIXED_PARTITION_ macros
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-09-06 09:56:37 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Maureen Helm e1e16640b5 devicetree: Add vendor name helpers based on vendor prefixes
Adds vendor name helpers to access generated macros based on matching
entries in the vendor prefixes file.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-09-01 14:53:55 -07:00
Ming Shao b92b8719b8 tests: use HDA logging for mem_blocks test on cavs platforms
Logging through winstream can miss logs when log output is
fast. The mem_blocks test suffer from this on CAVS platforms.
Add CAVS config overlays to use HDA logging instead.

Signed-off-by: Ming Shao <ming.shao@intel.com>
2022-09-01 10:26:52 +02:00
Gerard Marull-Paretas 18454e46f2 devicetree: add DT_INST_FOREACH_CHILD_STATUS_OKAY* macros
Add the instance version of the DT_FOREACH_CHILD_STATUS_OKAY* family of
macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas fff9ecbc7f devicetree: add DT_(INST_)FOREACH_CHILD(_STATUS_OKAY)_SEP(_VARGS)
It is frequent to see in Devicetree code constructs like:

```c
 #define NAME_AND_COMMA(node_id) DT_NODE_FULL_NAME(node_id),

const char *child_names[] = {
	DT_FOREACH_CHILD(DT_NODELABEL(n), NAME_AND_COMMA)
};
```

That is, an auxiliary macro to append a separator character in
DT_FOREACH* macros. Non-DT API, e.g. FOR_EACH(), takes a separator
argument to avoid such intermediate macros.

This patch adds DT_FOREACH_CHILD_SEP (and instance/status okay/vargs
versions of it). They all take an extra argument: a separator. With this
change, the example above can be simplified to:

```c
const char *child_labels[] = {
	DT_FOREACH_CHILD(DT_NODELABEL(n), DT_NODE_FULL_NAME, (,))
};
```

Notes:
- Other DT_FOREACH* macros could/should be extended as well

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Krzysztof Chruscinski bb74b4f028 lib: os: cbprintf: Renamed flags used for conversion function
At some point, package copy function was extended and renamed
to cbprintf_package_convert. However, flags used by this
function were not renamed and used contained COPY idiom.
Deprecating flags with COPY and replacing them with flags
with CONVERT idiom to match function which is utilizing them.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-26 12:52:08 +02:00
Kumar Gala f3ff449524 tests: devicetree: device: Rename gpio@0 to avoid name conflict
There are some platforms like the lpcxpresso54114 that utilize gpio@0
so rename gpio@0 to gpio@ffff as this is a highly unlikely to conflict
with any real device.

Fixes #49439

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-26 12:51:45 +02:00
Krzysztof Chruscinski 716fa446cd tests: lib: spsc_pbuf: Improve stress test
Improve stress tests to be more robust and demanding. Previous
implementation did not reveal race condition.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-24 17:48:50 +00:00
Krzysztof Chruscinski 4b5ff413f5 lib: os: spsc_pbuf: Fix miscalculation in the allocation
Wrong value was used for free space calculation. Updating test which
previously was hiding this bug.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-24 17:48:50 +00:00
Radosław Koppel 7614110a20 dts: Add _STRING_TOKEN and _STRING_UPPER_TOKEN to string-array
This commit adds string token versions of the values also
in items inside string-array.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Co-authored-by: Kumar Gala <galak@kernel.org>
2022-08-22 13:58:30 -05:00
Radosław Koppel d493751fa1 test: devicetree: api: Limit test to native_posix and simulation
This commit limits test targets for the test to run only on native
or simulated machines.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2022-08-22 13:58:30 -05:00
Spoorthy Priya Yerabolu d4049e2cd6 tests: lib: sysutil: migrating lib tests to new ZTEST API
Migrating the sysutil tests to new ztest API

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-08-19 20:45:19 +00:00
Spoorthy Priya Yerabolu b341bce3a5 tests: lib: sprintf: migrating lib tests to new ZTEST API
Migrating sprintf tests to new ZTEST API.

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-08-19 20:45:19 +00:00
Kumar Gala c4ee3f3733 devicetree: deprecate DT_LABEL variants
Deprecate DT_LABEL and DT_INST_LABEL as we have phased out
general 'label' usage and there isn't a need to keep a specific
set of macros for 'label'.  DT_PROP(node, label) works fine for
the small handful of cases that need it now.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 06:49:50 -05:00
Kumar Gala 729f1ec301 tests: devicetree: device: Exclude test on bbc_microbit
The bbc_microbit boards end up enabling CONFIG_SENSOR because of
CLOCK_CONTROL_NRF_USES_TEMP_SENSOR.  This ends up enabling the I2C
bus which causes CONFIG_I2C_TEST=y.  We end up with a build conflict
betwee the i2c_test.c driver and the test case code.  So the easiest
solution is to just exclude the platforms from this test.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 12:08:33 +02:00
Kumar Gala 3f124ba14d tests: devicetree: device: utilize DEVICE_DT_NAME
Convert DT_LABEL to DEVICE_DT_NAME.  This lets us drop label properties
in the app.overlay.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 12:08:33 +02:00
li biao c2c467a6ff tests: lib: move ringbuffer to new ztest API
Move test ringbuffer to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-18 16:08:44 +02:00
li biao b6fadd1600 tests: lib: move smf to new ztest API
Move test smf to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-18 11:34:50 +00:00
Katarzyna Giadla eae01f0fc5 samples: tests: Rename duplicated testcases
Names of some testcases are duplicated in another files.
This change rename duplicated testcases.

Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
2022-08-17 12:11:00 +02:00
li biao ff6bf25632 tests: lib: cmsis_dsp: move svm to new ztest API
Move test svm to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-17 12:04:38 +02:00
li biao cbcc21e418 tests: lib: move p4workq to new ztest API
Move test lib/p4workp to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-17 12:04:22 +02:00
Robert Lubos 208cbffbf7 test: Add uoscore tests
Add unit tests for OSCORE library.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-08-12 16:17:59 +02:00
Stephanos Ioannidis 8355341c66 tests: lib: cmsis_nn: Initialise bias dimensions for depthwise convolve
This commit adds an initialisation for the `bias_dims` variable, which
is given as an input to the `arm_depthwise_conv_s8` function.

Note that the `bias_dims` parameter is currently unused by the function
implementation.

This fixes the following warning reported by the GCC 12:

  error: 'bias_dims' may be used uninitialized
  Werror=maybe-uninitialized]

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-10 12:00:18 +02:00
Martí Bolívar 2520747f6b devicetree.h: DT_FOREACH_NODE, DT_FOREACH_STATUS_OKAY_NODE
Add two new utility macros for iterating over the entire tree, along
with tests.

I have a use case for DT_FOREACH_STATUS_OKAY_NODE() right now, but I
think it makes sense to define both of them right away for
completeness.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Fabio Baltieri def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Krzysztof Chruscinski 3a369c47b3 tests: lib: spsc_pbuf: Test refactoring and improvement
Refactoring test by adding macro for total packet length
calculation and header length.

Tuning test to trigger a scenario where free space was miscalculated.
Bug was fixed in the previous commit.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-02 08:13:31 -04:00
li biao 00da7e1680 tests: lib: newlib: move thread_safety to new ztest API
Move test lib/newlib/thread_safety to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-01 18:04:58 +02:00
Kumar Gala 03a1fcb021 tests: gui: lvgl: Remove devicetree label
The lvgl glue code has been updated to use a devicetree label
so we can remove it from the test.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-01 18:03:01 +02:00
Jordan Yates 13f2494f4c device: symetric injected dependencies
If a device manually specifies that it depends on a second DT device,
add the first device to the second devices list of supported devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-30 08:29:29 -05:00
Jordan Yates 30795a48e6 tests: devicetree: devices: test no label
Ensure that the build system works correctly for devices without a
nodelabel.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-30 08:29:29 -05:00
Stephanos Ioannidis bde270b1d5 tests: lib: notify: Fix uninitialised variable warning
This commit sets an initial value of 0 for the `res` variable, whose
pointer is passed to other functions and is not directly assigned
within the calling function.

Note that, when the test completes successfully, the value of the `res`
variable should be set to `423` (the value of `set_res`).

This fixes the "‘res’ may be used uninitialized" warning generated by
the GCC 12.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-07-29 16:44:04 +01:00
Chen Peng1 687e5a7158 tests: cmsis_dsp: bayes: set unique testcase name.
the testcase source file f16.c and f32.c might be
compiled into the final binary at the same time,
so need to set unique testcase name for each test.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-07-30 00:08:15 +09:00
Chen Peng1 cf9e548248 tests: cmsis_dsp: distance: set unique test names
the testcase source file f16.c and f32.c might be
compiled into the final binary at the same time,
so need to set unique test names for each test,
otherwise, it will report build failures "multiple
definitions".

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-07-30 00:08:15 +09:00
Zhao Shuai 1107a4decf tests: lib: spsc_pbuf: increase the timeout value
Increase the timeout value to avoid timeout.

Signed-off-by: Zhao Shuai <shuai1x.zhao@intel.com>
2022-07-28 19:46:56 +01:00
Kumar Gala e8f947b975 tests: devicetree: api: Remove unnecessary label properties
Remove unused "label" properties from devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 12:19:01 -07:00
li biao 3e87adc8bc tests: lib: devicetree: move api_ext to new ztest API
Move test lib/devicetree/api_ext to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-19 13:00:37 -07:00
li biao dea133ac26 tests: lib: devicetree: move api to new ztest API
Move test lib/devicetree/api to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-19 13:00:37 -07:00
li biao a5129e62b3 tests: lib: devicetree: move devices to new ztest API
Move test lib/devicetree/devices to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-19 13:00:37 -07:00
Kumar Gala 357c70cfdc tests: devicetree: api: reduce DT_LABEL usage
A lot of places that DT_LABEL is used we can replace with DT_SAME_NODE
as we are just checking that the node we got from the macro is the
same as what we expect.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:09:13 -07:00
Kumar Gala 7bc6bc8681 dts: bindings: test: device labels are now optional
All in tree device drivers use some form of DEVICE_DT_GET
so we no longer need to require label properties.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 12:31:53 +00:00
Krzysztof Chruscinski e63fc06491 tests: lib: spsc_pbuf: Increase test buffers
Test buffers must be increased to fit test data when cache
is enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-18 12:21:16 -04:00
Kumar Gala 46f4513573 devicetree: deprecate DT_BUS_LABEL variants
Deprecate DT_BUS_LABEL and DT_INST_BUS_LABEL as we phase out
'label' property usage in favor of DT_BUS and variants.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-15 11:05:12 -07:00
li biao d233b40bf1 tests: lib: cmsis_dsp: move quaternionmath to new ztest API
Move test lib/cmsis_dsp/quaternionmath to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-15 15:35:15 +02:00
li biao 24d8223303 tests: lib: move heap_align to new ztest API
Move test lib/heap_align to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-15 06:58:57 -04:00
li biao f86a3b4b17 tests: lib: move heap to new ztest API
Move test lib/heap to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-15 06:58:57 -04:00
Kumar Gala 1fc243c73d devicetree: gpio: deprecate DT_GPIO_LABEL variants
Deprecate DT_GPIO_LABEL, DT_INST_GPIO_LABEL, DT_GPIO_LABEL_BY_IDX,
and DT_INST_GPIO_LABEL_BY_IDX as we phase out 'label' property usage
in favor of DT_GPIO_CTLR and variants.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-15 09:59:59 +02:00
Kumar Gala 78f91a1be2 devicetree: spi: deprecate DT_SPI_DEV_CS_GPIOS_LABEL variants
Deprecate DT_SPI_DEV_CS_GPIOS_LABEL and DT_INST_SPI_DEV_CS_GPIOS_LABEL
as we phase out 'label' property usage in favor of
DT_SPI_DEV_CS_GPIOS_CTLR and variants.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-15 09:59:59 +02:00
li biao 2bb51578dc tests: lib: move time to new ztest API
Move test lib/time to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-14 10:39:24 +02:00
Peter Mitsis 5ed73a864c tests: Add mem_blocks_stats test
The mem_blocks_stats test verifies the behaviour of the mem_blocks
runtime stats.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-07-12 13:59:26 +00:00
li biao 6ef33396b8 tests: lib: move notify to new ztest API
Move test lib/notify to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-12 11:19:22 +02:00
li biao e00bc8ece7 tests: lib: move onoff to new ztest API
Move test lib/onoff to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-12 11:19:22 +02:00
li biao bef88cb750 tests: lib: move fdtable to new ztest API
Move test lib/fdtable to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-08 21:12:55 -04:00
Spoorthy Priya Yerabolu a4eacf4996 tests: lib: mpsc_buf: move mpsc_buf to new ztest API
Move mpsc_buf to new ztest API.

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-07-08 21:10:05 -04:00
Spoorthy Priya Yerabolu c34edc36ce tests: lib: Move to new ztest API
Move lib tests to use new ztest API

Part of #47002 effort

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-07-08 21:10:05 -04:00
Carlo Caione d729919925 tests: memory_region: Move to new ztest API
Migrate the test to the new ztest API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-08 20:13:04 +00:00
li biao 0754141de9 tests: lib: newlib: move heap_listener to new ztest API
Move test heap_listener to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-08 12:02:28 +02:00
li biao 51cb5b584b tests: lib: gui: move lvgl to new ztest API
Move test lvgl to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-08 11:58:22 +02:00
Spoorthy Priya Yerabolu fe9526313b tests: lib: cmsis_nn: move to new ztest API
Move lib tests to use new ztest API

Part of #47002 effort

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-07-06 20:02:19 -04:00
Anas Nashif 02f2896586 tests: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
li biao ddaee674e3 tests: lib: move json to new ztest API
Move test json to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-07-06 11:15:11 +02:00
Jordan Yates 245ed89590 test: lib: devices: test DEVICE_INIT_* macros
Add tests for the new `DEVICE_INIT_*` macros.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-06 10:44:50 +02:00
Andrei Emeltchenko 669b02af8c tests: ringbuffer: Make code consistent
Refactor code to make it consistent and easier to read.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-04 22:25:03 +00:00
Andrei Emeltchenko a8cb2b74f3 tests: ringbuffer: Use defined req_len
Fixes "stored and never read" warning.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-04 22:25:03 +00:00
Andrei Emeltchenko ef6f4db7e0 tests: ringbuffer: Remove unneeded variable
Remove dead code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-04 22:25:03 +00:00
Christopher Friedt e08f84ab0b tests: lib: c_libc: tests for strerror, strerror_r
Add tests for strerror() and strerror_r()

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-04 22:53:36 +02:00
Reto Schneider 7a6c5710ff cmake: Update cmake_minimum_required to 3.20.0
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-07-04 10:18:45 +02:00
Keith Packard 7da1fca3d4 tests/c_lib: Let picolibc pick a malloc heap size
Now that picolibc's malloc arena configuration always allocates
some space, we don't need explicit allocations for tests.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-30 10:33:24 +02:00
Keith Packard a6119925c8 tests/mem_alloc: Let picolibc pick a malloc heap size
Now that picolibc's malloc arena configuration always allocates
some space, we don't need explicit allocations for tests.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-30 10:33:24 +02:00
Krzysztof Chruscinski cf19d7ef82 tests: lib: spsc_pbuf: Add test for getting maximum utilization
Add test for CONFIG_SPSC_PBUF_UTILIZATION option.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Krzysztof Chruscinski 1986591beb tests: lib: spsc_pbuf: Add tests for zero copy API
Extend test suite to validate zero copy API.
Add stress tests.
Add support for cache in the test. Test is not emulating cache
but ensures that buffer works correctly with cache enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Krzysztof Chruscinski 8c79ed2610 tests: lib: spsc_pbuf: Convert to use new ztest API
Convert test to use new API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Krzysztof Chruscinski fa055f743f lib: os: spsc_pbuf: Extend API with zero copy model
Added functions which allow to use zero copy model for handling
data within the packet buffer.

Additionally, added handling of cache by adding option to keep rd_idx
in different cache line than wr_idx and data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Lauren Murphy ef3e66c2bc tests: lib: c_lib: ifndef out gcc pragmas
Ifndefs out GCC pragmas causing build failures for
compilers with older GNUC versions, e.g. XCC <= 2020.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-06-28 14:38:54 -04:00
Keith Packard 813c4e8626 tests: Add picolibc tests for cbprintf
Build the lib.cbprintf_package test using picolibc

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-27 12:47:25 +02:00
Keith Packard d0a788669e tests: Add picolibc tests
This adds picolibc-specific configurations for a couple of tests

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard 0643f00aa3 tests/mem_alloc: Make sure the "impossible" allocations actually are
The hifive_unleashed board is configured with 0xf0000000 bytes of memory,
so an allocation of 0x7fffffff should succeed. Instead, use a much larger
value to ensure that the allocation fails.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard 8bbad143ca tests/c_lib: Ignore stringop-overflow warning
One test reads too few bytes from the source to ensure nul-termination of
the result which generates a compiler warning.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard 88cfad5531 tests/c_lib: Don't assume a particular PRNG from Picolibc [v2]
The random/rand tests assume the PRNG operates in a specific fashion,
which is not true when running Picolibc.

v2:
	Call ztest_test_skip for picolibc

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard fa38fe9a21 tests/sprintf: Skip '%n' test on picolibc
Picolibc excludes %n support on purpose as it can introduce security issues
when the format string is vulnerable to manipulation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard 92a5355e76 tests/sprintf: Adjust expected output for 5e-324
The smallest denorm is shown as 5e-324 by picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard fa496834ef tests/sprintf: Skip UB-dependent tests on Picolibc
Passing NULL as the stream to stdio functions is "UB" (undefined behavior)
in the C standard. Picolibc crashes in this case, which is valid, but not
helpful. Skip these tests in this case.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Keith Packard 08d4dc90a1 tests/heap_listener: Store 'malloc' value in global to avoid optimizer
When the compiler is allowed to know the semantics of malloc and free,
this test needs to be careful to not have both calls elided by not using
the result at all. Simply storing the malloc pointer in a global
variable is sufficient here.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Krzysztof Chruscinski cbc85071ee tests: lib: spsc_pbuf: Exclude ast1030_evb from test
This board has external cache enabled but fails to link when cache
API is used. Temporary disabling.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-07 19:04:35 +02:00
Krzysztof Chruscinski 0829610bbc lib: os: spsc_pbuf: Add option to use cache
Add flags option to init call and a flag to use cache.
Add Kconfig choice to pick how to approach cache. Cache can be
enforced in all spsc_pbuf instances, disable in all, or runtime selected
based on configuration flag. Option is added to allow memory footprint
savings.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-07 19:04:35 +02:00