Commit Graph

230 Commits

Author SHA1 Message Date
Anas Nashif fcefc27823 tests: remove intel adsp cavs platforms from filters
Remove all filters related to dropped platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Anas Nashif 693e9915fd tests: tinycrypt: do not use TC_START for debugging
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif e7af676be9 tests: mbedtls: do not use TC_START for debugging
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif 126053c0e2 tests: tinycrypt_hmac_prng: do not use TC_START for debugging
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Andrzej Głąbek 29d7c90779 tests: Align zephyr,psa-crypto-rng node names with those used by SoCs
This is a follow-up to commit 9951971aee.

Align names of "zephyr,psa-crypto-rng" compatible nodes used in tests
(crypto/rand32 and drivers/entropy/api) with those introduced by the
above commit into SoC definitions (nRF5340/nRF9160). This way the test
overlays will overwrite the already existing nodes instead of adding
second instances of them, what leads to build failures at the linking
stage as the related driver supports only single instance (and creates
it for the first node found).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-07 14:26:18 +01:00
Anas Nashif ed79b1f25e tests: use namespacing in extra_configs and drop duplicated scenarios
Use namespacing with extra_configs in some tests and remove duplicated
scenarios the were made arch or platform specifc.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-13 09:42:59 +01:00
Henrik Brix Andersen 11aa8454f0 Revert "random: Change testing random generator"
This reverts commit d6881de3b3.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-09 19:29:50 +09:00
Declan Snyder d6881de3b3 random: Change testing random generator
The old random timer test was not random-looking
enough on some platforms.

Replace with new test which is psuedo-xoshiro.

The generator is still deterministic
and does not depend on entropy at all,
but should look more random for testing.

Change name of generator tree-wide also.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-09 10:16:55 +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
Keith Packard 5b845d60ba tests/mbedtls: Reduce MPU partition usage for picolibc
Disable the picolibc heap to avoid using one MPU partition.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-08 10:44:36 +01:00
Neil Armstrong 62dc712a50 test: drivers: rand32: add overlay for PSA Crypto Random entropy
This adds an overlay DT & config to enable the PSA Crypto Random entropy
driver to get random bytes from TFM.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02: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
Enjia Mai 66da4c2854 tests: crypto: move the tinycrypt test to new ztest API
Migrate the testsuite tests/crypto/tinycrypt to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04:00
Enjia Mai 64f096d264 tests: crypto: move the tinycrypt_hmac_prng test to new ztest API
Migrate the testsuite tests/crypto/tinycrypt_hmac_prng to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04:00
Enjia Mai 7a39635f0d tests: crypto: move the rand32 test to new ztest API
Migrate the testsuite tests/crypto/rand32 to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04:00
Enjia Mai ae30549207 tests: crypto: move the mbedtls test to new ztest API
Migrate the testsuite tests/crypto/mbedtls to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04:00
Enjia Mai eab566a533 tests: crypto: move the crypto_hash test to new ztest API
Migrate the testsuite tests/crypto/crypto_hash to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04: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
Hu Zhenyu 5921eccf1b test: tests/crypto/tinycrypt timeout
It takes more than 300 seconds to finish the test,
so enlarge the timeout value from 300 to 500(seconds)

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-06-29 20:59:31 -04:00
Marcin Niestroj 945b5085c5 tests: crypto: mbedtls: remove default mbedTLS options
Whenever MBEDTLS_BUILTIN is selected then
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h" is set as a default value.
It is even impossible to change it, as without CUSTOM_MBEDTLS_CFG_FILE it
is just a hidden (not configurable by user) Kconfig option.

Remove explicit configuration from prj.conf.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-23 09:10:03 +02:00
Marcin Niestroj 96e9971797 tests: crypto: crypto_hash: remove default mbedTLS options
Whenever MBEDTLS_BUILTIN is selected then
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h" is set as a default value.

Remove explicit configuration from prj.conf.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-23 09:10:03 +02:00
Stephanos Ioannidis 4735e10630 libc: minimal: Introduce CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS
This commit introduces a new configuration called
`CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS`, which enables the
traditional non-reentrant (i.e. not thread-safe) version of the C
standard library functions such as rand() and gmtime() when the
respective configs are enabled.

The non-reentrant functions make use of the globals and require an
additional memory partition (MPU region), which is scarce on low-end
devices, when CONFIG_USERSPACE=y.

The purpose of this option is to classify the MPU resource intensive
functions as a separate category and only enable them when there is a
demand for such.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-01 11:03:38 +02: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
Anas Nashif 7323038129 tests: tinycrypt: fix test output
This onse single test with multiple dataset was pretending to be
multiple tests with output that is missing and causing confusion when
results get evaluated for example by twister.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-08 09:36:34 +02:00
Anas Nashif 736520a4fe tests: mbedtls: exclude m2gl025_miv
This test just takes forever on this platform. Exclude it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-03-30 21:39:56 -04:00
Flavio Ceolin 890f619936 tests: mbedtls: Fix GCC warning about `test_snprintf`
Fix errors like:

inlined from ‘test_mbedtls’ at
zephyrproject/zephyr/tests/crypto/mbedtls/src/mbedtls.c:172:6:
zephyrproject/zephyr/tests/crypto/mbedtls/src/mbedtls.c:96:17: error:
‘test_snprintf’ reading 10 bytes from a region of size 1
[-Werror=stringop-overread]
   96 |                 test_snprintf(1, "", -1) != 0 ||
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

