Commit graph

2670 commits

Author SHA1 Message Date
Peter Mitsis
94829f444c tests: Initialize array in pipe test
As the pointer to the data buffer passed to k_pipe_put() is now a
'const', that buffer must be initialized before calling k_pipe_put()
to avoid a compiler warning.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-15 14:51:35 -05:00
Anas Nashif
11365fc4f8 tests: move shared_multi_heap to tests/lib
Move shared_multi_heap test under lib alongside all other heap tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif
dd2dcbed54 tests: move mheap_api_concept into tests/lib/multi_heap
Move multi-heap tests out of kernel folder along side all other heap
related tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Daniel Leung
8bf20ee975 xtensa: mmu: rename prefix z_xtensa to xtensa_mmu
This follows the idea to remove any z_ prefix. Since MMU has
a large number of these, separate out these changes into one
commit to ease review effort.

Since these are no longer have z_, these need proper doxygen
doc. So add them too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Tomasz Bursztyka
dc49dad7e0 tests/kernel: Exlude bogus platforms on cache test
Until these get fixed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-12-12 19:11:13 +01:00
Tomasz Bursztyka
a2be813d99 tests/kernel: Add qemu_x86/x86_64 to cache test and enable cache
How cache test could be ran without CONFIG_CACHE_MANAGEMENT?

Adding qemu_x86/x86_64 as cache related API in x86 has proven to be
very brittle against changes recently: no test was at least verifying
it builds properly, not to mention running it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-12-12 19:11:13 +01:00
Andrei Emeltchenko
effca0609d tests: fatal: Add message explaining OOPS
Add message explaining the cause of the OOPS like it is done in many
other cases.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-11 09:56:33 +01:00
Yong Cong Sin
2e37da45e5 tests: interrupt: sw_isr_table: fix index test for n+1 instance
The index test did not account for the level 2 table offset
when testing the (n + 1) instance, fix that.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin
7934a47332 tests: interrupt: sw_isr_table: use devicetree/Kconfig as ground truth
Updated the tests to use info from the devicetree or Kconfig as
ground truth and compare that with the output from the
functions under test.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin
f3da086ac3 arch: common: sw_isr: make sure that the table index is within range
Assert that the `local_irq` of each levels should only ranges
from `0` to `CONFIG_MAX_IRQ_PER_AGGREGATOR`, so that it doesn't
overflow the other aggregators.

Also, assert that the output of `z_get_sw_isr_table_idx` shouldn't
overflow the ISR table.

