LCOV - code coverage report
Current view: top level - /home/ubuntu/zephyrproject/zephyr/subsys/debug/zassert - zassert.c (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 22 0
Test Date: 2026-11-06 14:43:19 Functions: 0.0 % 3 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0.0 % 6 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Copyright (c) 2026 Måns Ansgariusson <mansgariusson@gmail.com>
       3                 :             :  *
       4                 :             :  * SPDX-License-Identifier: Apache-2.0
       5                 :             :  */
       6                 :             : 
       7                 :             : #include <stdarg.h>
       8                 :             : #include <zephyr/sys/zassert.h>
       9                 :             : #include <zephyr/sys/printk.h>
      10                 :             : #include <zephyr/kernel.h>
      11                 :             : #include <zephyr/llext/symbol.h>
      12                 :             : 
      13                 :             : __weak
      14                 :             : #ifndef CONFIG_ASSERT_TEST
      15                 :             : FUNC_NORETURN
      16                 :             : #endif
      17                 :           0 : void zassert_fail(const char *cond, const char *file,
      18                 :             :                   unsigned int line, const char *fmt, ...)
      19                 :             : {
      20         [ #  # ]:           0 :         if (cond != NULL && file != NULL) {
      21                 :           0 :                 zassert_print("ASSERTION FAIL [%s] @ %s:%d\n", cond, file, line);
      22         [ #  # ]:           0 :         } else if (file != NULL) {
      23                 :           0 :                 zassert_print("ASSERTION FAIL @ %s:%d\n", file, line);
      24                 :             :         } else {
      25                 :           0 :                 zassert_print("ASSERTION FAIL\n");
      26                 :             :         }
      27                 :             : 
      28         [ #  # ]:           0 :         if (fmt != NULL) {
      29                 :           0 :                 va_list ap;
      30                 :             : 
      31                 :           0 :                 zassert_print("\t");
      32                 :           0 :                 va_start(ap, fmt);
      33                 :           0 :                 zassert_vprint(fmt, ap);
      34                 :           0 :                 va_end(ap);
      35                 :           0 :                 zassert_print("\n");
      36                 :             :         }
      37                 :             : 
      38                 :           0 :         zassert_post_action(file, line);
      39                 :             : 
      40                 :             : #ifndef CONFIG_ASSERT_TEST
      41                 :             :         CODE_UNREACHABLE;
      42                 :             : #endif
      43                 :             : }
      44                 :             : EXPORT_SYMBOL(zassert_fail);
      45                 :             : 
      46                 :             : __weak
      47                 :             : #ifndef CONFIG_ASSERT_TEST
      48                 :             : FUNC_NORETURN
      49                 :             : #endif
      50                 :           0 : void zassert_post_action(const char *file, unsigned int line)
      51                 :             : {
      52                 :           0 :         ARG_UNUSED(file);
      53                 :           0 :         ARG_UNUSED(line);
      54                 :             : 
      55                 :             : #ifdef CONFIG_USERSPACE
      56                 :             :         if (k_is_user_context()) {
      57                 :             :                 k_oops();
      58                 :             :         }
      59                 :             : #endif
      60                 :             : 
      61                 :           0 :         k_panic();
      62                 :             : 
      63                 :             : #ifndef CONFIG_ASSERT_TEST
      64                 :           0 :         CODE_UNREACHABLE;
      65                 :             : #endif
      66                 :             : }
      67                 :             : EXPORT_SYMBOL(zassert_post_action);
      68                 :             : 
      69                 :           0 : __weak void zassert_vprint(__maybe_unused const char *fmt, __maybe_unused va_list ap)
      70                 :             : {
      71                 :             : #ifdef CONFIG_PRINTK
      72                 :           0 :         vprintk_unlocked(fmt, ap);
      73                 :             : #endif
      74                 :           0 : }
      75                 :             : EXPORT_SYMBOL(zassert_vprint);
        

Generated by: LCOV version 2.0-1