In GCC >= 11 because `ret_buf` in some calls are shorter literals

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-23 18:14:07 -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
Flavio Ceolin 72bc514f4a tests: crypto: Add test for hashing on crypto driver
Test crypto driver hash capability.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Carles Cufi 4b8f1c04ab kconfig: Rename the ZTEST stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Ederson de Souza 6e8338a5b6 tests/crypto: Don't build tinycrypt tests under XCC
XCC (based on GCC 4.2) doesn't support some asm constraints used by
tinycrypt, so let's not test tinycrypt under XCC.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-21 19:37:54 -05:00
Daniel Leung 8f7f62869a tests: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Anas Nashif d4962db828 tests: m2gl025_miv: exclude slow platform from some tests
This platform is slow on some tests and times out on non-hardware
related tests, so exclude it or increase timeout for some of the tests
to avoid false negatives in the test results due to timeouts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-29 19:39:38 -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
Flavio Ceolin 2bc9059bd2 tests: crypto: Follow changes in mbedTLS 3.0 version
Apply the modifications required by the newer library version.
These modifications came from the original file in the mbedTLS
repository.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-07 14:02:40 -05: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
Jordan Yates fdeaa9103e random: deprecate `XOROSHIRO_RANDOM_GENERATOR`
Deprecate the xoroshiro128+ PRNG algorithm in favour of xoshiro128++.
xoshiro128++ is a drop-in replacement which is invisible from the user
perspective.

xoroshiro128+ is unsuitable because it is explicitly a floating-point
PRNG, not a general-purpose PRNG. This means that the lower 4 bits of
the output are actually linear, not random (from the designers,
https://prng.di.unimi.it/). This means 1/8th of the generated data is
not random.

Additionally, xoroshiro128+ is not a 32bit algorithm, it operates on
64bit numbers. For the vast majority of Zephyr devices, this makes the
PRNG slower than it needs to be. The replacement (xoshiro128++) is
32bit, with no loss in state space (still 128 bit).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-05 11:24:44 +02:00
Jordan Yates 3a204adf7b tests: crypto: rand32: test xoshiro128 impl
Validate the xoshiro128++ implementation against the randomness tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-05 11:24:44 +02:00
Yasushi SHOJI 5e535a8551 tests: crypto: mbedtls: Remove local implementation of rand()
When MBEDTLS_RSA_C is defined, mbedtls define its local version of
rand() function.  Since we already have rand() in our minimal libc, we
can safely remove this.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-07-20 13:32:36 -04:00
Jian Kang e169015c6e tests: crypto: Add a unnormal testing condition
For z_early_boot_rand_get(), give a length less than uint32 to be input
value, ensure the API can work normally with error condition to improve
code coverage.

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2021-03-09 05:10:54 -05:00
Andy Ross 3d81464194 tests: samples: Add targetted platform_excludes for intel_adsp_cavs15
This platform has a tiny handful of remaining tests that fail.  We
will track them as issues, but let's exclude them from integration
testing to allow full runs to complete.  Often a hung device in one
test will break an entire twister run.

Tests with known (and tracked) failures:

  samples/application_development/external_lib
  samples/posix/eventfd
  samples/userspace/hello_world_user
  tests/kernel/fatal/message_capture
  tests/net/socket/socketpair
  tests/portability/cmsis_rtos_v2

These tests never fail in isolated testing, but are reliable timeouts
when run in sequence in a big twister run.  It's possible that the bug
here may be in twister or the flash/serial scripts:

  tests/crypto/tinycrypt
  tests/subsys/logging/log_immediate
  tests/subsys/logging/log_output

See: #32836

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-03-08 19:25:25 -05:00
Eugeniy Paltsev 18081e7f11 tests: tinycrypt: disable for ARC QEMU platforms
Even though ARC QEMU has received advanced multiplication
instructions support recently the ARC QEMU in the latest
Zephyr SDK still misses them, so tinycrypt may execute
too long and reach timeout in case of execution on
slow host.

Disable tinycrypt for ARC QEMU platforms till we update
ARC QEMU in Zephyr SDK.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2021-02-15 08:11:19 -05:00
Adam Jeliński 9919c14175 m2gl025_miv: Double the test timeouts
The `m2gl025_miv` board needs more time to complete these tests with
Renode.

Signed-off-by: Adam Jeliński <ajelinski@antmicro.com>
2021-02-09 19:41:27 -05:00
Martin Åberg c8759ffa01 tests/mbedtls: increase stack size
The testcase allocates lots of stack space, many KiB, for RISC-V
64-bit in the mbedtls bignum functions.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Andrew Boie d650b4e800 ztest: remove ztest_mem_domain
Just add ztest's partition to the default domain, as well as the
malloc partition if it exists.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Daniel Leung 16c4090487 tests: tinycrypt_hmac_prng: exclude MEC1501-based boards
MEC1501 SoC has 256KB of SRAM, but it is split into 224/32KB
for code and data, as each partition is optimized for
the access pattern. There the DTS only specifies 32KB as
data ram. The tinycrypt_hmac_prng test requires 40KB for
ztest stack. This obviously won't fit so exclude the boards
based on MEC1501 from the test.

Fixes #27572

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-20 14:56:10 -04:00
Anas Nashif eee3ffc7b9 tests/samples: enable for integration testing
Limit execution in CI when using --integration option of sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Anas Nashif 6c47f65f0f tests: tinycrypt: do not whitelist
use integration filtering...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00