Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
#include <zephyr/ztest.h>
#include <zephyr/kernel_structs.h>
#include <zephyr/kernel.h>
#include <kernel_internal.h>
#include <string.h>
#include <ksched.h>
#include <kthread.h>
#include <zephyr/logging/log.h>
Macros | |
#define | STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define | JOIN_TIMEOUT_MS 100 |
#define | WAIT_TO_START_MS 100 |
#define | INT_ARRAY_SIZE 128 |
Enumerations | |
enum | control_method { TIMEOUT , NO_WAIT , SELF_ABORT , OTHER_ABORT , OTHER_ABORT_TIMEOUT , ALREADY_EXIT , ISR_ALREADY_EXIT , ISR_RUNNING } |
Functions | |
LOG_MODULE_REGISTER (test) | |
K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
static | K_THREAD_STACK_DEFINE (tstack_custom,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static | K_THREAD_STACK_DEFINE (tstack_name,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
ZTEST (threads_lifecycle, test_systhreads_main) | |
Verify main thread. | |
ZTEST (threads_lifecycle, test_systhreads_idle) | |
Verify idle thread. | |
static void | customdata_entry (void *p1, void *p2, void *p3) |
ZTEST (threads_lifecycle_1cpu, test_customdata_get_set_coop) | |
test thread custom data get/set from coop thread | |
static void | thread_name_entry (void *p1, void *p2, void *p3) |
ZTEST (threads_lifecycle, test_thread_name_get_set) | |
test thread name get/set from supervisor thread | |
ZTEST_USER (threads_lifecycle, test_thread_name_user_get_set) | |
test thread name get/set from user thread | |
ZTEST_USER (threads_lifecycle_1cpu, test_customdata_get_set_preempt) | |
test thread custom data get/set from preempt thread | |
static void | umode_entry (void *thread_id, void *p2, void *p3) |
static void | enter_user_mode_entry (void *p1, void *p2, void *p3) |
Test k_thread_user_mode_enter() to cover when userspace is not supported/enabled. | |
ZTEST_USER (threads_lifecycle, test_user_mode) | |
K_THREAD_STACK_DEFINE (join_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
K_THREAD_STACK_DEFINE (control_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
static void | join_entry (void *p1, void *p2, void *p3) |
static void | control_entry (void *p1, void *p2, void *p3) |
static void | do_join_from_isr (const void *arg) |
static int | join_scenario_interval (enum control_method m, int64_t *interval) |
static int | join_scenario (enum control_method m) |
ZTEST_USER (threads_lifecycle, test_thread_join) | |
ZTEST (threads_lifecycle, test_thread_join_isr) | |
K_THREAD_STACK_DEFINE (deadlock1_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
K_THREAD_STACK_DEFINE (deadlock2_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
static void | deadlock1_entry (void *p1, void *p2, void *p3) |
static void | deadlock2_entry (void *p1, void *p2, void *p3) |
ZTEST_USER (threads_lifecycle, test_thread_join_deadlock) | |
static void | user_start_thread (void *p1, void *p2, void *p3) |
ZTEST_USER (threads_lifecycle, test_thread_timeout_remaining_expires) | |
static void | foreach_callback (const struct k_thread *thread, void *user_data) |
ZTEST (threads_lifecycle, test_thread_runtime_stats_get) | |
ZTEST (threads_lifecycle, test_k_busy_wait) | |
static void | tp_entry (void *p1, void *p2, void *p3) |
ZTEST_USER (threads_lifecycle_1cpu, test_k_busy_wait_user) | |
static int | large_stack (size_t *space) |
static int | small_stack (size_t *space) |
ZTEST_USER (threads_lifecycle, test_k_thread_stack_space_get_user) | |
static void * | thread_test_setup (void) |
ZTEST_SUITE (threads_lifecycle, NULL, thread_test_setup, NULL, NULL, NULL) | |
ZTEST_SUITE (threads_lifecycle_1cpu, NULL, thread_test_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL) | |
Variables | |
struct k_thread | tdata |
size_t | tstack_size = K_THREAD_STACK_SIZEOF(tstack) |
static struct k_thread | tdata_custom |
static struct k_thread | tdata_name |
static int | main_prio |
static ZTEST_DMEM int | tp = 10 |
static char | unreadable_string [64] |
static char | not_my_buffer [CONFIG_THREAD_MAX_NAME_LEN] |
struct k_sem | sem |
struct k_thread | join_thread |
struct k_thread | control_thread |
struct k_thread | deadlock1_thread |
struct k_thread | deadlock2_thread |
#define INT_ARRAY_SIZE 128 |
#define JOIN_TIMEOUT_MS 100 |
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define WAIT_TO_START_MS 100 |
enum control_method |
|
static |
|
static |
TESTPOINT: custom data comparison
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
K_THREAD_STACK_DEFINE | ( | control_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | deadlock1_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | deadlock2_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | join_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | tstack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
|
static |
|
static |
|
static |
LOG_MODULE_REGISTER | ( | test | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
ZTEST | ( | threads_lifecycle | , |
test_k_busy_wait | |||
) |
ZTEST | ( | threads_lifecycle | , |
test_thread_join_isr | |||
) |
ZTEST | ( | threads_lifecycle | , |
test_thread_runtime_stats_get | |||
) |
ZTEST_SUITE | ( | threads_lifecycle | , |
NULL | , | ||
thread_test_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
ZTEST_SUITE | ( | threads_lifecycle_1cpu | , |
NULL | , | ||
thread_test_setup | , | ||
ztest_simple_1cpu_before | , | ||
ztest_simple_1cpu_after | , | ||
NULL | |||
) |
ZTEST_USER | ( | threads_lifecycle | , |
test_k_thread_stack_space_get_user | |||
) |
ZTEST_USER | ( | threads_lifecycle | , |
test_thread_join | |||
) |
ZTEST_USER | ( | threads_lifecycle | , |
test_thread_join_deadlock | |||
) |
ZTEST_USER | ( | threads_lifecycle | , |
test_thread_timeout_remaining_expires | |||
) |
ZTEST_USER | ( | threads_lifecycle | , |
test_user_mode | |||
) |
ZTEST_USER | ( | threads_lifecycle_1cpu | , |
test_k_busy_wait_user | |||
) |
struct k_thread control_thread |
struct k_thread deadlock1_thread |
struct k_thread deadlock2_thread |
struct k_thread join_thread |
|
static |
|
static |
struct k_sem sem |
struct k_thread tdata |
|
static |
|
static |
|
static |
size_t tstack_size = K_THREAD_STACK_SIZEOF(tstack) |
|
static |