Commit graph

240 commits

Author SHA1 Message Date
Fabio Baltieri
a2e5bd1928 yamllint: fix all yamllint comments errors
Fix all hyphens errors detected by yamllint:

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

Default config would be to require two spaces after the start of the
comment, proposing to keep it on 1, inline with the Linux binding
config, that is:

```
-  comments:
-    min-spaces-from-content: 1
```

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Krzysztof Chruscinski
5751f90185 tests: logging: log_msg: Fix test after mpsc_pbuf changes
Test started to fail after updated in mpsc_pbuf. It was failing for
two reasons:
- Expected capacity was not updated after change in mpsc_pbuf which now
has full capacity (does not use extra byte for empty vs full
distinction).
- Messages were claimed without freeing. It was faulty even before the
update since mpsc_pbuf is single consumer so only one message can be
claimed at a time. However, test was passing before unexpectedly.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-03 12:28:55 +01:00
Krzysztof Chruscinski
235ee63233 lib: os: mpsc_pbuf: Use flag for buffer full indication
Use flag instead of word in the buffer. Using this method allows
to dedicate full buffer capacity for data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Krzysztof Chruscinski
475035835f tests: logging: log_api: Align native posix case
Remove extra string size addition to the log message size when posix
is used. First string is considered as read-only also for posix so it
does not add to the message size. Test was passing before but change
in data handling in mpsc_pbuf revealed bug in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-29 10:33:29 +01:00
Rob Barnes
61b5566e74 logging: Add an option for a custom log header
There are scenarios when it is necessary to globally redefine
a log macro. The existing logging frontend is not sufficient since
it redirects at the function level.

One example is using pigweed_tokenzier. The pigweed tokenizer depends
on intercepting log strings at the macro level to function.

Introduce an option to include a custom application provided header
named "zephyr_custom_log.h" at the end of log.h. This allows an
application to extend the LOG_* macros globally.

This change includes a simple test that redefines the core LOG macros
to include a custom prefix.

Signed-off-by: Rob Barnes <robbarnes@google.com>
2022-12-22 11:09:59 +01:00
Krzysztof Chruscinski
6efc55e8d7 tests: logging: log_immediate: Add LOG_PRINTK=n
Do not direct printks to logging subsystem in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-12-01 00:36:13 +09: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
Krzysztof Chruscinski
063984d0b8 tests: logging: log_link_order: Align to LOG_PRINTK as default
Alignging test to a change which enabled LOG_PRINTK as default.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-29 10:46:26 +01:00
Krzysztof Chruscinski
1cfe927629 tests: logging: log_links: Align to LOG_PRINTK as default
Alignging test to a change which enabled LOG_PRINTK as default.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-29 10:46:26 +01:00
Krzysztof Chruscinski
34010e3bd0 tests: logging: log_switch_format: Align to LOG_PRINTK as default
Alignging test to a change which enabled LOG_PRINTK as default.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-29 10:46:26 +01:00
Krzysztof Chruscinski
fe4a4ce2ad tests: logging: log_syst: Align to LOG_PRINTK as default
Alignging test to a change which enabled LOG_PRINTK as default.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-29 10:46:26 +01:00
Krzysztof Chruscinski
ea3d03439c tests: logging: log_core_additional: Align test to LOG_PRINTK changes
Align test to accomodate for a change that LOG_PRITNK is by default
enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-29 10:46:26 +01:00
Keith Packard
c17c459363 tests/log_stack: Increase idle stack size to 2048
This is required for riscv64 when running with picolibc and with
fortify-source enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-08 10:44:36 +01:00
Tom Burdick
dbc366918d tests: Enable qemu_xtensa logging tests
Enables logging testing for qemu_xtensa along with the fixes needed to
correctly run the tests.

Several tests in log_api rely on being able to calculate the size of
the message in the mpsc_pbuf to know when an overflow occurs. The
size being calculated assumed a ROUND_UP size alignment to sizeof(long
long). On xtensa this is actually 16 bytes as defined by
CBPRINTF_PACKAGE_ALIGNMENT.

