Commit Graph

2429 Commits

Author SHA1 Message Date
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
Anas Nashif c91cad735a kernel: object: rename z_object_init to k_object_init
Do not use z_ for internal API and rename to k_object_init.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif c54fb959e3 kernel: objects: rename z_dynamic_object_aligned_create
Do not use z_ for internal APIs and rename function.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Benedikt Schmidt d28262905e tests: kernel: fix thread function signatures
Fix thread function signatures to avoid stack corruption on exit.
Fixes #64578

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 17:45:59 +00:00
Yong Cong Sin d7302f417e irq: relocate multi-level irq out of irq.h
Relocate multi-level interrupts APIs out of `irq.h` into
a new file named `irq_multilevel.h` to provide cleaner
separation between typical irq & multilevel ones.

Added preprocessor versions of `irq_to_level_x` as `IRQ_TO_Lx`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Andrei Emeltchenko c243991000 tests: work_queue: Change TC_PRINT to LOG_DBG
There are many TC_PRINT()'s in the work_queue test and it make sense
to change them to LOG_DBG() which are disabled by default. Other issue
is that some of TC_PRINT() are inside works for which execution time
is measured.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-30 09:29:25 -04:00
Benedikt Schmidt aa25e212d1 tests: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Andrei Emeltchenko daa739a410 tests: spinlock: Clear test globals before each test
Clear test global variables before each test execution.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-26 10:30:24 -04:00
Peter Mitsis 9f7244ee04 tests: obj_core: Increase stack sizes
Increase the size of the thread stacks used by the obj_core tests
by CONFIG_TEST_EXTRA_STACK_SIZE bytes. This is useful to prevent
stack overflow/corruption when options such such as
    "--coverage --gcov-tool gcov"
are applied to twister runs.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-25 10:05:52 +02:00
Alberto Escolar Piedras fb38b90481 tests kernel: Exclude posix arch for userspace tests
These tests cannot be run in this architecture as it does not
support userspace.
Today they are filtered by kconfig, which works but spends
time running cmake.
As native_posix is a default test platform it is better
to filter it alltogether by arch, which saves quite a lot
of time.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-24 09:05:29 +02:00
Flavio Ceolin 564adad952 treewide: Add CODE_UNREACHABLE after k_thread_abort(current)
Compiler can't tell that k_thread_abort() won't return and issues a
warning unless we tell it that control never gets this far.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-24 09:04:42 +02:00
Andrei Emeltchenko 1860af4bf4 tests: profiling: Remove unused Kconfig
Remove unused Kconfig with unused KERNEL_PROFILING_API_TEST.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-22 19:08:26 -04:00
Anas Nashif 996c8457d7 ztest: remove old ztest api
Remove old Ztest API entirely. New API is the now the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif 345735d0a8 tests: remove CONFIG_ZTEST_NEW_API in all tests
Remove all usage of CONFIG_ZTEST_NEW_API from tests and sample as this
is now enabled by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Peter Mitsis e9987aabbc kernel: Remove legacy mem block from mailbox
Memory blocks are a legacy feature and are to be removed from
mailboxes.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-13 09:56:02 +03:00
Fabio Baltieri a16d58cdf3 Revert "tests: kernel: xip: exclude qemu_riscv32_xip"
This reverts commit 341590545a, the issue
has been fixed in e1647e35c0, tested with

west build -t run -p -b qemu_riscv32_xip \
	-T tests/kernel/xip/arch.common.xip

west build -t run -p -b qemu_riscv32_xip \
	-T tests/kernel/xip/arch.common.xip.minimallibc

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-12 17:23:40 +01:00
Anas Nashif b2af50a836 tests: object cores: fix test meta data and components
Fix meta data and standarize components in test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Flavio Ceolin e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Keith Packard 1b057d6295 tests/timer_api: Make sure constant time conversions are constants
When the timer frequency is known at compile time, make sure we can use any
time conversion macro as a global initializer.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-06 20:05:07 +03:00
Grant Ramsay 1951d83783 tests: timer_monotonic: Add mps2_an385 test with icount disabled
This is to validate that GH-48608 is fixed
and stays fixed.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
Yong Cong Sin 019ae15f05 tests: kernel: work: fix uninitialized timer's work item
The `test_1cpu_drain_wait` tests iff the thread of a work queue
that is waiting to be drained can submit work item to the
queue. A timer is created with a callback funciton to submit a
work item to the same queue, to help demonstrate that behavior.

However, the work item submitted by `test_drain_wait_cb` to the
`coophi_queue` isn't initialized, and can hit assertion if it
is processed by the work queue.

Fixes #63559

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-05 13:43:07 +01:00
Martin Åberg ccbbb493da tests: kernel: Add qemu_leon3 to no-multithreading tests
Add qemu_leon3 target to the tests that list below. These set
CONFIG_MULTITHREADING=n.

