Commit graph

2758 commits

Author SHA1 Message Date
S Swetha
cbc5fdbb4b tests: kernel: spinlock: Increase lock contention
This commit resolves lock contention
issues by increasing the probablity of
contention during the test execution.

Increased wait delay when lock is taken
and Reduced wait delay when the lock is
released.

Achieved 99% lock contention probablity,
verified through runtime metrices.

Signed-off-by: S Swetha <s.swetha@intel.com>
2025-04-24 01:27:00 +02:00
Anas Nashif
e5f841c183 tests: kernel/arch: various doxygen fixes
Group test using doxygen and other doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
feaf9893cc tests: fatal: group fatal tests
Group test using doxygen.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
a816bfdfec test: kenrel: group sleep tests
Group test using doxygen.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
39b1312392 tests: kernel: mbox: fix doxygen grouping
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
70b2b952db tests: events: fix doxygen groups
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
bb8b76094f tests: semaphore: fix doxygen groups
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
4ca7c14eab tests: kernel: fix doxygen comments/groups for condition variables
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
7b3ed2fbb4 tests: kernel/common: cleanup doxygen
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
7d36a18b7b tests: kernel: fix kheap doxygen groups
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Anas Nashif
d837b644dd tests: kernel: threads: improve doxygen comments, layout
Fix grouping and general doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Nicolas Pitre
e29c0c1783 tests: poll: add pipe coverage
Add pipe test coverage.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-04-21 07:45:35 +02:00
Dmitrii Golovanov
411140d015 tests: kernel: mslab: extend k_mem_slab_alloc() timeout
Extend timeout on k_mem_slab_alloc() for kernel.memory_slabs
memory_slab_1cpu.mslab test suite as a workaround to allow its run
on slow platforms, e.g. simulated intel_ish_5_8_0.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2025-04-18 10:40:50 +02:00
Keith Packard
db49cd3899 tests/kernel: Validate constructor execution order
Check the order of constructors, making sure those with a specified
priority are called in numeric order after which those without priority are
called.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-04-16 20:36:27 +02:00
Huaqi Fang
86293ebe11 tests: kernel: gen_isr_table: Fix irq tests for rv64 targets
The element in _irq_vector_table is 64bit for 64bit cpu,
and 32bit for 32bit cpu

Signed-off-by: Huaqi Fang <578567190@qq.com>
2025-04-16 08:10:47 +02:00
Krzysztof Chruściński
5f55fed4bb kernel: timeout: z_add_timeout to return expiration tick
Add return value to z_add_timeout. It returns system tick when timeout
will expire.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-15 19:09:33 +02:00
Daniel Leung
781011b911 tests: kernel/pending: fix incorrect test names
These tests should be named "kernel.pending" instead of
"kernel.objects".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-12 00:02:59 +02:00
Jordan Yates
7a6f0a4928 tests: timer: validate K_TIMEOUT_ABS_SEC
Validate that `K_TIMEOUT_ABS_SEC` works the same way as the other
absolute timeout construction macros.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-07 07:28:00 +02:00
Jun Lin
5e54a64060 tests: kernel/sleep: exclude npcx platforms from the test
According the specification, in extreme cases, the deviation of the APB
clock and LFCLK clock can reach up to +/-1% (+/- 10ms).
Therefore, exclude npcx platforms from the test because it required 1ms
accuracy.

fixes: #66185

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-04-04 07:42:30 +02:00
Amneesh Singh
932953d2e6 tests: float_disable: honor custom ARM interrupt controllers
This patch allows checking for any custom ARM interrupt controller to get a
non-enabled IRQ line instead of assuming that GIC is enabled

Signed-off-by: Amneesh Singh <a-singh7@ti.com>
2025-03-31 08:06:36 +02:00
Anas Nashif
37c4631a0b tests: remove various filters due to bugs/issue that were fixed
Some platforms were excluded due to issues that were fixed or resolved
themselves. Enable those platforms again and remove the comments related
to the issues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-28 21:52:13 +01:00
Krzysztof Chruściński
5cbae7f2b6 tests: kernel: tickless: tickless_concept: Support more frequencies
Test was assuming that CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 but such
frequency is not well supported on SoC which are based on 32768 Hz RTC
clock. Align test to be able to work with different sys_clock
frequency by converting previously 20 ticks to milliseconds.

Set CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768 when system clock is using
Nordic RTC timer driver.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-03-28 16:10:51 +01:00
Anisetti Avinash Krishna
98dba7da7c include: zephyr: sys: time_units: Type cast SYS_CLOCK_HW_CYCLES_PER_SEC
Type case CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to uint32_t
while defining sys_clock_hw_cycles_per_sec_runtime_get()
to extend the range of frequency to 0xffffffff.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2025-03-28 12:21:07 +01:00
Josh DeWitt
c05cfbf15e kernel/sched: Re-sort waitq on priority change
k_thread_priority_set() on a pended thread wasn't re-inserting into the
waitq, causing the incorrect thread to run based on priority. When using
the scalable waitq config, this can also break assumptions of the tree
and leave the owner of a waitq still being in the waitq tree, cycles in
the tree, or a crash.

Remove and re-add a thread to a waitq to ensure the waitq remains in
order and the tree's assumptions are not violated.

To illustrate the issue, consider 4 threads in decreasing priority
order: A, B, C, and D along with two mutexes, m0 and m1. This is
implemented in the new complex_inversion mutex_api test.
1. D locks m1
2. C locks m0
3. C pends on m1
4. B pends on m1
5. A pends on m0, boosts C's priority, now tree on m1 is not sorted
6. D unlocks m1, left-most thread on tree is B. When removing B from
   tree it cannot be found because it searches to the right of C due to
   C's boosted priority when the node is actually on the left. rb_remove
   silently fails.
7. B unlocks m1, left-most thread on tree is still B and it tries to
   unpend itself, resulting in a NULL pointer dereference on
   B->base.pended_on.

Signed-off-by: Josh DeWitt <josh.dewitt@garmin.com>
2025-03-24 07:58:36 +01:00
Anas Nashif
56f7dc4c2e scripts: make sure we do not install vulunerable python packages
Make sure we install packages with no issues, some of the issues being
reporting on packages we might install using pip:

Warn: Project is vulnerable to: PYSEC-2019-41 / GHSA-qfc5-mcwq-26q8
Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc
Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56
Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h
Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg
Warn: Project is vulnerable to: PYSEC-2017-74
Warn: Project is vulnerable to: GHSA-55x5-fj6c-h6m8
Warn: Project is vulnerable to: PYSEC-2014-9 / GHSA-57qw-cc2g-pv5p
Warn: Project is vulnerable to: PYSEC-2021-19 / GHSA-jq4v-f5q6-mjqq
Warn: Project is vulnerable to: GHSA-pgww-xf46-h92r
Warn: Project is vulnerable to: PYSEC-2022-230 / GHSA-wrxv-2j5q-m38w
Warn: Project is vulnerable to: PYSEC-2018-12 / GHSA-xp26-p53h-6h2p
Warn: Project is vulnerable to: PYSEC-2024-4 / GHSA-2mqj-m65w-jghx
Warn: Project is vulnerable to: PYSEC-2023-165 / GHSA-cwvm-v4w8-q58c
Warn: Project is vulnerable to: PYSEC-2022-42992 / GHSA-hcpj-qp55-gfph
Warn: Project is vulnerable to: PYSEC-2023-137 / GHSA-pr76-5cm5-w9cj
Warn: Project is vulnerable to: PYSEC-2023-161 / GHSA-wfm5-v35h-vwf4
Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq
Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3
Warn: Project is vulnerable to: GHSA-56pw-mpj4-fxww
Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr
Warn: Project is vulnerable to: PYSEC-2023-175
Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h
Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6
Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf
Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc
Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f
Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm
Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52
Warn: Project is vulnerable to: GHSA-c6fm-rgw4-8q73

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-22 14:03:56 -04:00
Tom Hughes
15411747e7 everywhere: Use correct macro for gcc-specific warnings
Many warnings were disabled for all compilers, even though they are
gcc-specific warnings. Now that clang has -Wunknown-warning-option
enabled, this can cause compilation failures when building with clang
toolchains.

Use TOOLCHAIN_DISABLE_GCC_WARNING for all gcc-specific macros.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
https://clang.llvm.org/docs/DiagnosticsReference.html

Fixes: #84138

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-03-20 21:57:47 +01:00
Tom Hughes
11d70c61e5 everywhere: Replace diagnostic pragmas with TOOLCHAIN_* macros
The TOOLCHAIN_DISABLE_WARNING/TOOLCHAIN_ENABLE_WARNING macros are easier
to read and compiler agnostic.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-03-20 21:57:47 +01:00
Martin Hoff
eeb709927f tests: drivers: add overlay/testcase for silabs xg29_rb4412a board
Add some overlay files for the silabs xg29_rb4412a board to enable tests
on the board. Also add the platform to some testcase.yaml files.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-03-20 17:14:35 +01:00
Josh DeWitt
0ae0c3dc44 linker: Allow for 999 priority levels in init levels
Some projects may have needs for more than 99 priority levels, so add
a third linker input section for each obj level.

Signed-off-by: Josh DeWitt <josh.dewitt@garmin.com>
2025-03-19 18:53:22 -04:00
Josh DeWitt
da867dbcfc tests: Ensure the maximum expected SYS init priority works
Add a test to ensure that the max expected 2-digit SYS init priority
works.

Signed-off-by: Josh DeWitt <josh.dewitt@garmin.com>
2025-03-19 18:53:22 -04:00
Aksel Skauge Mellbye
4d6efb2302 tests: kernel: sleep: Add Silabs adjustment to max limit
Several devices have hardware-specific additional limits for
how short a sleep cycle can be. Add an entry for devices based
on Silabs sleeptimer when the OS tick rate is equal to the timer
frequency.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-18 16:42:42 +01:00
Emil Gydesen
fadaae42f0 Revert "tests: kernel: adopt new count_bits util function"
This reverts commit e34270519e.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-18 16:39:47 +01:00
Benjamin Cabé
e34270519e tests: kernel: adopt new count_bits util function
Adopt new count_bits helper from util.h and avoid
having conflicting definition

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-03-18 08:24:16 +01:00
Anas Nashif
f29ae72d79 kernel: rename 'dumb' scheduler and simply call it 'simple'
Improve naming of the scheduler and call it what it is: simple. Using
'dumb' for the default scheduler algorithm in Zephyr is a bad idea.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-15 00:34:58 +01:00
Daniel Leung
1530e86877 tests: kernel/pipe_api: move local k_pipe var to global
When CONFIG_KERNEL_COHERENCE is enabled, pend_locked() asserts
when wait_q is not in coherent memory. The k_pipes used in
the pipe_api tests are declared locally within the test. They
are located within the thread stacks and those wait_q inside
k_pipe struct are thus not considered in coherent memory.
To make them work, replace the local ones with a global
k_pipe object. Since each test initializes the pipe object
locally, the tests are not functionally changed.

Fixes #84235

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-03-14 17:55:50 +01:00
Alberto Escolar Piedras
56fdebe933 tests/kernel/context: Remove BOARD_NATIVE_POSIX check
native_posix has been removed. There is no need to check for it
anymore.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-12 02:27:36 +01:00
Peter Mitsis
abb5f11134 tests: Update ipi_optimize for x86_64 directed IPIs
Updates the ipi_optimize test to use 4 CPUs for qemu_x86_64.
This provides enough CPUs for the test to verify the recently
added directed IPI support for x86_64.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-03-07 20:22:40 +01:00
Lars-Ove Karlsson
aad6b6c33e tests: kernel: Fixed disabling of __deprecated macros
When disabling the __deprecated macros in tests/kernel/pipe/deprecated,
the macros was set to ''. For IAR tools this was expanded to '' which
caused a compilation error.

I have replaced them with /* deprecated */ which should work for all
toolchains.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-03-07 19:53:17 +01:00
Andy Ross
706dd25561 tests/kernel/thread_apis: Fix essential thread abort test
This test was buggy.  The first call to k_thread_abort() would
terminate the calling thread (because it handled a panic!) and so the
second case (an essential thread self-aborting) wasn't actually being
exercised and was silently "passing".  Oops.

Fix by splitting the cases into two tests, as suggested by @fsammoura

But unmasking that shows that there are some arch buglets[1] to fix
before this case can pass for everyone.  So skip on x86/riscv/sparc
for now.

[1] See the comment.  It's not really a "bug" as we've never demanded
that arch layers do this.  But it does work on many of them.

Signed-off-by: Andy Ross <andyross@google.com>
2025-02-26 10:10:29 +00:00
Krzysztof Chruściński
9323adf4af tests: kernel: usage: thread_runtime_stats: Improve test_all_stats_usage
Improve robustness of test_all_stats_usage test. Test was relying on a
fact that system did not go to idle before this test is run. It means
that it was assuming that it will be the first test which might not be
true. Additionally, on some targets there might be some idle waits
during system boot. Test is adjusted to validate gathered statistics
with an assumption that there might have been idle period prior to the
test.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-02-25 15:14:33 +00:00
Tom Hughes
74f6f7f94c tests: kernel: interrupt: Remove MS_TO_US
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>
2025-02-20 06:05:37 +01:00
Yong Cong Sin
b2b2963e6a irq: multilevel: compile 3rd level IRQ APIs only when enabled
This revert the idea of 3fa7d78 from #78845.

The 3rd level IRQ APIs won't compile when
CONFIG_3RD_LEVEL_INTERRUPT_BITS=0.

Updated testcases accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-02-19 14:49:27 +00:00
Robin Kastberg
9ab06ec667 toolchain: iar: Add experimental IAR support
This adds experimental support for the IAR toolchain.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-14 19:12:44 +00:00
Adam Kondraciuk
85282d604c tests: kernel: gen_isr_table: Fix kernel test for nRF FLPR target
Fix kernel `gen_isr_table` test for nRF FLPR target similairly
to PPR target.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-02-14 00:46:35 +01:00
Emanuele Di Santo
5c2c354f73 tests: kernel: gen_isr_table: update test for nRF91x1 devices
Limit the number of IRQ for all series nRF91 devices,
including nRF9161 and nRF9151.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2025-02-14 00:46:19 +01:00
Gerard Marull-Paretas
71d663dafc tests: kernel: gen_isr_table: exclude nrf9280pdk/nrf9280/cpuppr
First, SoC is not supported, but when I tried to add it, build results
in RAM overflow of ~10K. Excluding the platform for now, so CI is happy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2025-02-13 20:21:51 +01:00
Jonathon Penix
0bb7849aec tests: gen_isr_table: filter *arm_mainline test on *_M_MAINLINE config
Since it was added, `arch.interrupt.gen_isr_table_local.arm_mainline`
filters on `CONFIG_ARMV6_M_ARMV8_M_BASELINE`. I'm not entirely sure whether
this was intentional, but this seems odd to me given a) the naming of the
test b) that the `platform_allow` is `qemu_cortex_m3` and c) that the
`arch.interrupt.gen_isr_table.arm_mainline` test it inherits part of its
config from filters on `CONFIG_ARMV7_M_ARMV8_M_MAINLINE`.

The current filtering setup also means that a command like
`west twister -c -T tests/kernel/gen_isr_table/` currently filters out all
of the `*gen_isr_table_local*` tests which was a surprise to me when
testing locally (no tests broke for a change I made as they were
all filtered out).

Assuming this is undesireable, change the filter to check against
`CONFIG_ARMV7_M_ARMV8_M_MAINLINE` to make it possible to run the tests
on the expected platform without needing to work around the filter.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2025-02-13 16:42:08 +01:00
Tom Hughes
c586962b56 tests: kernel: gen_isr_table: Re-enable warning
This warning doesn't appear to be needed anymore and CI passes with it
removed.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-13 01:13:47 +01:00
Jonathon Penix
dad2d65cfa sw_isr_table: Force align _isr_list_sname instances
For some target and optimization level combinations (aarch64 and -O2, for
example), GCC will over align _isr_list_sname instances. The local isr
declaration parser doesn't expect the extra padding that may be introduced
and will produce unexpected errors about bad IRQs (`error: IRQ 1903323438
(offset=0) exceeds the maximum of 42`, for example). Prevent this issue by
forcing the expected alignment of _isr_list_sname.

Fixes #81254

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2025-02-11 00:43:55 +01:00
Andy Ross
cc411ffe69 tests/kernel/threads: Correct essential thread abort test
Thread abort of essential threads had a buglet where the panic would
be signaled but, if caught by k_sys_fatal_error_handler(), the thread
would not actually be aborted.  This test wasn't validating that the
thread was actually dead (in fac, it RELIED on the thread to signal a
semaphore after its "abort"!).

Make sure it's dead and that the panic is caught.  Also add a case for
aborting _current which is a separate code path that needs coverage.

Signed-off-by: Andy Ross <andyross@google.com>
2025-02-10 22:26:10 +01:00