zephyr/tests/kernel
Andy Ross 0875740a34 tests/kernel/schedule_api: Fix slop in timeslice test
This test is a little subtle: it wants to spawn three threads to run
and be switched out by a timeslice interrupt.  And it wants to consume
half a time slice itself before it starts running.  And, because
timeslicing runs out of the same tick framework in the timer driver,
it needs to align to the start of a tick before the process starts.
And further: it does its own time math not in ticks but in timer
cycles, so it's quite sensitive to slop.

But it's "synchronize to tick boundary" code was actually
synchronizing to a CYCLE boundary, which is just wrong.  And it was
doing this in the wrong order.  It was resetting the timeslice first
and then synchronizing to a tick by spinning, which means that the
test was always going to begin as much as a tick late.  Do the tick
synchronization (via a sleep) first.

Finally, the manager thread that was spawning the new threads lives at
the same priority as the highest priority child threads, which means
it can potentitially wake up on the semaphores that they are giving in
the middle of the test and consume CPU unexpectedly.  Make sure it's
sleeping for the duration.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-29 07:39:39 -04:00
..
common test: atomic operation : add code description 2020-10-27 09:14:08 -04:00
context tests/kernel/context: Update for cavs_timer 2020-10-21 06:38:53 -04:00
device
early_sleep
fatal tests: exception: workaround agressive optimization 2020-10-06 11:41:23 -04:00
fifo kernel/poll: Mark incompatibility with KERNEL_COHERENCE 2020-10-21 06:38:53 -04:00
fpu_sharing
gen_isr_table boards: cc1352r_sensortag: add support for TI CC1352R SensorTag 2020-10-08 16:08:36 -04:00
interrupt
lifo
mbox
mem_heap/mheap_api_concept
mem_pool
mem_protect tests: sys_sem: add k_thread_join() calls 2020-10-28 10:29:49 -07:00
mem_slab
mp
msgq/msgq_api
mutex tests: sys_mutex: don't add to default domain 2020-10-22 16:47:07 -07:00
obj_tracing
pending
pipe Test: Refine annotaion and testcase for pipe. 2020-10-27 09:05:47 -04:00
poll Test: Refine annotaion and testcase for poll. 2020-10-27 09:06:35 -04:00
profiling/profiling_api
queue kernel/poll: Mark incompatibility with KERNEL_COHERENCE 2020-10-21 06:38:53 -04:00
sched tests/kernel/schedule_api: Fix slop in timeslice test 2020-10-29 07:39:39 -04:00
semaphore/semaphore
sleep
smp tests: smp: improving the description for SMP test cases 2020-10-04 14:26:31 -07:00
spinlock
stack/stack
threads tests: add a simple test for thread local storage 2020-10-24 10:52:00 -07:00
tickless
timer tests: kernel: timer_api: align tick for duration period test 2020-10-22 06:18:14 -04:00
workq kernel/poll: Mark incompatibility with KERNEL_COHERENCE 2020-10-21 06:38:53 -04:00
xip