Changes the size calculation for SIMPLE_MSG_LEN to account for this.

The second issue was a misaligned package that would cause reading
from the incorrect memory when going to format the package with cbpprintf.

Fixes the padding used to align the package in cbprintf.h and adds a build
assert ensuring correct alignment when building against xtensa in both
cbprintf.h and log_msg.h.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-11-04 11:02:27 -04: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
Nikolay Agishev
5b6f2f4fb6 twister: Add fiters to SYS-T related tests
New filter "TOOLCHAIN_HAS_NEWLIB == 1" was applied
because of following chain of dependencies:
LOG_MIPI_SYST_ENABLE=y --> CONFIG_MIPI_SYST_LIB --> \
--> REQUIRES_FULL_LIBC --> NEWLIB_LIBC.

Not all compillers announced in Zephyr support NewLib.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2022-10-27 11:03:30 +02:00
Zhao Shuai
4a8073882b tests: create test for dynamic loadable logging backends
Test the three APIs, log_backend_activate,
log_backend_is_active and log_backend_deactivate.

Signed-off-by: Zhao Shuai <shuai1x.zhao@intel.com>
2022-10-26 15:51:11 -07:00
Ming Shao
1402d0d3ab log_link: fix the log_link test failure on adsp boards
The log_link tests are meant to work with 2 mock log backends.
But Intel ADSP platform has an extra default backend named
"log_backend_adsp" when CONFIG_LOG_BACKEND_ADSP=y, which will
mess things up.

Fix it by disabling the default backend.

Signed-off-by: Ming Shao <ming.shao@intel.com>
2022-10-25 10:52:00 +02:00
Krzysztof Chruscinski
042e233284 tests: logging: Add test for processing order with links
Added test which validates that messages are processed in
expected order. Order depends on link configuration. If link
is using dedicated mpsc_pbuf then processing order is
based on timestamp. When single mpsc_pbuf is used then order
is derived from message arrival order.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Krzysztof Chruscinski
2f12445e2b tests: logging: Add test for log_link
Added test for log_links which are used in multidomain logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Krzysztof Chruscinski
e322447109 logging: Initial multidomain support
Adding multidomain support by introducing log_link module which
acts as a receiver of log messages created by another domain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Krzysztof Chruscinski
7fb54e221b tests: logging: Add test for log_cache
Test suite for log_cache module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Krzysztof Chruscinski
54a64edb0e tests: logging: log_stack: Adjust thresholds
Adjust threshold for failing tests.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Anas Nashif
41e6758b24 tests: logging: log_api: add native_posix to platform_allow
native_posix being an integration plarform, needs to be in the allow
list.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-13 06:23:46 -04:00
Carlo Caione
dfbfb3ff67 test: log_output: Exclude qemu_arc_hs5x
This platform is failing and breaking main. Exclude until a proper fix
is found.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-10-12 17:40:10 +09:00
Lucas Denefle
2efc9cc847 logging: enable setting custom logging output func
To enable custom formatting of the log output while still using existing
backend, this commit adds the `log_output_custom` feature.
To use, register a commit with `log_custom_output_msg_set` then set the
log backend format set using `log_backend_format_set` with
`LOG_OUTPUT_CUSTOM`

Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
2022-10-06 19:15:35 -04:00
Krzysztof Chruscinski
e6bbc6941a logging: Use STRUCT_SECTION macros for log backend
Clean up logging code to utilize macros for handling sections.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-03 10:11:03 +02:00
Krzysztof Chruscinski
50d9c27990 tests: logging: log_stack: Adjust stack usage for x86
x86 deferred mode is failing. Adjust threshold values.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-19 10:14:23 +00: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
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
Krzysztof Chruscinski
6f022f582b tests: logging: log_api: Add test for LOG_RAW
Add test for LOG_RAW macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-05 06:26:54 -04:00
Krzysztof Chruscinski
e052ba73ce tests: logging: log_core_additional: Fix missing dependency
Add LOG_OUTPUT to the test configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-01 20:54:13 +02:00
Krzysztof Chruscinski
ade2436bb0 tests: logging: log_api: Tune test to execute faster
Due to timeout settings, test was executing slowly and in certain
configurations it timed out. Adjusting timing to speed up the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-01 15:00:04 +00:00
Stephanos Ioannidis
e6d7118f0e tests: log_core_additional: Fix log_user test filter
This commit temporarily disables the `integration_platforms` for the
`log_user` test because it cannot be specified alongside the
`toolchain_exclude` filter.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-30 17:28:05 -04:00
Daniel Leung
ac7e679ae5 tests: log_stack: increase stack size for x86 and immediate mode
Stack usage has increased for immediate mode on x86, so increase
the threshold for stack size.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-30 12:49:31 +02:00
Stephanos Ioannidis
8e8b56881f tests: log_core_additional: Disable log_user test for Zephyr SDK
This commit disables the `logging.add.log_user` test when building with
the Zephyr SDK because it fails for all emulate-able platforms at
run-time.

