LCOV - code coverage report
Current view: top level - spdk/lib/ut_mock - mock.c (source / functions) Hit Total Coverage
Test: Combined Lines: 13 14 92.9 %
Date: 2024-07-14 22:57:34 Functions: 7 13 53.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 28 34 82.4 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2017 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk_internal/mock.h"
       7                 :            : 
       8   [ +  +  +  + ]:    6696285 : DEFINE_WRAPPER(calloc, void *, (size_t nmemb, size_t size), (nmemb, size))
       9                 :            : 
      10   [ +  +  +  + ]:       3771 : DEFINE_WRAPPER(pthread_mutex_init, int,
      11                 :            :                (pthread_mutex_t *mtx, const pthread_mutexattr_t *attr),
      12                 :            :                (mtx, attr))
      13                 :            : 
      14   [ +  +  +  + ]:        348 : DEFINE_WRAPPER(pthread_mutexattr_init, int,
      15                 :            :                (pthread_mutexattr_t *attr), (attr))
      16                 :            : 
      17   [ +  +  +  - ]:          4 : DEFINE_WRAPPER(recvmsg, ssize_t, (int sockfd, struct msghdr *msg, int flags), (sockfd, msg, flags))
      18                 :            : 
      19   [ +  +  +  + ]:         54 : DEFINE_WRAPPER(sendmsg, ssize_t, (int sockfd, const struct msghdr *msg, int flags), (sockfd, msg,
      20                 :            :                 flags))
      21                 :            : 
      22   [ +  +  +  - ]:         42 : DEFINE_WRAPPER(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt), (fd, iov, iovcnt))
      23                 :            : 
      24                 :            : char *g_unlink_path;
      25                 :            : void (*g_unlink_callback)(void);
      26                 :            : 
      27                 :            : int
      28                 :            : __attribute__((used))
      29                 :         74 : __wrap_unlink(const char *path)
      30                 :            : {
      31         [ +  + ]:         74 :         if (g_unlink_path == NULL) {
      32                 :         72 :                 return ENOENT;
      33                 :            :         }
      34                 :            : 
      35   [ -  +  -  +  :          2 :         if (strcmp(g_unlink_path, path) != 0) {
                   -  + ]
      36                 :          0 :                 return ENOENT;
      37                 :            :         }
      38                 :            : 
      39         [ +  - ]:          2 :         if (g_unlink_callback) {
      40                 :          2 :                 g_unlink_callback();
      41                 :            :         }
      42                 :          2 :         return 0;
      43                 :            : }

Generated by: LCOV version 1.14