tests: schedule_api: fix style

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-06-16 22:12:46 -04:00 committed by Kumar Gala
commit 00b55663f1
3 changed files with 22 additions and 22 deletions

View file

@ -19,17 +19,17 @@
void test_main(void *p1, void *p2, void *p3)
{
ztest_test_suite(test_threads_scheduling,
ztest_unit_test(test_priority_cooperative),
ztest_unit_test(test_priority_preemptible),
ztest_unit_test(test_yield_cooperative),
ztest_unit_test(test_sleep_cooperative),
ztest_unit_test(test_sleep_wakeup_preemptible),
ztest_unit_test(test_time_slicing_preemptible),
ztest_unit_test(test_time_slicing_disable_preemptible),
ztest_unit_test(test_lock_preemptible),
ztest_unit_test(test_unlock_preemptible),
ztest_unit_test(test_sched_is_preempt_thread),
ztest_unit_test(test_slice_reset)
);
ztest_unit_test(test_priority_cooperative),
ztest_unit_test(test_priority_preemptible),
ztest_unit_test(test_yield_cooperative),
ztest_unit_test(test_sleep_cooperative),
ztest_unit_test(test_sleep_wakeup_preemptible),
ztest_unit_test(test_time_slicing_preemptible),
ztest_unit_test(test_time_slicing_disable_preemptible),
ztest_unit_test(test_lock_preemptible),
ztest_unit_test(test_unlock_preemptible),
ztest_unit_test(test_sched_is_preempt_thread),
ztest_unit_test(test_slice_reset)
);
ztest_run_test_suite(test_threads_scheduling);
}

View file

@ -70,15 +70,15 @@ void test_sched_is_preempt_thread(void)
/*create preempt thread*/
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
tpreempt_ctx, NULL, NULL, NULL,
K_PRIO_PREEMPT(1), 0, 0);
tpreempt_ctx, NULL, NULL, NULL,
K_PRIO_PREEMPT(1), 0, 0);
k_sem_take(&end_sema, K_FOREVER);
k_thread_abort(tid);
/*create coop thread*/
tid = k_thread_create(&tdata, tstack, STACK_SIZE,
tcoop_ctx, NULL, NULL, NULL,
K_PRIO_COOP(1), 0, 0);
tcoop_ctx, NULL, NULL, NULL,
K_PRIO_COOP(1), 0, 0);
k_sem_take(&end_sema, K_FOREVER);
k_thread_abort(tid);

View file

@ -12,7 +12,7 @@ static K_THREAD_STACK_ARRAY_DEFINE(tstack, NUM_THREAD, STACK_SIZE);
/* slice size in millisecond*/
#define SLICE_SIZE 200
/* busy for more than one slice*/
#define BUSY_MS (SLICE_SIZE+20)
#define BUSY_MS (SLICE_SIZE + 20)
/* a half timeslice*/
#define HALF_SLICE_SIZE (SLICE_SIZE >> 1)
@ -21,9 +21,9 @@ K_SEM_DEFINE(sema, 0, NUM_THREAD);
static s64_t elapsed_slice;
/*expected elapsed duration*/
static s64_t expected_slice[NUM_THREAD] = {
HALF_SLICE_SIZE,/* the ztest native thread taking a half timeslice*/
SLICE_SIZE, /* the spawned thread taking a full timeslice, reset*/
SLICE_SIZE /* the spawned thread taking a full timeslice, reset*/
HALF_SLICE_SIZE, /* the ztest native thread taking a half timeslice*/
SLICE_SIZE, /* the spawned thread taking a full timeslice, reset*/
SLICE_SIZE /* the spawned thread taking a full timeslice, reset*/
};
static int thread_idx;
@ -69,8 +69,8 @@ void test_slice_reset(void)
/* create delayed threads with equal preemptive priority*/
for (int i = 0; i < NUM_THREAD; i++) {
tid[i] = k_thread_create(&t[i], tstack[i], STACK_SIZE,
thread_tslice, NULL, NULL, NULL,
K_PRIO_PREEMPT(j), 0, 0);
thread_tslice, NULL, NULL, NULL,
K_PRIO_PREEMPT(j), 0, 0);
}
/* enable time slice*/
k_sched_time_slice_set(SLICE_SIZE, K_PRIO_PREEMPT(0));