From 529791dff79a0fd19ff8e2827edaf07e27f3bf4d Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 23 Oct 2019 05:24:00 -0700 Subject: [PATCH] ztest: add missing headers Recent changes to architecture headers did not address ztest headers due to this bug in sanitycheck. Fixing them now. Signed-off-by: Anas Nashif --- include/spinlock.h | 16 -------------- subsys/testsuite/ztest/include/arch/cpu.h | 27 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/include/spinlock.h b/include/spinlock.h index b3ff656d03f..f55ae9efc82 100644 --- a/include/spinlock.h +++ b/include/spinlock.h @@ -8,22 +8,6 @@ #include -/* 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 z_arch_irq_lock(void) -{ - return 0; -} - -static inline void z_arch_irq_unlock(int key) -{ - ARG_UNUSED(key); -} -#endif - /* There's a spinlock validation framework available when asserts are * enabled. It adds a relatively hefty overhead (about 3k or so) to * kernel code size, don't use on platforms known to be small. (Note diff --git a/subsys/testsuite/ztest/include/arch/cpu.h b/subsys/testsuite/ztest/include/arch/cpu.h index b60b38902e8..90300ca7130 100644 --- a/subsys/testsuite/ztest/include/arch/cpu.h +++ b/subsys/testsuite/ztest/include/arch/cpu.h @@ -1,5 +1,32 @@ /* * SPDX-License-Identifier: Apache-2.0 */ +#ifndef ZEPHYR_SUBSYS_TESTSUITE_ZTEST_INCLUDE_ARCH_CPU_H +#define ZEPHYR_SUBSYS_TESTSUITE_ZTEST_INCLUDE_ARCH_CPU_H /* This file exists as a hack around Zephyr's dependencies */ + +static inline u32_t z_arch_k_cycle_get_32(void) +{ + return 0; +} + +static ALWAYS_INLINE unsigned int z_arch_irq_lock(void) +{ + return 0; +} + +static inline void z_arch_irq_unlock(unsigned int key) +{ + ARG_UNUSED(key); +} + +static inline bool z_arch_irq_unlocked(unsigned int key) +{ + return 0; +} + +#include + + +#endif /* ZEPHYR_SUBSYS_TESTSUITE_ZTEST_INCLUDE_ARCH_CPU_H */