Update the `sw_isr_table` tests to test the range of
`CONFIG_MAX_IRQ_PER_AGGREGATOR` instead of the entire range of
level bits.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin
a28da922db tests: interrupt: refactor the sw_isr_irq_parent_table tests
Split the `sw_isr_irq_parent_table` test into one that tests
the IRQ table index function which is generic and should
always be tested, and one that tests multi-instance -related
functions which only work in interrupt controller drivers that
has multi-instance implementation.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Andrei Emeltchenko
3879b02550 tests: threads: Remove unneeded option
This option (CONFIG_HEAP_MEM_POOL_SIZE) is not used for the tests.
Moreover it overrides the option, specified in the board's Kconfigs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-06 09:18:14 +00:00
Manuel Argüelles
006ee60afc tests: kernel: skip kernel.common.stack_sentinel for hifive1
Test consistently fails with timeout for board `hifive1`, so exclude
this board until fixed.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-05 16:20:10 -06:00
Manuel Argüelles
0b32004c09 tests: userspace: exclude ucans32k1sic due to lack of MPU regions
This board have an NXP MPU with 8 configurable regions, of which five
of them are already used by the static MPU configuration. Many of
these tests are failing due to lack of MPU regions or free partition
slots available, even when HW stack protection is disabled when
building with userspace support.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-05 16:20:10 -06:00
Keith Packard
d70e8d5a8f tests/thread_apis: Allow 20µs slop in k_busy_wait test
When testing k_busy_wait(100), don't require that at least 100µs of CPU
time be consumed by the thread itself; some of that time may be used
elsewhere in the system. Instead, just make sure that at least 80µs is
accounted to the thread and allow 20µs to get used elsewhere.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-12-05 09:24:28 +01:00
Kamil Paszkiet
3754a4b315 tests/kernel/timer/timer_behavior: Add possibility to set ip address
added ip address parameter for saleae_logic2.py

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2023-12-01 10:53:51 +00:00
Alberto Escolar Piedras
7a778ebc2d tests/kernel/*: Switch integration platform to native_sim
Swith integration_platforms from native_posix(_64)
to native_sim(_64).
And replace it also in a comment.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras
700a251366 tests/kernel/sched/schedule_api: Replace delay with Z_SPIN_DELAY()
This macro was introduced for this purpose

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras
fbf1c19bd6 tests/kernel/common: Enable errno test on native_sim
Enable this test also on native_sim when not using the host
C library

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Henrik Brix Andersen
67ec329a70 tests: kernel: mem_protect: mem_map: fix wrong include
This test needs to include zephyr/kernel/mm/demand_paging.h, not
zephyr/kernel/mm.h, due to its use of k_mem_pin().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-23 15:17:44 +01:00
Daniel Leung
40ba4015e3 kernel: mm: only include demand_paging.h if needed
This moves including of demand_paging.h out of kernel/mm.h,
so that users of demand paging APIs must include the header
explicitly. Since the main user is kernel itself, we can be
more discipline about header inclusion.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-11-23 10:01:45 +01:00
Keith Packard
aedefd41d7 tests/kernel/mem_protect/mem_map: Reduce printf size for qemu_x86_tiny
qemu_x86_tiny has very limited memory resources; if too much text is
included in this test, it will not have enough remaining memory to run
it.

When using picolibc before 1.8.5, the only way to get 'long long' support
was to use the full version, including floating point support. This is too
large for this testcase.

Reduce the size of the printf code by switching to the version without
64-bit integer support. This allows the test to pass when using older
picolibc versions, such as that included with SDK version 0.16.3.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-11-21 21:43:33 +01:00
Daniel Leung
6c6894c8d8 tests: mem_protect: enable for Xtensa
This enables tests/kernel/mem_protect/mem_protect to be tested
on Xtensa.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-11-21 15:49:48 +01:00
Flavio Ceolin
be5eccdd15 tests: userspace: Add xtensa support
This test requires architecture specific code to work.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-11-21 15:49:48 +01:00
Keith Packard
d04c834c0f tests/kernel: Fix test printk output for new printf variants
In minimal mode, format modifiers are not supported, leading to a lack
of width and precision support.

long long values are presented correctly in either long long or floating
mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-11-20 06:07:58 -05:00
Daniel Leung
c972ef1a0f kernel: mm: move kernel mm functions under kernel includes
This moves the k_* memory management functions from sys/ into
kernel/ includes, as there are kernel public APIs. The z_*
functions are further separated into the kernel internal
header directory.

Also made a quick change to doxygen to group sys_mem_* into
the OS Memory Management group so they will appear in doc.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-11-20 09:19:14 +01:00
Jun Lin
317d070222 tests: timer_behavior: increase stdev tolerance for npcx timer
Change the stdev tolerance stdev from 10 to 33 when npcx timer is used.
This is because the clock source of npcx event timer, which is used to
generate the timeout interrupt, is running at 32.768 KHz.
(i.e. 1 count = ~30.5 us.) The conversion from the absolute system timer
to the event timer count might have -30.5 ~ 30.5 deviation.
The tolerance setting is under the assumption that test sampes are
evenly located at 1030.5 and 969.5 for the worst case.

Fixes #59594

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-11-17 17:24:14 +00:00
Greter Raffael
8ed4876bed tests: kernel: also move the test_isr_dynamic to new ztest API
`test_isr_dynamic` for `CONFIG_GEN_SW_ISR_TABLE=n` was somehow
overlooked in commit b7f1e98724.

I'm disabling the irq at the end of the test. The babblesim for the
`nrf5340bsim_*` target walked into a timeout otherwise.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2023-11-15 10:01:22 +01:00
Yong Cong Sin
ec93404a26 arch: common: irq: relocate internal functions into a private header
Relocate new and existing internal software-managed table
access functions from the public `sw_isr_table.h` into a
private header that should only be accessed internally.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-09 11:20:42 +01:00
Yong Cong Sin
ad788a335f tests: interrupt: add testcase for functions in the sw_isr_table
Validate the following functions in the sw_isr_table:
- z_get_sw_isr_table_idx
- z_get_sw_isr_device_from_irq
- z_get_sw_isr_irq_from_device

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-09 11:20:42 +01:00
Evgeniy Paltsev
c5cd886518 test: spinlock: cleanup assertion
Don't double check on assertion condition.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-11-06 15:44:34 -06:00
Francois Ramu
0dcaa4c668 boards: arm: stm32f746 with all mpu regions when testing in userspace
Disable the  quadspi mpu region of the nucleo_f746zg
when testing the samples/userspace/shared_mem
or tests/kernel/mem_protect/userspace
The stm32f7 cortex M7 has 8 MPU regions and the one for quadspi prevents
the testcase to PASS.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-11-06 12:32:08 +01:00
Andrei Emeltchenko
fa6c281d82 tests: thread_apis: Change printk and TC_PRINT to LOG
Replace combination of printk() and TC_PRINT() to LOG_DBG() disabled
by default so that it does not affect execution time.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-06 10:08:27 +01:00
Andrei Emeltchenko
84317da082 tests: thread_apis: Make local functions static
Most of the local functions are static, make code consistent by making
remaining functions static as well.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-06 10:08:27 +01:00
Andrei Emeltchenko
a6da17aab4 tests: k_mbox: Change ZTEST_USER to ZTEST
Since userspace is not enabled change ZTEST_USER to ZTEST to not
confuse people, other tests are also ZTEST.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-05 07:51:59 -05:00
Andrei Emeltchenko
6247dddcb5 tests: k_mbox: Remove unneeded k_sleep()
The test_multi_thread_send_get() test sends and receives mbox messages
with K_FOREVER as timeout, so k_sleep() is not needed here.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-05 07:51:59 -05:00
Andrei Emeltchenko
6308528e5b tests: k_mbox: Simplify code and check return code
k_mbox_get() / k_mbox_put() get timeout as is, so there is no need for
extra code. Also check that k_mbox_put() actually sends message.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-05 07:51:59 -05:00
Alexander Razinkov
5725585112 tests: kernel: common: added test on atomic_t overflow
Added test to verify that the value of atomic_t will be the same
in case of overflow if incremented in atomic and non-atomic manner

Signed-off-by: Alexander Razinkov <alexander.razinkov@syntacore.com>
2023-11-04 07:38:39 -04:00
Alexander Razinkov
8fe8f34169 tests: kernel: spinlock: acquisition fairness test
Added test to verify the spinlock acquisition fairness
in relation to the CPUs contending for the spinlock.
This test is only enabled for Ticket Spinlocks which
required to provide such kind of fairness.

Signed-off-by: Alexander Razinkov <alexander.razinkov@syntacore.com>
2023-11-04 07:38:39 -04:00
Anas Nashif
a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
9c4d881183 syscall: rename Z_SYSCALL_ to K_SYSCALL_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
9c1aeb5fd3 syscall: rename z_user_ to k_usermode_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
70e791905d syscall: rename z_user_string_nlen -> k_usermode_string_nlen
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
21254b2f40 syscall: rename z_object_validate -> k_object_validate
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
c25d0804f0 syscall: rename z_object_find -> k_object_find
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
43a7402baf syscall: rename z_object_recycle -> k_object_recycle
Rename z_object_recycle and do not use z_ for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
d178b6a0e7 syscall: z_obj_validation_check -> k_object_validation_check
Rename z_obj_validation_check  and do not use z_ for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
4d5d04169d syscall: rename z_is_in_user_syscall
Rename z_is_in_user_syscall -> k_is_in_user_syscall

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
a6b490073e kernel: object: rename z_object -> k_object
Do not use z_ for internal structures and rename to k_object instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00