Skip to content
Permalink
Browse files

tests: schedule_api: minor cleanup

rename test function and move #if to the start of the line.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
  • Loading branch information...
nashif committed Jun 20, 2019
1 parent fe03e39 commit 528a2de29054c9234e19dd985f0fa8fb7dc05ee1
Showing with 6 additions and 4 deletions.
  1. +6 −4 tests/kernel/sched/schedule_api/src/test_sched_timeslice_reset.c
@@ -38,7 +38,7 @@ static u32_t cycles_delta(u32_t *reftime)
return delta;
}

static void thread_tslice(void *p1, void *p2, void *p3)
static void thread_time_slice(void *p1, void *p2, void *p3)
{
u32_t t = cycles_delta(&elapsed_slice);
u32_t expected_slice_min, expected_slice_max;
@@ -64,10 +64,10 @@ static void thread_tslice(void *p1, void *p2, void *p3)
(sys_clock_hw_cycles_per_sec() / 1000);
}

#ifdef CONFIG_DEBUG
#ifdef CONFIG_DEBUG
TC_PRINT("thread[%d] elapsed slice: %d, expected: <%d, %d>\n",
thread_idx, t, expected_slice_min, expected_slice_max);
#endif
#endif

/** TESTPOINT: timeslice should be reset for each preemptive thread*/
#ifndef CONFIG_COVERAGE
@@ -116,12 +116,14 @@ void test_slice_reset(void)

for (int j = 0; j < 2; j++) {
k_sem_reset(&sema);

/* update priority for current thread*/
k_thread_priority_set(k_current_get(), K_PRIO_PREEMPT(j));

/* create delayed threads with equal preemptive priority*/
for (int i = 0; i < NUM_THREAD; i++) {
tid[i] = k_thread_create(&t[i], tstacks[i], STACK_SIZE,
thread_tslice, NULL, NULL, NULL,
thread_time_slice, NULL, NULL, NULL,
K_PRIO_PREEMPT(j), 0, 0);
}
/* enable time slice*/

0 comments on commit 528a2de

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