Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.
Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.
Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
In some platforms the size of size_t can be different of 4 bytes. Use
sys_rand_get to proper fill this variable.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.
The refactoring strategy used in this commit is detailed in the issue
This commit introduces the following major changes:
1. Establish a clear boundary between private and public headers by
removing "kernel/include" and "arch/*/include" from the global
include paths. Ideally, only kernel/ and arch/*/ source files should
reference the headers in these directories. If these headers must be
used by a component, these include paths shall be manually added to
the CMakeLists.txt file of the component. This is intended to
discourage applications from including private kernel and arch
headers either knowingly and unknowingly.
- kernel/include/ (PRIVATE)
This directory contains the private headers that provide private
kernel definitions which should not be visible outside the kernel
and arch source code. All public kernel definitions must be added
to an appropriate header located under include/.
- arch/*/include/ (PRIVATE)
This directory contains the private headers that provide private
architecture-specific definitions which should not be visible
outside the arch and kernel source code. All public architecture-
specific definitions must be added to an appropriate header located
under include/arch/*/.
- include/ AND include/sys/ (PUBLIC)
This directory contains the public headers that provide public
kernel definitions which can be referenced by both kernel and
application code.
- include/arch/*/ (PUBLIC)
This directory contains the public headers that provide public
architecture-specific definitions which can be referenced by both
kernel and application code.
2. Split arch_interface.h into "kernel-to-arch interface" and "public
arch interface" divisions.
- kernel/include/kernel_arch_interface.h
* provides private "kernel-to-arch interface" definition.
* includes arch/*/include/kernel_arch_func.h to ensure that the
interface function implementations are always available.
* includes sys/arch_interface.h so that public arch interface
definitions are automatically included when including this file.
- arch/*/include/kernel_arch_func.h
* provides architecture-specific "kernel-to-arch interface"
implementation.
* only the functions that will be used in kernel and arch source
files are defined here.
- include/sys/arch_interface.h
* provides "public arch interface" definition.
* includes include/arch/arch_inlines.h to ensure that the
architecture-specific public inline interface function
implementations are always available.
- include/arch/arch_inlines.h
* includes architecture-specific arch_inlines.h in
include/arch/*/arch_inline.h.
- include/arch/*/arch_inline.h
* provides architecture-specific "public arch interface" inline
function implementation.
* supersedes include/sys/arch_inline.h.
3. Refactor kernel and the existing architecture implementations.
- Remove circular dependency of kernel and arch headers. The
following general rules should be observed:
* Never include any private headers from public headers
* Never include kernel_internal.h in kernel_arch_data.h
* Always include kernel_arch_data.h from kernel_arch_func.h
* Never include kernel.h from kernel_struct.h either directly or
indirectly. Only add the kernel structures that must be referenced
from public arch headers in this file.
- Relocate syscall_handler.h to include/ so it can be used in the
public code. This is necessary because many user-mode public codes
reference the functions defined in this header.
- Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
necessary to provide architecture-specific thread definition for
'struct k_thread' in kernel.h.
- Remove any private header dependencies from public headers using
the following methods:
* If dependency is not required, simply omit
* If dependency is required,
- Relocate a portion of the required dependencies from the
private header to an appropriate public header OR
- Relocate the required private header to make it public.
This commit supersedes #20047, addresses #19666, and fixes#3056.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Updated tests/crypto/rand32/ to include cryptographic test cases.
Added config file for rand32_ctr_drbg generator.
Signed-off-by: David Leach <david.leach@nxp.com>
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.
() Removes the x86_64:x32 architecture and SoC, and replaces
them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The build scripts for the tests/crypto/rand32 test has been invoking
'zephyr_include_directories' in an invalid way. They have presumably
been trying to modify the 'app' library, but have in effect being
modifying the global environment, in an invalid way nonetheless.
This patch fixes the build script to modify the 'app' library only.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Some test cases have the same test case name.
To get rid of it, I decided to change test cases names
contained same names.
Please check my logic, how I give them names.
Usually trying to give name same as a directory folder.
There are still more test cases which necessary to change,
but I will make changes by small steps.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
Move tinycrypt related header into test and make those tests only build
on native_posix. The tests are unit tests, ie. testing tinycrypt
functionality only without any dependency on the underlying system.
Long term we should move those to be true unit tests and create
functional and integration tests that use tinycrypt in the context of
Zephyr and for real use-cases.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move duplicate hex2bin and add bin2hex function so that application can
use the functions and avoid code duplication.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It exists only if MBEDTLS_PLATFORM_PRINTF_ALT is defined, whcih we
no longer do, but make the call condiitonal in case we'll need to
make it configurable later.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Use the improved HMAC_PRNG test from TinyCrypt version 0.2.8,
(commit 6e0eb53fc8403988f97345e94081b0453f47231d),
that was imported into Zephyr in
commit 06d0b6a694.
Rewrote part of the test code to use the ztest asserts and
test_utils.h functionality.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.
Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.
This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.
tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.
Fixes: #15103 (and probably others)
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This lets us quickly filter tests that exercise userspace
when developing it.
Some tests had a whitelist with qemu_cortex_m3; change
this to mps2_an385, which is the QEMU target with an
MPU enabled.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The mbedtls library has some globals which results in faults
when user mode tries to access them.
Instantiate a memory partition for mbedtls's globals.
The linker will place all globals found by building this
library into this partition.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We were reporting results twice, something that might confuse test
systems and end up reporting wrong results. Assert if any self-tests
have failed and report at the very end.
Disable test on x86_64.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The intent of this Kconfig is to allow libc stdout
functions like printf() to send their output to the
active console driver instead of discarding it.
This somehow evolved into preferring to use
printf() instead of printk() for all test case output
if enabled. Libc printf() implementation for both
minimal libc and newlib use considerably more stack
space than printk(), with nothing gained by using
them.
Remove all instances where we are conditionally
sending test case output based on this config, enable
it by default, and adjust a few tests that disabled
this because they were blowing stack.
printk() and vprintk() now work as expected for
unit_testing targets, they are just wrappers for
host printf().
Fixes: #13701
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Move to latest cmake version with many bug fixes and enhancements.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This test can be on the boarder line with systems that only have 128K of
flash. Limit it systems with more for now.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.
Found using Coccinelle.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.
This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.
Signed-off-by: Reto Schneider <code@reto-schneider.ch>
After merging tinycrypt testcases, we left the original identifier, this
is not called crypto.tinycrypt.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.
The only directory excluded directory was ext/* since it contains
only imported code.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The result of both printk and vprintk are not used in any place.
MISRA-C says that the return of every non void function must be
checked.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Put all tinycrypt tests into one project. Having project for every small
feature does not scale and slows down testing and CI operations.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
While it's possible to define which mbedTLS config header to use, our
samples should use config-tls-generic.h as default because this header
is configurable through Kconfig.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Add the missing sha256 crytographic algorithm testcase for
execution via ztest. The sub test case was not getting executed
as it was missed to be added in ztest suite.
Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.
Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.
To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.
This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.
The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Input length was accounting TC_AES_BLOCK_SIZE twice and consequently
not considering the whole cipher.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Add test for z_early_boot_rand32_get() API.
This also improves the coverage for kernel/init.c
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Introduce TC_RESULT_TO_STR to convert from an integer test result to a
string like "PASS", "FAIL", "SKIP". Do this to remove the defines of
PASS/FAIL/SKIP since those names might get used by other code and to
have a single consistent way of doing the conversion.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When adding the nRF52810, which has 24KB of RAM, some of the tests don't
compile anymore due to lack of SRAM. Address this by either filtering
the test out or reducing the amount of memory allocation.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This redirects PRINT() to printf() and not printk() and
was causing stack overflows on some platforms.
Fixes: #8033
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
These tests have an enormous stack which can be troublesome
to align on MPU-based systems; just disable user mode on
them.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Following tests were failing on a microcontroller with 32KB flash:
benchmark.application
crypto.ecc_dh
crypto.ecc_dsa
test_build_ethernet
test_build_sensors_a_m
The min_flash option has been added in the test case yaml files.
Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
This test validates random number generator APIs that
is not related to kernel and should not be part of
kernel tests.
Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>