tests/kernel/common: Skip boot delay tests on systems that are too fast
First, this test is a little suspect. It's assuming that the value returned from k_cycle_get_32() represents the time since system power-on. While that's an obvious implementation choice and surely often true, it's definitely not the way we document this API to the arch layer. It's perfectly legal for a platform to return any value as long as the counter is increasing at the correct rate. Leaving for now as there's no other way to test CONFIG_BOOT_DELAY, but this will likely be coming back to confuse us at some point. Regardless, that convention holds for x86 devices using any of the existing drivers. But on an EFI PC using the TSC counter as the clock source: (1) the counter is running at 1-2 GHz and (2) the time to get through an EFI BIOS and into Zephyr is routinely 10+ seconds, especially on reference hardware. The poor 32 bit API will roll over several times, and effectively be a random number by the time it reaches this test. Just skip this test with fast counter. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
7d5e238162
commit
4898e2c613
|
@ -19,6 +19,17 @@
|
|||
*/
|
||||
void test_bootdelay(void)
|
||||
{
|
||||
if (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC > 1000000000) {
|
||||
/* Systems with very fast counters (like the x86 TSC)
|
||||
* and long firmware startup (often 10+ seconds on a
|
||||
* EFI PC!) can easily roll this over during startup,
|
||||
* and there's no way to detect that case with a 32
|
||||
* bit OS API. Just skip it if we have a GHz-scale
|
||||
* counter.
|
||||
*/
|
||||
ztest_test_skip();
|
||||
}
|
||||
|
||||
uint32_t current_cycles = k_cycle_get_32();
|
||||
|
||||
/* compare this with the boot delay specified */
|
||||
|
|
Loading…
Reference in a new issue