LCOV - code coverage report
Current view: top level - network - fuzz-network-parser.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 0 15 0.0 %
Date: 2019-08-23 13:36:53 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 12 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include "fd-util.h"
       4                 :            : #include "fs-util.h"
       5                 :            : #include "fuzz.h"
       6                 :            : #include "networkd-manager.h"
       7                 :            : #include "tmpfile-util.h"
       8                 :            : 
       9                 :          0 : int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
      10                 :          0 :         _cleanup_(manager_freep) Manager *manager = NULL;
      11                 :          0 :         _cleanup_fclose_ FILE *f = NULL;
      12                 :          0 :         _cleanup_(unlink_tempfilep) char network_config[] = "/tmp/fuzz-networkd.XXXXXX";
      13                 :            : 
      14         [ #  # ]:          0 :         if (size > 65535)
      15                 :          0 :                 return 0;
      16                 :            : 
      17         [ #  # ]:          0 :         if (!getenv("SYSTEMD_LOG_LEVEL"))
      18                 :          0 :                 log_set_max_level(LOG_CRIT);
      19                 :            : 
      20         [ #  # ]:          0 :         assert_se(fmkostemp_safe(network_config, "r+", &f) == 0);
      21         [ #  # ]:          0 :         if (size != 0)
      22         [ #  # ]:          0 :                 assert_se(fwrite(data, size, 1, f) == 1);
      23                 :            : 
      24                 :          0 :         fflush(f);
      25         [ #  # ]:          0 :         assert_se(manager_new(&manager) >= 0);
      26                 :          0 :         (void) network_load_one(manager, network_config);
      27                 :          0 :         return 0;
      28                 :            : }

Generated by: LCOV version 1.14