tests: ztest: add CONFIG_ZTEST_NO_YIELD to keep SOC awake after test
Some SOCs cannot be flashed reliably in low power modes. If CONFIG_ZTEST_NO_YIELD is selected, do not yield to the idle thread after testsuite completes, so that the SOC will not enter low power mode. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
2ffce62f61
commit
5ba1787163
2 changed files with 20 additions and 0 deletions
|
@ -79,6 +79,14 @@ config ZTEST_ASSERT_HOOK
|
|||
error test case. Remember to add ignore_fault tag in yaml file when
|
||||
using twister to run testing.
|
||||
|
||||
config ZTEST_NO_YIELD
|
||||
bool "Do not yield to the idle thread after tests complete"
|
||||
help
|
||||
When the tests complete, do not yield to the idle thread and instead
|
||||
spin in a loop. This is useful for low power mode tests, where
|
||||
yielding to the idle thread may put the board into a low power state
|
||||
where a debugger cannot connect to it.
|
||||
|
||||
if ZTEST_NEW_API
|
||||
|
||||
menu "ztest provided rules"
|
||||
|
|
|
@ -579,5 +579,17 @@ void main(void)
|
|||
state.boots = 0;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_ZTEST_NO_YIELD
|
||||
/*
|
||||
* Rather than yielding to idle thread, keep the part awake so debugger can
|
||||
* still access it, since some SOCs cannot be debugged in low power states.
|
||||
*/
|
||||
uint32_t key = irq_lock();
|
||||
|
||||
while (1) {
|
||||
; /* Spin */
|
||||
}
|
||||
irq_unlock(key);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue