Commit Graph

68 Commits

Author SHA1 Message Date
Ryan McClelland 0ae1e37ead tests: logging: fix double-promotion warnings
Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-07-31 10:08:27 +02:00
Anas Nashif 9f37ae902b tests/samples: set ram/rom limits on some samples/tests
Increase RAM requirements for some test, we have many exotic platforms
failing to link due to the size of the test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-13 09:38:27 -04: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
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
Tom Burdick 7fba189640 tests: log_api platform key
Ensures the log_api tests only run once per unique (arch, simulator)
platform.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-12 10:30:57 -05:00
Andrei Emeltchenko b5fd057d90 tests: logging: Use proper type
Function cbpprintf() returns int type and may return negative error
code. Fixes static tool warnings.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-11 09:39:23 +01:00
Krzysztof Chruscinski a326f05b93 tests: logging: log_api: Fix test_log_arguments case
Test had by accident an early return and after removal case was failing
in certain configurations. It was failing because set of long messages
was not fitting into the logging buffer used in the test. Fixed the
test by adding more frequent processing between the messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-05 18:28:33 -05:00
Fabio Baltieri 3143e85a77 tests: logging: drop duplicate test
Drop duplicate entry for
logging.log_api_deferred_override_level_rt_filtering, it's already
declared with the same settings on line 106.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 10:34:18 +01:00
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 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
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
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
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
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
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
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 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
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
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
Daniel Leung ff54de3e16 tests: logging/log_api: add bits to test backend events
This adds a few bits to the log_api tests to test backend
event notifications.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-07-11 11:09:31 +02:00
Krzysztof Chruscinski 3bcd14f420 logging: Reduce code size for frontend only case
Add early returns from functions which are not used when
there is only one frontend in the system (no backends). This
allows to significantly reduce logging code size in that
configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-02 14:13:54 +02:00
Ryan Erickson fb34a9749f logging: add log_source_id_get
Add API to get the logging module source ID from the
module name;

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Daniel Leung 3efce4c939 Revert "tests: logging: log_api: Add cast to char array"
This reverts commit 265394e30e.

The underlying cause is fixed so reverting this...

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-30 14:03:45 +09:00
Krzysztof Chruscinski 9833ca61c9 logging: Removing v2 suffix from logging names
Renaming objects which had 2 in the name to indicate that
it is v2 specific. Once logging v1 has been removed such
suffixes are redundant.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 15:46:37 -04:00
Krzysztof Chruscinski 265394e30e tests: logging: log_api: Add cast to char array
Tagged arguments feature fails to correctly tag a char array in
C++ configuration. Temporarily casting to char pointer to make
the test pass.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Krzysztof Chruscinski c5f2cdef09 logging: Remove logging v1 from the logging
Remove v1 implementation from log_core and all references in the tree.
Remove modules used by v1: log_list and log_msg.
Remove Kconfig v1 specific options.
Remove Kconfig flags used for distinction between v1 and v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-16 10:51:15 -04:00
Krzysztof Chruscinski 61532e93b4 tests: logging: log_api: Remove v1 support
Remove support for logging v1 from the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 09:12:04 +02:00
Daniel Leung 68684f7310 tests: log_api: exclude XCC from runtime tagged argument tests
XCC does not support _Generic so it can't build the runtime tagged
argument tests. So exclude them.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 09:31:42 -04:00
Daniel Leung 8f97e25645 tests: logging/log_api: add a few bits for tagged arguments
This adds a few bits to support testing for runtime tagged arguments
when CONFIG_LOG2_RUNTIME_USE_TAGGED_ARGUMENTS is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung aff6e8b2f7 lib: os: cbprint: enable tagged arguments for packaging
This adds some bits to support tagged arguments to be used for
packaging. If enabled, the packaging function no longer looks at
the format strings to determine the types of arguments, but
instead, each argument is tagged with a type by preceding it
with another argument as type (integer). This allows the format
strings to be removed from the final binary to conserve space.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung b5509cb234 tests: log_api: workaround QEMU crashing on qemu_leon3
When running twister during logging.log2_api_immediate_printk_cpp
on qemu_leon3, it reports unexpected eof even though the tests
reported successful. This results in twister reporting the test
being failed due to "unexpected eof".

When running it using west build, QEMU quits immediately after
printing PROJECT EXECUTION SUCCESSFUL instead of simply waiting
there for Ctrl-A X.

So workaround this by changing the main stack size to 4096.

Related to #46056

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-27 11:45:58 -07:00
Anas Nashif a6f924db7f twister: add support for platform_type filter
Instead of relying on runtime filter to limit scope to emulation
platforms, use the type attribute for each platform and do the filtering
very early on. This will speed things up for tests where we only run on
emulation platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-14 14:49:59 -04:00
Anas Nashif 8faca29fea tests/samples: fix usage of integration_platforms
integration platforms can't be filtered out, adapt tests so that those
platforms are always available for testing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-14 14:49:59 -04: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
Krzysztof Chruscinski 0b8b1ae997 tests: logging: log_api: Extend to test LOG_OVERRIDE_LEVEL
Extended test to validate CONFIG_LOG_OVERRIDE_LEVEL
option.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-06 10:59:57 +02:00
Krzysztof Chruscinski 476033e81f tests: logging: log_api: Minor cleanups in the test
Fixing minor issues in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-06 10:59:57 +02:00
Krzysztof Chruscinski ce55b72752 tests: logging: log_api: Minor fix in the test
Size of wrong string was used. It was not seen since
length was later on aligned but may lead to failures
in the future.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-30 16:16:40 -04:00
Krzysztof Chruscinski f2c40a5802 tests: logging: log_api: Rework C++ test
Reworked test to use different approach for C++ testing.
Instead of hackish include of test.inc, cmake is forcing
C++ compilation on test file when C++ option is set in
test configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-30 12:19:13 +02:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Krzysztof Chruscinski 3dc12753ff tests: logging: log_api: Extend with frontend feature
Extend test to check also frontend feature.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Krzysztof Chruscinski 92fb1af09a tests: logging: log_api: Fix test cases setup
Execute log_setup even when test is skipped. This is especially
vital when test infrastructure is using logging (e.g. LOG_PRINT
is enabled).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Krzysztof Chruscinski 402c9b8895 tests: logging: log_api: Add test for argument evaluation
Added test which checks that log argument is evaluated only
once when log message is created.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-22 14:44:11 +01:00
Maureen Helm 27afc77a4b Revert "tests: logging: log_api: Add test for argument evaluation"
This reverts commit f647201bbd.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-08 17:02:48 -05:00
Krzysztof Chruscinski 21867fd4d0 tests: logging: Update test after adding rodata detection on sparc
Updated tests to tread sparc as any other platforms that are
capable of detection if string is read only.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 09:41:37 -05:00
Krzysztof Chruscinski f647201bbd tests: logging: log_api: Add test for argument evaluation
Added test which checks that log argument is evaluated only
once when log message is created.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 07:32:43 -05:00
Krzysztof Chruscinski 4012e7ddc6 tests: logging: log_api: Execute message dropping test on 1 cpu
Ensure that test is executed on 1 CPU. When target has multiple
CPUs other core may process logging and we won't get expected number
of dropped messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 08:16:10 -05:00
Krzysztof Chruscinski 3e58625acd tests: logging: log_api: Reworking suite setup
Reworking test suite setup.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 08:16:10 -05:00