- tests/kernel/mem_heap/mheap_api_concept
- tests/kernel/mem_slab/mslab_api
- tests/kernel/threads/no-multithreading
- tests/kernel/timer/timer_api

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2023-10-05 09:37:10 +01:00
Anas Nashif e19f21cb27 kernel: move z_is_thread_essential out of public kernel header
This is a private API to the kernel, so move out of kernel.h

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-30 18:43:28 +02:00
Peter Mitsis 13712dbea2 test: Shorten object core API stats test name
Changing the name of the routine test_obj_core_stats_deregister()
to something shorter (test_obj_core_stats_dereg) has been found to
be a workaround to the issue identified in #61087.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Peter Mitsis eb86a0cca5 test: Implement obj core stats test
Adds a test to test the objects integrated into the object core
statistics framework.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Peter Mitsis d709182ba5 test: Implement object core stats API test
Creates a set of tests to verify that the top-level
k_obj_core_stats_xxx() routines behave as expected.
Note that this test is not meant to test the details
of the object core statistics operator function pointers.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Peter Mitsis 5594de49ea test: Implement object core test
Creates a test to verify that kernel objects can be found within
the object core framework.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Manuel Argüelles 3923cda6d8 tests: kernel: syscalls: use default faulty address for s32z270dc2
Before Picolibc was made default, this board needed a custom test
faulty address. Now this address does not produce a fault anymore so
switch back to the default faulty address.

Fixes #63270

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-29 20:34:51 +03:00
Andrzej Głąbek 222593f8c4 tests: kernel: timer: jitter_drift: Restore initial alignment to tick
This is a follow-up to commit 4cc21e2f4a.

That short sleeping before starting the test was removed together with
accuracy improvements (specifically, with moving of the first readout
of the cycle counter). Nevertheless, this tick alignment it still
needed, as without it in specific conditions the test may undesirably
fail.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-09-29 16:25:10 +02:00
Daniel Leung d47b1c05f3 kernel: userspace: add k_object_is_valid()
This adds a function k_object_is_valid() to check if a kernel
object exists, of certain type, and has been initialized.
This replaces the same (or very similar) code that has been
copied from kernel into the network subsystem.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-28 17:28:43 -04:00
Keith Packard 4269bbc4ea test/kernel: Adjust timer test to deal with time_units macros
All of the time_units conversion routines are now macros which means the
test cannot reference them as functions. Instead, create local static
functions which call each one of them and use those instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-09-28 16:15:27 +02:00
Andrei Emeltchenko bf4dc31015 tests: spinlock: Make local functions static
Make local functions static.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-28 15:46:07 +02:00
Andrei Emeltchenko a3959af4f5 tests: spinlock: Increase thread execution to prevent quick exit
On Intel boards (like intel_ehl_crb and intel_rpl_s_crb) for the
trylock_test some part is executed very fast and since there is no
synchronization, there might be situation when there is no
trylock_failures. Increasing time spend in this part fixes the issue.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-28 15:46:07 +02:00
Yonatan Schachter a7df77cd99 tests: byteorder: Add tests for sys_uint*_to_array macros
Add tests for sys_uint*_to_array macros to the byteorder suite.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-09-28 07:39:09 -04:00
Ederson de Souza 5c65a60eab tests/kernel/timer/timer_behavior: Add support for Saleae Logic 2
This patch shows an example of how to use the timer behavior external
tool testing, using the Saleae Logic 2 application.

Also, some board overlays were added as examples.

Finally, testcase.yaml updated with parameters for the Saleae sample.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2023-09-27 20:25:09 -04:00
Ederson de Souza 22ba9456de tests/kernel/timer/timer_behavior: Add support for external tool
This patch adds a way to simplify using an external tool to measure
timer behaviour on Zephyr. It modifies the timer behaviour
jitter_drift.c tests to toggle a GPIO pin (defined via a new DTS
compatible, "test-kernel-timer-behavior-external") that can be connected
to an external tool, such as a logic analyzer, to measure timer
behaviour.

This GPIO pin toggle is behind a new CONFIG_TIMER_EXTERNAL_TEST Kconfig.

A new pytest test is added so that it can collect the statistics from
the external tool and assert some measurements. To collect statistics
from the external tool, one needs to provide a Python module which
provides a `run(seconds, config)` method, that will perform the test and
return the statistics. Check the README file for more information about
this interface.

Finally, this on twister, this new test is behind a new fixture,
"gpio-timerout".

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-09-27 20:25:09 -04:00
Fabio Baltieri 341590545a tests: kernel: xip: exclude qemu_riscv32_xip
This board seems to have issue with data alignemnt after 843f66f and is
failing in CI. Exclude it while the problem is investigated.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 17:39:38 +01:00
Carlo Caione 85c4111002 memory-attr: Rationalize _MASK and _GET(x) macros
Let's make this official: we use the suffix `_MASK` for the define
carrying the GENMASK for the attributes, and the suffix `_GET(x)` for
the actual macro extracting the attributes.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-09-22 09:27:57 +02:00
Jaxson Han 2a8548b036 tests: Kernel: semaphore: semaphore: Set test case to 1cpu
The test_sem_take_timeout_isr depends on the thread's priority. But for
SMP platforms, the priority is different with no-SMP. High-priority
threads and low-priority threads might run simultaneously at different
cores. Set the test case run at 1cpu to fix such an issue.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-09-22 09:25:12 +02:00
Jaxson Han 64086d04d5 tests: kernel: threads: dynamic_thread: increase the heap size
The heap size is not enough so that it will cause the testcase fail.
Increase to 32k to make sure it works for a long time in the future.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-09-22 09:25:12 +02:00
Gerard Marull-Paretas 3ff5222a6f tests: kernel: device: drop APPLICATION level
Level is about to be removed, so stop testing it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-21 15:02:45 +02:00
TaiJu Wu fe5c915a56 test: fix ITRERATION_COUNT typo
ITERATION_COUNT was written as ITRERATION_COUNT.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
2023-09-19 09:53:03 -04:00