Skip to content
Permalink
Browse files

tests: thread_apis: exercise some system calls

We had no system call coverage for k_thread_suspend
and k_thread_resume.

Some unnecessary cleanup tasks in the test case have
been removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie authored and nashif committed Jun 25, 2019
1 parent ffd182a commit 643f86f1f2c5acb193a6446a940448361577e8c0
@@ -214,7 +214,7 @@ void test_main(void)
ztest_unit_test(test_threads_spawn_forever),
ztest_unit_test(test_thread_start),
ztest_unit_test(test_threads_suspend_resume_cooperative),
ztest_unit_test(test_threads_suspend_resume_preemptible),
ztest_user_unit_test(test_threads_suspend_resume_preemptible),
ztest_unit_test(test_threads_priority_set),
ztest_user_unit_test(test_threads_abort_self),
ztest_user_unit_test(test_threads_abort_others),
@@ -10,7 +10,7 @@

K_THREAD_STACK_EXTERN(tstack);
extern struct k_thread tdata;
static int last_prio;
static ZTEST_BMEM int last_prio;

static void thread_entry(void *p1, void *p2, void *p3)
{
@@ -19,8 +19,6 @@ static void thread_entry(void *p1, void *p2, void *p3)

static void threads_suspend_resume(int prio)
{
int old_prio = k_thread_priority_get(k_current_get());

/* set current thread */
last_prio = prio;
k_thread_priority_set(k_current_get(), last_prio);
@@ -30,7 +28,7 @@ static void threads_suspend_resume(int prio)

k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
thread_entry, NULL, NULL, NULL,
create_prio, 0, 0);
create_prio, K_USER, 0);
/* checkpoint: suspend current thread */
k_thread_suspend(tid);
k_sleep(100);
@@ -40,11 +38,6 @@ static void threads_suspend_resume(int prio)
k_sleep(100);
/* checkpoint: created thread should be executed after resume */
zassert_true(last_prio == create_prio, NULL);

k_thread_abort(tid);

/* restore environment */
k_thread_priority_set(k_current_get(), old_prio);
}

/*test cases*/

0 comments on commit 643f86f

Please sign in to comment.
You can’t perform that action at this time.