for DEVICE_PM and DEVICE_PM_RUNTIME, ztest need
hold status like CONFIG_PM, otherwise the following
flash will be blocked for some SOC
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Instead of crashing fail with a message when -test arguments is of
wrong format.
Fixeszephyrproject-rtos/zephyr#91655
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The QEMU RX doesn't allow to write value to IR flag,
There is also mentioned in RX HWM that the IR should
not be write 1 to. So we change the method to trigger
interrupt here is to call directly to SW irq table
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
NATIVE_APPLICATION is deprecated, let's not use it, let's use instead
NATIVE_BUILD.
unit_testing is not really meant to be covered by NATIVE_APPLICATION,
or NATIVE_BUILD for that matter, as these options are meant for POSIX
arch based targets.
Still, some kconfig options will default to something which will
also be incompatible with unit_testing (primarily CONFIG_PICOLIBC=y)
if we don't set at least NATIVE_BUILD, which would cause some unit
tests to fail. So let's select NATIVE_BUILD to avoid needing to add
extra dependencies on the libCs options.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add noncallable printf with string used for ztest assert/assume
macros to ensure printf-like argument validation at compile time.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add trigger_irq() function support for RX
This function will set corresponding IR bit to 1 on RX ICU to
trigger interrupt
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
When CONFIG_ZTEST_FAIL_ON_ASSUME is set, a failed assumption will
cause the suite to fail, but the individual test will be marked as
SKIPPED. We should fail the test so it's clear what's going on.
Fixes#86611
Signed-off-by: Yuval Peress <peress@google.com>
if CONFIG_PM=y, board will enter low power,
which will cause problem for debugger.
So for ztest cases, we need enable this to avoid problem.
This used to apply to soc/platform level, now remove them.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
In order to support new toolchains that are not compatible with
gcc/clang (e.g., IAR), we need to add a level of indirection for
the name of warnings.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
No files use MS_TO_US except tests/kernel/interrupt/src/nested_irq.c.
While the macro is convenient, we should put it in a more central
location and use it everywhere if we want to use it rather than just in
interrupt_util.h. For now, remove it and replace the two usages to match
how code is written in the rest of Zephyr.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
test_main can call ztest_run_all multiple times. For example
tests/bluetooth/host/keys/bt_keys_get_addr/src/main.c does so. If the
first call skips some tests and then they run in the second call,
everything is fine. However if they passed or failed in the first run
and skipped in the second run, then the test output (json, xml, and
printed summary) show the test as skipped even though it ran.
The solution is to not clear the test stats.
__ztest_init_unit_test_result_for_suite was added in commit
996c8457d7 by nashif.
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Ensure all pending log messages are processed by the log processing
thread when log_flush is called, blocking the caller until done.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Allowed toolchains was not set in 'board' metadata causing those to not
build and get filtered.
Fixes#83792
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
CONFIG_TEST_USERSPACE should select CONFIG_USERSPACE as they
should be enabled together. It is no use to enable userspace
tests without enabling userspace.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Obviously, everyone knows that there are 8 bits per byte, so
there isn't a lot of magic happening, per se, but it's also
helpful to clearly denote where the magic number 8 is referring
to the number of bits in a byte.
Occasionally, 8 will refer to a field size or offset in a
structure, MMR, or word. Occasionally, the number 8 will refer
to the number of bytes in a 64-bit value (which should probably
be replaced with `sizeof(uint64_t)`).
For converting bits to bytes, or vice-versa, let's use
`BITS_PER_BYTE` for clarity (or other appropriate `BITS_PER_*`
macros).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The ztest.c calls atoi, which is provided by the C standard library.
Remove the conditional inclusion of the C standard library with the
definition of CONFIG_ZTEST_SHUFFLE.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Add the missing #ifndef CONFIG_ZTEST_SHUFFLE in ztest.c file.
This fixes multiple definitions of NUM_ITER_PER_SUITE
and NUM_ITER_PER_TEST.
Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
Expanding the ZTEST shell to include a command that
accepts additional parameters, such as ztest run_testcase
<suite:test> -p any_value.
Adding the new ZTEST_P macro, to create the
parameterized test.
Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
Expand ztest_shell subcommands `run-testcase`
and `run-testsuite` to include additional parameter `-r`
repeat-iter. This allows to run a particular testcase or
testsuite several times.
Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
It should have reffered to the architecture,
not one of its board's name.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Replace `shell_fprintf(sh, SHELL_ERROR, ...)` with
`shell_error(sh, ...)` since it brings the same underlying
action with less typing.
Note: `shell_error` already concatenates `\n` to format strings,
so we remove `\n` from the original code.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in `subsys/testsuite/ztest/src/ztest.c` file.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
On ARM64 the build will fail with coverage and GCOV enabled:
CONFIG_COVERAGE=y
CONFIG_COVERAGE_GCOV=y
CONFIG_FORCE_COVERAGE=y
west build -b rpi_5 -p always samples/hello_world -- \
-DCONFIG_COVERAGE=y -DCONFIG_FORCE_COVERAGE=y
Failure:
"linker_zephyr_pre0.cmd:181: undefined symbol `__gcov_bss_end' referenced
in expression"
Fix build of ARM64 platforms with coverage and GCOV enabled by adding for
ARM64 the same gcov linker sections as it is done for ARM.
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Undefine _POSIX_C_SOURCE before defining it to avoid double
definition
The previous version, changed in this PR
https://github.com/zephyrproject-rtos/zephyr/pull/70363, did the undef.
Make sure to do the same for all files in the current dir.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The testsuite subsystem provides the macro PRINT_DATA() which can be
overridden using CONFIG_ZTEST_TC_UTIL_USER_OVERRIDE. Switch all calls of
PRINT() to PRINT_DATA withing the testsuite subsystem.
Signed-off-by: Keith Short <keithshort@google.com>
Allow to run with timer random generator which does not need any
entropy device.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
number of counters have changed in gcc 14 by commit
https://github.com/gcc-mirror/gcc/commit/08a52331803
Specifically, a new counter was added in gcc/gcov-counter.def:
```
/* Conditions. The counter is interpreted as a bit-set. */
DEF_GCOV_COUNTER(GCOV_COUNTER_CONDS, "conditions", _ior)
```
which in turn updates the value of GCOV_COUNTERS that is defined in
gcov-io.h like this:
```
enum {
GCOV_COUNTERS
};
```
Signed-off-by: Roman Studenikin <srv@meta.com>
Fix compilation error implicit declaration of function 'free'
in case of `CONFIG_NEWLIB_LIBC`.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Many ztest macros were not indexed correctly as part of the ztest_test
group, for example ZTEST_SUITE was completely missing in the
documentation.
In addition, document a few macros that did not have any documentation.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>