Commit Graph

36 Commits

Author SHA1 Message Date
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
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +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
Andrei Emeltchenko b234ddc748 tests: ibecc: Fix IBECC tests
Fix IBECC tests moving common part to setup function.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-21 13:57:25 +00:00
Yinfang Wang 8a5bf765bc tests: subsys: edac: move ibecc to new ztest API
move ibecc to new ztest API.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-21 13:57:25 +00:00
Yinfang Wang 6087bac296 tests: subsys: edac: move ibecc_cov to new ztest API
move ibecc_cov to new ztest API.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-21 13:57:25 +00:00
Yinfang Wang 0a89c07e1d tests: subsys/edac: Remove test_trigger_nmi_handler testing.
Remove the unrelated testing test_trigger_nmi_handler of edac.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-18 13:30:37 +00:00
Kumar Gala e951c2808e tests: edac: ibecc: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 10:02:59 +02:00
Yuval Peress 86cadf9283 ztest: Fix userspace ztests in new API
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.

Fixes #44108

Signed-off-by: Yuval Peress <peress@google.com>
2022-05-25 11:20:13 +09:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Andrei Emeltchenko b565683aec tests: ibecc: Fix using global device pointer
Removing global device pointer fixes issues with uninitialized device.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Andrei Emeltchenko 69ac4b29de edac: ibecc: Refactor error inject code
Refactor code removing duplicated parts.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Daniel Leung bb595a85f1 kernel: mem_domain: add/remove partition funcs to return errors
This changes both k_mem_domain_add_partition() and
k_mem_domain_remove_partition() to return errors instead of
asserting when errors are encountered. This gives the application
chance to recover.

The arch_mem_domain_parition_add()/_remove() will be modified
later together with all the other arch_mem_domain_*() changes
since the architecture code for partition addition and removal
functions usually cannot be separately changed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-22 12:45:22 -05:00
Andrei Emeltchenko 89becd0b87 ibecc: tests: Increase test coverage
Increase test coverage with simulation of reading  IBECC_ECC_ERROR_LOG
and IBECC_PARITY_ERROR_LOG.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko d11fae6d06 edac: ibecc: Return -ENODATA on zero log
Return -ENODATA when we read zero log.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko 0feb432b8e ibecc: tests: Update test logging
Make logging more clear.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko 6c6645bf47 edac: tests: Add more coverage tests
Add more test for better coverage of some static functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko f4f2bb3548 edac: tests: Add testing error_trigger() for unset type
Add testing for edac_inject_error_trigger() for unset error type.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-10-14 12:11:09 -04:00
Andrei Emeltchenko 2405dd3ce9 edac: tests: Increase code coverage
Add test for better code coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-10-14 12:11:09 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Andrei Emeltchenko 5469310628 tests: edac: Add statistic check
Add testing error counting after each error injection test.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-08-17 17:21:50 +02:00
Andrei Emeltchenko 5f8e026278 tests: edac: Add verification of defaults
Add verification of default parameters for error injection tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-08-17 17:21:50 +02:00
Andrei Emeltchenko d5a8f1200e edac: Add dumy EDAC driver for API coverage
Add dummy EDAC driver for -ENOSYS test coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko 32b17d3b0a edac: tests: Use new EDAC API in tests
Use new EDAC API in tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Anas Nashif 0ec3774bde userspace: rename _is_user_context -> k_is_user_context
This functions is being called across the tree, no reason why it should
not be a public API.

The current usage violates a few MISRA rules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Andrei Emeltchenko 8d5452fcbc edac: ibecc: Add testing README
Add README listing BIOS options for error injection.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-03-24 05:43:17 -04:00
Andrei Emeltchenko c1cd44cab4 tests: edac: Ensure vars are not changed in assert evaluation
Coverity analysis reported following cases with side effect in assertion
(ASSERT_SIDE_EFFECT):

CID: 219574
CID: 219644
CID: 219659

Avoid issue by loading volatiles to local variables before assertion.

Fixes: #33079
Fixes: #33042
Fixes: #33030

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-03-08 10:04:58 -05:00
Andrei Emeltchenko 80ec93860b tests: edac: Add test for user thread communication
Add test verifying communication with user thread.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-19 16:06:29 +02:00
Andrei Emeltchenko e97d99fa5b tests: edac: Support userspace
Add support for communication with user thread.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-19 16:06:29 +02:00
Andrei Emeltchenko 89a253b052 edac: Use Device Tree values for BDF and PCI VID
Start using DTS values for PCI Vendor ID and PCI BDF. For the PCI
Device ID we do not use DTS since this would require changing overlay
for different SKU board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-04 09:37:42 -05:00
Anas Nashif 0426a5a682 drivers: edac: CONFIG_LOG_MINIMAL -> CONFIG_LOG_MODE_MINIMAL
CONFIG_LOG_MINIMAL is promptless, use CONFIG_LOG_MODE_MINIMAL.

Fixes build failure in test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-26 09:06:55 -05:00
Andrei Emeltchenko f4582b9478 edac: Add error data information to callback parameter
Add extra error data information to callback parameter. Add tests for
testing the data provided.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko 2dc413aa74 edac: Split EDAC set ctrl to set error_type and error_trigger
Split setting EDAC IBECC ctrl to setting error_type and
error_trigger to make it easier for other platforms.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko f80628ba96 edac: Generalize EDAC API
Replace addr with param1 and addr_mask with param2 for get / set types
of functions. Those names are more general and allow to implement
error injections for other platforms.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko 5f06dbaebe edac: tests: Add injection API test
Add test injecting error and getting correct notification about EDAC
error. Since we have logging enabled in the exception handler it does
not work with LOG_MINIMAL.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko f2cd5f753f edac: tests: Add testing EDAC IBECC API
Add testing EDAC API, can be run on device ehl_crb.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00