spinlock: Support ztest mocking
Spinlocks are written above the arch-provided _arch_irq_un/lock() calls. But those aren't stubbed by the mocking layer, and as it's not an "arch" I don't see an obvious place to put them. Handle them in spinlock.h. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
04382b9a2a
commit
fb505b3cfd
1 changed files with 17 additions and 0 deletions
|
@ -8,6 +8,22 @@
|
|||
|
||||
#include <atomic.h>
|
||||
|
||||
/* These stubs aren't provided by the mocking framework, and I can't
|
||||
* find a proper place to put them as mocking seems not to have a
|
||||
* proper "arch" layer.
|
||||
*/
|
||||
#ifdef ZTEST_UNITTEST
|
||||
static inline int _arch_irq_lock(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void _arch_irq_unlock(int key)
|
||||
{
|
||||
ARG_UNUSED(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ASSERT) && (CONFIG_MP_NUM_CPUS < 4)
|
||||
#include <misc/__assert.h>
|
||||
struct k_spinlock;
|
||||
|
@ -37,6 +53,7 @@ struct k_spinlock {
|
|||
|
||||
static ALWAYS_INLINE k_spinlock_key_t k_spin_lock(struct k_spinlock *l)
|
||||
{
|
||||
ARG_UNUSED(l);
|
||||
k_spinlock_key_t k;
|
||||
|
||||
/* Note that we need to use the underlying arch-specific lock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue