Skip to content

Commit fe228a8

Browse files
Andrew Boienashif
authored andcommitted
kernel: init: exclude some funcs from coverage
data copying and bss zero are called from arch code before z_cstart(), and coverage data gathering doesn't work properly at that point. Not all arches use this code anyway, some do it in optimized assembly instead. Weak main() is also excluded; it does nothing and every test overrides it. Signed-off-by: Andrew Boie <[email protected]>
1 parent d87a90e commit fe228a8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

kernel/init.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ K_THREAD_STACK_DEFINE(_interrupt_stack3, CONFIG_ISR_STACK_SIZE);
133133
extern void idle(void *unused1, void *unused2, void *unused3);
134134

135135

136+
/* LCOV_EXCL_START
137+
*
138+
* This code is called so early in the boot process that code coverage
139+
* doesn't work properly. In addition, not all arches call this code,
140+
* some like x86 do this with optimized assembly
141+
*/
142+
136143
/**
137144
*
138145
* @brief Clear BSS
@@ -215,7 +222,9 @@ void z_data_copy(void)
215222
#endif /* CONFIG_STACK_CANARIES */
216223
#endif /* CONFIG_USERSPACE */
217224
}
218-
#endif
225+
#endif /* CONFIG_XIP */
226+
227+
/* LCOV_EXCL_STOP */
219228

220229
/**
221230
*
@@ -284,12 +293,16 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
284293
_main_thread->base.user_options &= ~K_ESSENTIAL;
285294
}
286295

296+
/* LCOV_EXCL_START */
297+
287298
void __weak main(void)
288299
{
289300
/* NOP default main() if the application does not provide one. */
290301
arch_nop();
291302
}
292303

304+
/* LCOV_EXCL_STOP */
305+
293306
#if defined(CONFIG_MULTITHREADING)
294307
static void init_idle_thread(struct k_thread *thr, k_thread_stack_t *stack)
295308
{

0 commit comments

Comments
 (0)