Commit graph

32 commits

Author SHA1 Message Date
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
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
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 6f5cf3042d tests: lib: cbprintf_packaged: Add test for cbprintf_package_convert
Add test for the new function in the API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-05-04 18:56:55 -04:00
Tristan Honscheid e4d24fcf3a ztest API Migration: lib/cbprintf_package
Migrate the unit tests at `lib/cbprintf_package` to use the new ztest
API.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2022-04-24 19:47:18 +02:00
Krzysztof Chruscinski 50cc558924 tests: lib: cbprintf_package: Test for CBPRINTF_PACKAGE_COPY_KEEP_RO_STR
Extend test to validate CBPRINTF_PACKAGE_COPY_KEEP_RO_STR flag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-29 23:03:35 -04:00
Krzysztof Chruscinski a33f7de86a lib: os: cbprintf: Add CBPRINTF_PACKAGE_COPY_KEEP_RO_STR flag
Add flag to copy function which indicates that read-only
string locations shall be kept in the output package.

Updated cbprintf_package test to pass.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-29 23:03:35 -04: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 d00f9e8774 tests: lib: cbprintf_package: Add test for CBPRINTF_MUST_RUNTIME_PACKAGE
Add test for CBPRINTF_MUST_RUNTIME_PACKAGE macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 11:16:14 +01:00
Krzysztof Chruscinski d45d2619ce tests: lib: cbprintf_packaged: Extend test to check new modes
Extended test to check new flags added to cbprintf packaging API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 11:16:14 +01:00
Krzysztof Chruscinski c917e6c2ce lib: os: cbprintf: Extend API to support new packaging modes
Added new flags to packaging API:
- CBPRINTF_PACKAGE_ADD_RO_STR_IDXS - when set, read-only string
  locations are appended to the package
- CBPRINTF_PACKAGE_ADD_RW_STR_IDXS - when set, read-write string
  locations are appended to the package (instead of appending actual
  strings)
- CBPRINTF_PACKAGE_FIRST_RO_STR_CNT(n) - indicate that n first strings
  are known to be read only. Ignored in runtime packaging.

Add function for copying packages with optional appending strings.

Changed CBPRINTF_MUST_RUNTIME_PACKAGE to use same flags as packaging.

Aligned logging and test to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 11:16:14 +01:00
Krzysztof Chruscinski fd517ff6dc tests: lib: cbprintf_package: Hande riscv32 case
Long double test fails on riscv32 for unknown reason. Previously,
testcase.yaml was excluding whole test. Removed that and added
skipping in the code so that rest of the suite is executed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-10 14:03:52 -05:00
Krzysztof Chruscinski 7cba9f5dab tests: lib: cbprintf_package: 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-10 14:03:52 -05:00
Ederson de Souza 6babbd32e1 boards/riscv: Add qemu_riscv32_smp and qemu_riscv64_smp
Based on qemu_riscv32 and qemu_riscv64, add minimal SMP support
using the "virt" machine.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-25 19:13:50 -05:00
Krzysztof Chruscinski 8171417f77 tests: lib: cbprintf_package: Extend test
Extend test to validate CBPRINTF_MUST_RUNTIME_PACKAGE_CONST_CHAR flag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-29 21:13:56 +01:00
Krzysztof Chruscinski 7831bfcce8 lib: os: cbprintf: Add flags to CBPRINTF_MUST_RUNTIME_PACKAGE
Add flags to macro which checks if string must be packaged
using runtime approach.

Added flag CBPRINTF_MUST_RUNTIME_PACKAGE_CONST_CHAR. When flag
is set then const char pointers are considered as pointers to
fixed strings and do not require runtime packaging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-29 21:13:56 +01:00
Ryan McClelland a000acca5f tests: fix double promotion warning
With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Krzysztof Chruscinski 905c430753 tests: lib: cbprintf_package: Fix coverity issue
Ensure that length variables (len0, len1, len2) are positive
before they are used for array indexing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-27 10:15:51 -04:00
Evgeniy Paltsev 6821d58056 tests: disable logging-related failing tests on qemu_arc_hs6x
Temporary disable logging-related failing tests on qemu_arc_hs6x
until we fix the rootcause so we can enable qemu_arc_hs6x in
upstream verification.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-29 14:24:44 -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
Krzysztof Chruscinski 1b27804ba3 tests: lib: cbprintf: Add tests for fsc package
Added tests for fully self-contained packages and use of
CBPRINTF_PACKAGE_ADD_STRING_IDXS flag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-27 14:50:45 +02:00
Krzysztof Chruscinski 5d80cbae59 lib: os: cbprintf: Add support for conversion to fsc package
Added support for conversion from a standard package which contains
pointers to read only strings to fully self-contained (fsc) package.
Fsc package contains all strings associated with the package thus
access to read only strings is not needed to format a string.

In order to allow conversion to fsc package, standard package must
contain locations of all string pointers within the package. Appending
that information is optional and is controlled by flags parameter
which was added to packaging API. If option flag is set then
package contains header, arguments, locations of read only strings and
transient strings (each prefixed with string argument location).
Package header has been extended with field which contains number of
read only string locations.

A function for conversion to fsc package has been added
(cbprintf_fsc_package()).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-27 14:50:45 +02:00
Anas Nashif 5343aed002 tests: fix testcase.yaml files
Puts all filter in common section and fix filters. Platforms in
integration_platforms must also be allowed first, otherwise the tests
will never run.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 41c8823250 tests: lib: cbprintf_package: Enable CONFIG_CBPRINTF_LIBC_SUBSTS
Enable option to use snprintfcb in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 0bc3bee738 tests: lib: cbprintf_package: Add CBPRINTF_MUST_RUNTIME_PACKAGE test
Extended test to cover CBPRINTF_MUST_RUNTIME_PACKAGE macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 604c9ac231 tests: lib: cbprintf_package: Minor cleanup
Adding static to local functions. Using void * for %p argument
which often triggered compilation warning.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 09:39:08 -05:00
Krzysztof Chruscinski 61a2e8cee3 tests: lib: cbprintf: Extended to test C++
Extended test suite to be run for C++

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-05 08:45:43 -04:00
Krzysztof Chruscinski 0e39b7d707 tests: lib: cbprintf: Update test after adding alignment parameter
Add validation of the case when package buffer is not aligned to
CBPRINTF_PACKAGE_ALIGNMENT.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski 85187437cc tests: lib: cbprintf_package: Fix issue reported by coverity
Fixing issue 219727. Potentially negative return value was passed
to a function that was expecting positive value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-27 11:26:55 +01:00
Krzysztof Chruscinski 844800365a tests: lib: cbprintf: Added configuration without _Generic
Extended test to validate case when _Generic keyword is not used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-12 09:25:15 -05:00
Krzysztof Chruscinski a92214b8f4 tests: lib: cbprintf_package: Extend to test static packaging
Extend test to validate cbprintf static packaging on various
platforms.

Added more test configurations: complete, nano, long double.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-11 09:54:39 +01:00
Krzysztof Chruscinski dccfe76663 tests: lib: Add test for cbprintf_package
Add test to validate cbprintf packaging on various platforms

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-05 09:29:35 +01:00