tests: coverage: exclude the CODE UNREACHABLE of code coverage

1. Exclude the CODE UNREACHABLE line while generating coverage report.
2. Exclude the memory domain deprecated API when calculating code
coverage.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
This commit is contained in:
Enjia Mai 2021-01-15 17:09:58 +08:00 committed by Anas Nashif
commit 53ca709828
10 changed files with 11 additions and 9 deletions

View file

@ -33,7 +33,7 @@ extern "C" {
: [reason] "i" (reason_p), \ : [reason] "i" (reason_p), \
[id] "i" (_TRAP_S_CALL_RUNTIME_EXCEPT) \ [id] "i" (_TRAP_S_CALL_RUNTIME_EXCEPT) \
: "memory"); \ : "memory"); \
CODE_UNREACHABLE; \ CODE_UNREACHABLE; /* LCOV_EXCL_LINE */ \
} while (false) } while (false)
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -43,7 +43,7 @@ extern "C" {
compiler_barrier(); \ compiler_barrier(); \
z_impl_user_fault(reason_p); \ z_impl_user_fault(reason_p); \
} \ } \
CODE_UNREACHABLE; \ CODE_UNREACHABLE; /* LCOV_EXCL_LINE */ \
} while (false) } while (false)
#else #else
#define ARCH_EXCEPT(reason_p) do { \ #define ARCH_EXCEPT(reason_p) do { \

View file

@ -442,7 +442,7 @@ extern struct task_state_segment _main_tss;
: \ : \
: [vector] "i" (Z_X86_OOPS_VECTOR), \ : [vector] "i" (Z_X86_OOPS_VECTOR), \
[reason] "i" (reason_p)); \ [reason] "i" (reason_p)); \
CODE_UNREACHABLE; \ CODE_UNREACHABLE; /* LCOV_EXCL_LINE */ \
} while (false) } while (false)
/* /*

View file

@ -110,7 +110,7 @@ struct x86_ssf {
"int $32\n\t" \ "int $32\n\t" \
: \ : \
: [reason] "i" (reason_p)); \ : [reason] "i" (reason_p)); \
CODE_UNREACHABLE; \ CODE_UNREACHABLE; /* LCOV_EXCL_LINE */ \
} while (false) } while (false)
#endif /* _ASMLANGUAGE */ #endif /* _ASMLANGUAGE */

View file

@ -37,7 +37,7 @@ void _StackCheckHandler(void)
/* Stack canary error is a software fatal condition; treat it as such. /* Stack canary error is a software fatal condition; treat it as such.
*/ */
z_except_reason(K_ERR_STACK_CHK_FAIL); z_except_reason(K_ERR_STACK_CHK_FAIL);
CODE_UNREACHABLE; CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
} }
/* Global variable */ /* Global variable */

View file

@ -42,7 +42,7 @@ __weak void k_sys_fatal_error_handler(unsigned int reason,
LOG_PANIC(); LOG_PANIC();
LOG_ERR("Halting system"); LOG_ERR("Halting system");
arch_system_halt(reason); arch_system_halt(reason);
CODE_UNREACHABLE; CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
} }
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */

View file

@ -267,6 +267,7 @@ void k_mem_domain_add_thread(struct k_mem_domain *domain, k_tid_t thread)
k_spin_unlock(&z_mem_domain_lock, key); k_spin_unlock(&z_mem_domain_lock, key);
} }
/* LCOV_EXCL_START */
void k_mem_domain_remove_thread(k_tid_t thread) void k_mem_domain_remove_thread(k_tid_t thread)
{ {
k_mem_domain_add_thread(&k_mem_domain_default, thread); k_mem_domain_add_thread(&k_mem_domain_default, thread);
@ -297,6 +298,7 @@ void k_mem_domain_destroy(struct k_mem_domain *domain)
k_spin_unlock(&z_mem_domain_lock, key); k_spin_unlock(&z_mem_domain_lock, key);
} }
/* LCOV_EXCL_STOP */
static int init_mem_domain_module(const struct device *arg) static int init_mem_domain_module(const struct device *arg)
{ {

View file

@ -1578,7 +1578,7 @@ static bool thread_obj_validate(struct k_thread *thread)
#endif #endif
Z_OOPS(Z_SYSCALL_VERIFY_MSG(ret, "access denied")); Z_OOPS(Z_SYSCALL_VERIFY_MSG(ret, "access denied"));
} }
CODE_UNREACHABLE; CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
} }
static inline int z_vrfy_k_thread_join(struct k_thread *thread, static inline int z_vrfy_k_thread_join(struct k_thread *thread,

View file

@ -74,7 +74,7 @@ static FUNC_NORETURN void smp_init_top(void *arg)
smp_timer_init(); smp_timer_init();
z_swap_unlocked(); z_swap_unlocked();
CODE_UNREACHABLE; CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
} }
#endif #endif

View file

@ -46,7 +46,7 @@ FUNC_NORETURN void z_self_abort(void)
k_thread_suspend(_current); k_thread_suspend(_current);
z_swap_irqlock(key); z_swap_irqlock(key);
__ASSERT(false, "should never get here"); __ASSERT(false, "should never get here");
CODE_UNREACHABLE; CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
} }
#if !defined(CONFIG_ARCH_HAS_THREAD_ABORT) #if !defined(CONFIG_ARCH_HAS_THREAD_ABORT)