diff --git a/tests/kernel/poll/src/main.c b/tests/kernel/poll/src/main.c index 9e5f547df21..a3c6e73f03f 100644 --- a/tests/kernel/poll/src/main.c +++ b/tests/kernel/poll/src/main.c @@ -14,8 +14,6 @@ extern void test_poll_multi(void); extern void test_poll_threadstate(void); extern void test_poll_grant_access(void); extern void test_poll_fail_grant_access(void); -extern void test_poll_lower_prio(void); -extern void test_condition_met_type_err(void); extern void test_detect_is_polling(void); #ifdef CONFIG_USERSPACE extern void test_k_poll_user_num_err(void); @@ -74,10 +72,8 @@ void test_main(void) ztest_1cpu_unit_test(test_poll_cancel_main_low_prio), ztest_1cpu_unit_test(test_poll_cancel_main_high_prio), ztest_unit_test(test_poll_multi), - ztest_1cpu_unit_test(test_poll_lower_prio), ztest_1cpu_unit_test(test_poll_threadstate), ztest_1cpu_unit_test(test_detect_is_polling), - ztest_1cpu_unit_test(test_condition_met_type_err), ztest_user_unit_test(test_k_poll_user_num_err), ztest_user_unit_test(test_k_poll_user_mem_err), ztest_user_unit_test(test_k_poll_user_type_sem_err), diff --git a/tests/kernel/poll/src/test_poll_fail.c b/tests/kernel/poll/src/test_poll_fail.c index edd1606a1d0..f6f6c8b572f 100644 --- a/tests/kernel/poll/src/test_poll_fail.c +++ b/tests/kernel/poll/src/test_poll_fail.c @@ -10,107 +10,6 @@ static struct k_poll_signal signal_err; #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE) -static struct k_thread test_thread1; -static struct k_thread test_thread2; -K_THREAD_STACK_DEFINE(test_stack1, STACK_SIZE); -K_THREAD_STACK_DEFINE(test_stack2, STACK_SIZE); - -/** - * @brief Test API k_poll with error events type in kernel mode - * - * @details Define a poll event and initialize by k_poll_event_init(), and using - * API k_poll with error events type as parameter check if a error will be met. - * - * @see k_poll() - * - * @ingroup kernel_poll_tests - */ -void test_condition_met_type_err(void) -{ - struct k_poll_event event; - struct k_fifo fifo; - - ztest_set_assert_valid(true); - k_fifo_init(&fifo); - k_poll_event_init(&event, K_POLL_TYPE_DATA_AVAILABLE, K_POLL_MODE_NOTIFY_ONLY, &fifo); - - event.type = 5; - k_poll(&event, 1, K_NO_WAIT); -} - -/* verify multiple pollers */ -static K_SEM_DEFINE(multi_sem, 0, 1); -static K_SEM_DEFINE(multi_ready_sem, 1, 1); -static K_SEM_DEFINE(multi_reply, 0, 1); - -static void thread_entry(void *p1, void *p2, void *p3) -{ - struct k_poll_event event; - - k_poll_event_init(&event, K_POLL_TYPE_SEM_AVAILABLE, - K_POLL_MODE_NOTIFY_ONLY, &multi_sem); - - (void)k_poll(&event, 1, K_FOREVER); - k_sem_take(&multi_sem, K_FOREVER); - k_sem_give(&multi_reply); -} - -/** - * @brief Test polling of multiple events by lower priority thread - * - * @details - * - Test the multiple semaphore events as waitable events in poll. - * - * @ingroup kernel_poll_tests - * - * @see K_POLL_EVENT_INITIALIZER(), k_poll(), k_poll_event_init() - */ -void test_poll_lower_prio(void) -{ - int old_prio = k_thread_priority_get(k_current_get()); - struct k_thread *p = &test_thread1; - const int main_low_prio = 10; - const int low_prio_than_main = 11; - int rc; - - struct k_poll_event events[] = { - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SEM_AVAILABLE, - K_POLL_MODE_NOTIFY_ONLY, - &multi_sem), - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SEM_AVAILABLE, - K_POLL_MODE_NOTIFY_ONLY, - &multi_ready_sem), - }; - - k_thread_priority_set(k_current_get(), main_low_prio); - - k_thread_create(&test_thread1, test_stack1, - K_THREAD_STACK_SIZEOF(test_stack1), - thread_entry, 0, 0, 0, low_prio_than_main, - K_INHERIT_PERMS, K_NO_WAIT); - - k_thread_create(&test_thread2, test_stack2, - K_THREAD_STACK_SIZEOF(test_stack2), - thread_entry, 0, 0, 0, low_prio_than_main, - K_INHERIT_PERMS, K_NO_WAIT); - - /* Set up the thread timeout value to check if what happened if dticks is invalid */ - p->base.timeout.dticks = _EXPIRED; - - /* Delay for some actions above */ - k_sleep(K_MSEC(250)); - (void)k_poll(events, ARRAY_SIZE(events), K_SECONDS(1)); - - k_sem_give(&multi_sem); - k_sem_give(&multi_sem); - rc = k_sem_take(&multi_reply, K_FOREVER); - - zassert_equal(rc, 0, ""); - - /* Reset the initialized state */ - k_thread_priority_set(k_current_get(), old_prio); - k_sleep(K_MSEC(250)); -} #ifdef CONFIG_USERSPACE /**