Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Test scheduling. More...
Test scheduling.
#include <tests/kernel/sched/schedule_api/src/test_sched_priority.c>
Validate checking priority values
Our test cases don't cover every outcome of whether a priority is valid, do so here.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_priority_get() API.
Create a thread and set thread_k_thread_priority_get() param input to NULL will trigger a fatal error.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_priority_set() API.
Create a thread and set k_thread_priority_set() param input to NULL will trigger a fatal error.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_priority_set() API.
Check input param range overmax in userspace test.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_priority_set() API.
Check input param range fail in userspace test.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_resume() API.
Create a thread and set k_thread_resume() input param to NULL will trigger a fatal error.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_thread_suspend() API.
Create a thread and set k_thread_suspend() input param to NULL will trigger a fatal error.
#include <tests/kernel/sched/schedule_api/src/user_api.c>
Test k_wakeup() API.
Create a thread and set k_wakeup() input param to NULL will trigger a fatal error
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Lock the scheduler when preemptive threads are running.
Create 3 threads and lock the scheduler. Make sure that the threads are not executed. Call k_sleep() and check if the threads have executed.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Verify k_wakeup() behavior on pending thread.
The test creates a cooperative thread and let it wait for semaphore. Then calls k_wakeup(). The k_wakeup() call should return gracefully without waking up the thread
#include <tests/kernel/sched/preempt/src/main.c>
Test preemption.
#include <tests/kernel/sched/schedule_api/src/test_sched_priority.c>
Validate that the cooperative thread will not be preempted.
Create a cooperative thread with priority higher than the current cooperative thread. Make sure that the higher priority thread will not preempt the lower priority cooperative thread.
#include <tests/kernel/sched/schedule_api/src/test_sched_priority.c>
Validate preemptiveness of preemptive thread.
Create a preemptive thread which is of priority lower than current thread. Current thread is made has preemptive. Make sure newly created thread is not preempted. Now create a preemptive thread which is of priority higher than current thread. Make sure newly created thread is preempted
#include <tests/kernel/sched/schedule_api/src/test_sched_priority.c>
Validate scheduling sequence of preemptive threads with start delay.
Create four preemptive threads which are of priority higher than current thread. Make sure that the highest priority and longest waiting thread is scheduled first.
#include <tests/kernel/sched/schedule_api/src/test_priority_scheduling.c>
Check the behavior of preemptive threads with different priorities.
Create multiple threads of different priorities - all are preemptive, current thread is also made preemptive. Check how the threads get chance to execute based on their priorities
#include <tests/kernel/sched/schedule_api/src/test_sched_is_preempt_thread.c>
Validate the correctness of k_is_preempt_thread()
Create a preemptive thread, lock the scheduler and call k_is_preempt_thread(). Unlock the scheduler and call k_is_preempt_thread() again. Create a cooperative thread and lock the scheduler k_is_preempt_thread() and unlock the scheduler and call k_is_preempt_thread().
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate the behavior of cooperative thread when it sleeps.
Create 3 threads of priority -2, -1 and 0. Put the main thread in timeout queue by calling k_sleep() which is cooperative. Check if all the threads gets executed.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate k_wakeup()
Create 3 threads with main thread with priority 0 and other threads with -1, 0 ,+1 priority. Now -1 priority thread gets executed and it is made to sleep for 10 sec. Now, wake up the -1 priority thread and check if it starts executing.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Check the behavior of preemptive thread with k_busy_wait()
Create 3 threads with -1, 0, and 1 as priority, setup time slice for threads with priority 0. Make sure the threads with equal priorities are executed in time slice. Also run k_busy_wait() for 5 secs and check if other threads are not executed at that time.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate preemptive thread behavior with time slice.
Create 3 threads with -1, 0, and 1 as priority, setup time slice for threads with priority 0. Make sure the threads with equal priorities are executed in time slice.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate nested k_sched_lock() and k_sched_unlock()
In a preemptive thread, lock the scheduler twice and create a cooperative thread. Call k_sched_unlock() and check the cooperative thread haven't executed. Unlock it again to see the thread have executed this time.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate k_sched_lock() and k_sched_unlock()
Lock the scheduler and create 3 threads. Check that the threads are not executed. Call k_sched_unlock() and check if the threads have executed.
#include <tests/kernel/sched/deadline/src/main.c>
Validate the behavior of dealine_set when the thread is not queued.
Create a bunch of threads with scheduling delay which make the thread in unqueued state. The k_thread_deadline_set() call should not make these threads run before there delay time pass.
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
validate k_wakeup() in some corner scenario
trigger a timer and after expiration of timer call k_wakeup(), even the thread is not in sleep state neither in pending state
#include <tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c>
Validate the behavior of cooperative thread when it yields.
Create 3 threads of priority -2, -1 and 0. Yield the main thread which is cooperative. Check if all the threads gets executed.