Commit Graph

724 Commits

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