LCOV - code coverage report
Current view: top level - spdk/test/unit/lib/util/net.c - net_ut.c (source / functions) Hit Total Coverage
Test: Combined Lines: 0 18 0.0 %
Date: 2024-07-15 20:55:59 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2024 Samsung Electronics Co., Ltd.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk/stdinc.h"
       7                 :            : #include "spdk_internal/cunit.h"
       8                 :            : #include "util/net.c"
       9                 :            : 
      10                 :            : static void
      11                 :          0 : get_interface_name(void)
      12                 :            : {
      13                 :          0 :         char ifc[32];
      14                 :            :         int rc;
      15                 :            : 
      16                 :          0 :         rc = spdk_net_get_interface_name("127.0.0.1", ifc, sizeof(ifc));
      17                 :          0 :         CU_ASSERT(rc == 0);
      18                 :          0 :         CU_ASSERT(strcmp(ifc, "lo") == 0);
      19                 :            : 
      20                 :            :         /* Verify that an invalid IP address returns -ENODEV. */
      21                 :          0 :         rc = spdk_net_get_interface_name("99.99.99.99", ifc, sizeof(ifc));
      22                 :          0 :         CU_ASSERT(rc == -ENODEV);
      23                 :            : 
      24                 :            :         /* Verify that an insufficient output string length returns -ENOMEM. */
      25                 :          0 :         rc = spdk_net_get_interface_name("127.0.0.1", ifc, 2);
      26                 :          0 :         CU_ASSERT(rc == -ENOMEM);
      27                 :          0 : }
      28                 :            : 
      29                 :            : int
      30                 :          0 : main(int argc, char **argv)
      31                 :            : {
      32                 :          0 :         CU_pSuite       suite = NULL;
      33                 :            :         unsigned int    num_failures;
      34                 :            : 
      35                 :          0 :         CU_initialize_registry();
      36                 :            : 
      37                 :          0 :         suite = CU_add_suite("net", NULL, NULL);
      38                 :            : 
      39                 :          0 :         CU_ADD_TEST(suite, get_interface_name);
      40                 :            : 
      41                 :          0 :         num_failures = spdk_ut_run_tests(argc, argv, NULL);
      42                 :            : 
      43                 :          0 :         CU_cleanup_registry();
      44                 :            : 
      45                 :          0 :         return num_failures;
      46                 :            : }

Generated by: LCOV version 1.14