Revert this commit when the GitHub issue #49213, which tracks this bug,
is fixed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-29 16:57:18 +02:00
li biao
7e9b3a9744 tests: subsys: logging: move log_backend_init to new ztest API
Fix missing to https://github.com/zephyrproject-rtos/zephyr/issues/49004

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-25 21:04:58 +00:00
li biao
edf3fe8a64 tests: subsys: logging: move log_backend_init to new ztest API
Move test subsys/logging/log_backend_init to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-25 21:04:58 +00:00
li biao
2a457b5ecf tests: subsys: logging: move log_syst to new ztest API
Move test subsys/logging/log_syst to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-23 19:27:51 +00:00
Shaoan Li
dd69eede43 tests: subsys: logging: move log_core_additional to new ztest API
Move test subsys/logging/log_core_additional to use new ztest API.

Signed-off-by: Shaoan Li <shaoanx.li@intel.com>
2022-08-22 10:23:10 +02:00
Shaoan Li
e408c45546 test: subsys: logging move log_benchmark to new ztest API
Move test subsys/logging/log_benchmark to use new ztest API.

Signed-off-by: Shaoan Li <shaoanx.li@intel.com>
2022-08-11 17:46:24 +02:00
li biao
97adecd713 tests: subsys: logging: move log_switch_format to new ztest API
Move test subsys/logging/log_switch_format to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-11 12:20:26 +02:00
Shaoan Li
414d98f767 tests: subsys: logging: move log_backend_fs to new ztest API
Move test subsys/logging/log_backend_fs to use new ztest API.

Signed-off-by: Shaoan Li <shaoanx.li@intel.com>
2022-08-11 12:17:19 +02:00
li biao
8bc0b2263f tests: subsys: logging: move log_immediate to new ztest API
Move test subsys/logging/log_immediate to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-11 12:17:14 +02:00
li biao
0ee00080d9 tests: subsys: logging: move log_msg to new ztest API
Move test subsys/logging/log_msg to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-11 12:17:08 +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
7dfe995aa0 tests: logging: log_switch_format: Disable standard backends
In order to avoid impacting test configuration and execution
disable default logging backends.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-26 16:07:37 -04:00
Fabio Baltieri
702b684366 tests: log_api: increase stack size for the test
CONFIG_MAIN_STACK_SIZE was increased for qemu_leon3, but after

15fdee04e3 logging: log_output: Add function for processing input arguments

this test started to fail on other platforms as well. Moving the stack
size override on the test wide prj.conf seems to make it work correctly
again.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-07-22 10:33:56 +02:00
Krzysztof Chruscinski
75c6a9050a tests: logging: log_stack: Adjust thresholds
Adjust thresholds after updates in log_output.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-21 09:04:37 -04:00
Krzysztof Chruscinski
a0e79710a0 tests: logging: log_output: Improve test coverage
Improve test coverage for log_output module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-21 09:04:37 -04:00