zephyriot / zephyr-issues

0 stars 0 forks source link

test_context fails on bbc_microbit #2092

Closed nashif closed 7 years ago

nashif commented 7 years ago

Reported by Andrew Boie:

***** BOOTING ZEPHYR OS v1.7.99 - BUILD: Jun  7 2017 22:37:48 *****
tc_start() - Test kernel CPU and thread routines
Initializing kernel objects
Testing k_cpu_idle()
FAIL - test_kernel_cpu_idle@214. Bad ms per tick value computed, got 10 which is less than 20
===================================================================
FAIL - main.
===================================================================
PROJECT EXECUTION FAILED

(Imported from Jira ZEP-2257)

nashif commented 7 years ago

by Andrew Boie:

Anas Nashif found this bug. The initial fix I make simply added another allowable tick of slop, but looking at this more carefully it doesn't make any sense that more than one tick should elapse in this test. Investigating further.

nashif commented 7 years ago

by Andrew Boie:

I've found the problem. The test case assumes that when it puts the CPU to sleep with k_cpu_idle(), the interrupt that wakes up the device will be a timer interrupt and hence we would have advanced to the next tick.

But instead what is happening is that we are getting an interrupt from the nrf5_power_clock driver, which causes k_cpu_idle() to return far earlier than expected and the tick has not advanced, failing the test. The power clock interrupt seems to be something that happens in the first 20 milliseconds of device uptime; I found that I can get it to pass by moving the idle test to near the end of the test suite.

nashif commented 7 years ago

by Andrew Boie:

https://github.com/zephyrproject-rtos/zephyr/pull/434